{
  "$id": "https://rumankazi.github.io/flowpact/schemas/contract/v1.json",
  "title": "flowpact contract",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string"
    },
    "version": {
      "type": "number",
      "const": 1
    },
    "kind": {
      "type": "string",
      "enum": [
        "workflow",
        "action"
      ]
    },
    "path": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "triggers": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "interface": {
      "type": "object",
      "properties": {
        "inputs": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "default": {
                "$ref": "#/$defs/__schema0"
              },
              "description": {
                "type": "string"
              },
              "options": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "required"
            ],
            "additionalProperties": false
          }
        },
        "dispatchInputs": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              },
              "default": {
                "$ref": "#/$defs/__schema0"
              },
              "description": {
                "type": "string"
              },
              "options": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "required"
            ],
            "additionalProperties": false
          }
        },
        "secrets": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "required": {
                "type": "boolean"
              }
            },
            "required": [
              "required"
            ],
            "additionalProperties": false
          }
        },
        "outputs": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "description": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "required": [
        "inputs",
        "outputs"
      ],
      "additionalProperties": false
    },
    "calls": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "job": {
            "type": "string"
          },
          "uses": {
            "type": "string"
          },
          "with": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "secrets": {
            "anyOf": [
              {
                "type": "string",
                "const": "inherit"
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            ]
          },
          "needs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "matrix": {
            "type": "object",
            "properties": {
              "combinations": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "keys": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "exact": {
                "type": "boolean"
              }
            },
            "required": [
              "combinations",
              "keys",
              "exact"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "job",
          "uses"
        ],
        "additionalProperties": false
      }
    },
    "uses": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "job": {
            "type": "string"
          },
          "step": {
            "type": "string"
          },
          "uses": {
            "type": "string"
          },
          "with": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          }
        },
        "required": [
          "step",
          "uses"
        ],
        "additionalProperties": false
      }
    },
    "consumers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string"
          },
          "job": {
            "type": "string"
          },
          "step": {
            "type": "string"
          },
          "passes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reads": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "from",
          "passes",
          "reads"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "$schema",
    "version",
    "kind",
    "path",
    "interface",
    "consumers"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema0"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema0"
          }
        }
      ]
    }
  }
}
