{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/api-gouv-fr/json-schema/api-gouv-fr-harvest-source-page-schema.json",
  "title": "HarvestSourcePage",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/api-gouv-fr-harvest-api-openapi.yml#/components/schemas/HarvestSourcePage",
  "properties": {
    "data": {
      "description": "The page data",
      "items": {
        "$ref": "#/$defs/HarvestSource__read"
      },
      "type": "array"
    },
    "next_page": {
      "description": "The next page URL if exists",
      "type": "string"
    },
    "page": {
      "description": "The current page",
      "minimum": 1,
      "type": "integer"
    },
    "page_size": {
      "description": "The page size used for pagination",
      "minimum": 0,
      "type": "integer"
    },
    "previous_page": {
      "description": "The previous page URL if exists",
      "type": "string"
    },
    "total": {
      "description": "The total paginated items",
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "page",
    "page_size",
    "total"
  ],
  "type": "object",
  "$defs": {
    "Badge__read": {
      "properties": {
        "kind": {
          "type": "string"
        }
      },
      "required": [
        "kind"
      ],
      "type": "object"
    },
    "BaseReference": {
      "properties": {
        "class": {
          "description": "The object class",
          "type": "string"
        },
        "id": {
          "description": "The object unique identifier",
          "type": "string"
        }
      },
      "required": [
        "class",
        "id"
      ],
      "type": "object"
    },
    "HarvestError__read": {
      "properties": {
        "created_at": {
          "description": "The error creation date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "details": {
          "description": "Optional details (only for super-admins)",
          "readOnly": true,
          "type": "string"
        },
        "message": {
          "description": "The error short message",
          "type": "string"
        }
      },
      "required": [
        "created_at"
      ],
      "type": "object"
    },
    "HarvestJob__read": {
      "properties": {
        "created": {
          "description": "The job creation date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "ended": {
          "description": "The job end date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "errors": {
          "description": "The job initialization errors",
          "items": {
            "allOf": [
              {
                "$ref": "#/$defs/HarvestError__read"
              }
            ],
            "description": "The job initialization errors",
            "readOnly": true
          },
          "readOnly": true,
          "type": "array"
        },
        "id": {
          "readOnly": true,
          "type": "string"
        },
        "items": {
          "description": "Visit this API link to see the list.",
          "readOnly": true,
          "type": "object"
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/$defs/HarvestSourceReference"
            }
          ],
          "description": "The source owning the job",
          "readOnly": true
        },
        "started": {
          "description": "The job start date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "status": {
          "description": "The job status",
          "enum": [
            "pending",
            "initializing",
            "initialized",
            "processing",
            "done",
            "done-errors",
            "failed"
          ],
          "readOnly": true,
          "type": "string"
        }
      },
      "required": [
        "created",
        "id",
        "status"
      ],
      "type": "object"
    },
    "HarvestSourcePermissions": {
      "properties": {
        "delete": {
          "type": "boolean"
        },
        "edit": {
          "type": "boolean"
        },
        "preview": {
          "type": "boolean"
        },
        "run": {
          "type": "boolean"
        },
        "schedule": {
          "type": "boolean"
        },
        "validate": {
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "HarvestSourceReference": {
      "allOf": [
        {
          "$ref": "#/$defs/BaseReference"
        },
        {
          "properties": {},
          "type": "object"
        }
      ]
    },
    "HarvestSourceValidation__read": {
      "properties": {
        "by": {
          "allOf": [
            {
              "$ref": "#/$defs/UserReference"
            }
          ],
          "description": "Who performed the validation",
          "readOnly": true
        },
        "comment": {
          "description": "A comment about the validation. Required on rejection",
          "type": "string"
        },
        "on": {
          "description": "Date on which validation was performed",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "state": {
          "description": "Is it validated or not",
          "enum": [
            "pending",
            "accepted",
            "refused"
          ],
          "type": "string"
        }
      },
      "required": [
        "state"
      ],
      "type": "object"
    },
    "HarvestSource__read": {
      "properties": {
        "active": {
          "description": "Is this source active",
          "type": "boolean"
        },
        "autoarchive": {
          "description": "If enabled, datasets not present on the remote source will be automatically archived",
          "type": "boolean"
        },
        "backend": {
          "description": "The source backend",
          "type": "string"
        },
        "config": {
          "description": "The configuration as key-value pairs",
          "type": "object"
        },
        "created_at": {
          "description": "The source creation date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "deleted": {
          "description": "The source deletion date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "description": {
          "description": "The source description",
          "format": "markdown",
          "type": "string"
        },
        "id": {
          "readOnly": true,
          "type": "string"
        },
        "last_job": {
          "allOf": [
            {
              "$ref": "#/$defs/HarvestJob__read"
            }
          ],
          "description": "The last job for this source",
          "readOnly": true
        },
        "name": {
          "description": "The source display name",
          "maxLength": 255,
          "type": "string"
        },
        "organization": {
          "allOf": [
            {
              "$ref": "#/$defs/OrganizationReference"
            }
          ],
          "description": "Only present if owner is not set. Can only be set to an organization of the current authenticated user."
        },
        "owner": {
          "allOf": [
            {
              "$ref": "#/$defs/UserReference"
            }
          ],
          "description": "Only present if organization is not set. Can only be set to the current authenticated user."
        },
        "permissions": {
          "allOf": [
            {
              "$ref": "#/$defs/HarvestSourcePermissions"
            }
          ],
          "readOnly": true
        },
        "schedule": {
          "description": "The source schedule (interval or cron expression)",
          "readOnly": true,
          "type": "string"
        },
        "slug": {
          "description": "The source permalink string",
          "maxLength": 255,
          "readOnly": true,
          "type": "string"
        },
        "url": {
          "description": "The source base URL",
          "type": "string"
        },
        "validation": {
          "allOf": [
            {
              "$ref": "#/$defs/HarvestSourceValidation__read"
            }
          ],
          "description": "Has the source been validated",
          "readOnly": true
        }
      },
      "required": [
        "backend",
        "created_at",
        "id",
        "name",
        "slug",
        "url"
      ],
      "type": "object"
    },
    "OrganizationPermissions": {
      "properties": {
        "delete": {
          "type": "boolean"
        },
        "edit": {
          "type": "boolean"
        },
        "harvest": {
          "type": "boolean"
        },
        "members": {
          "type": "boolean"
        },
        "private": {
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "OrganizationReference": {
      "allOf": [
        {
          "$ref": "#/$defs/BaseReference"
        },
        {
          "properties": {
            "acronym": {
              "maxLength": 128,
              "type": "string"
            },
            "badges": {
              "items": {
                "allOf": [
                  {
                    "$ref": "#/$defs/Badge__read"
                  }
                ],
                "readOnly": true
              },
              "readOnly": true,
              "type": "array"
            },
            "logo": {
              "description": "URL of the image",
              "readOnly": true,
              "type": "string"
            },
            "logo_thumbnail": {
              "description": "URL of the cropped and squared image (100x100)",
              "readOnly": true,
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "page": {
              "description": "Link to the udata web page for this organization",
              "readOnly": true,
              "type": "string"
            },
            "permissions": {
              "allOf": [
                {
                  "$ref": "#/$defs/OrganizationPermissions"
                }
              ],
              "readOnly": true
            },
            "slug": {
              "maxLength": 255,
              "readOnly": true,
              "type": "string"
            },
            "uri": {
              "description": "Link to the API endpoint for this organization",
              "readOnly": true,
              "type": "string"
            }
          },
          "required": [
            "name",
            "slug"
          ],
          "type": "object"
        }
      ]
    },
    "UserReference": {
      "allOf": [
        {
          "$ref": "#/$defs/BaseReference"
        },
        {
          "properties": {
            "avatar": {
              "description": "URL of the image",
              "readOnly": true,
              "type": "string"
            },
            "avatar_thumbnail": {
              "description": "URL of the cropped and squared image (500x500)",
              "readOnly": true,
              "type": "string"
            },
            "deleted": {
              "description": "The date the account was deleted, null for a live account",
              "format": "date-time",
              "readOnly": true,
              "type": "string"
            },
            "first_name": {
              "maxLength": 255,
              "type": "string"
            },
            "last_name": {
              "maxLength": 255,
              "type": "string"
            },
            "page": {
              "description": "Link to the udata web page for this user",
              "readOnly": true,
              "type": "string"
            },
            "slug": {
              "maxLength": 255,
              "readOnly": true,
              "type": "string"
            },
            "uri": {
              "description": "Link to the API endpoint for this user",
              "readOnly": true,
              "type": "string"
            }
          },
          "required": [
            "first_name",
            "last_name",
            "slug"
          ],
          "type": "object"
        }
      ]
    }
  }
}