{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/open-government-portugal/json-schema/open-government-portugal-dataset-search-page-schema.json",
  "title": "DatasetSearchPage",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/open-government-portugal-datasets-api-openapi.yml#/components/schemas/DatasetSearchPage",
  "properties": {
    "data": {
      "description": "The page data",
      "items": {
        "$ref": "#/$defs/Dataset_2"
      },
      "type": "array"
    },
    "facets": {
      "description": "Facets/aggregations for filtering",
      "type": "object"
    },
    "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",
  "x-mask": "{data{id,title,acronym,slug,description,description_short,created_at,last_modified,deleted,private,tags,badges,resources,community_resources,frequency,frequency_date,extras,metrics,organization,owner,temporal_coverage,spatial,license,access_type,access_audiences,access_type_reason_category,access_type_reason,authorization_request_url,uri,page,last_update,archived,quality,harvest,internal,contact_points,featured,permissions},*}",
  "$defs": {
    "AccessAudience__read": {
      "properties": {
        "condition": {
          "enum": [
            "yes",
            "no",
            "under_condition"
          ],
          "type": "string"
        },
        "role": {
          "enum": [
            "local_authority_and_administration",
            "company_and_association",
            "private"
          ],
          "type": "string"
        }
      },
      "type": "object"
    },
    "Badge__read": {
      "properties": {
        "kind": {
          "type": "string"
        }
      },
      "required": [
        "kind"
      ],
      "type": "object"
    },
    "ContactPoint__read_2": {
      "properties": {
        "contact_form": {
          "type": "string"
        },
        "email": {
          "maxLength": 255,
          "type": "string"
        },
        "id": {
          "readOnly": true,
          "type": "string"
        },
        "name": {
          "maxLength": 255,
          "type": "string"
        },
        "organization": {
          "allOf": [
            {
              "$ref": "#/$defs/OrganizationReference_2"
            }
          ],
          "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_2"
            }
          ],
          "description": "Only present if organization is not set. Can only be set to the current authenticated user."
        },
        "role": {
          "enum": [
            "contact",
            "creator",
            "publisher",
            "rightsHolder",
            "custodian",
            "distributor",
            "originator",
            "principalInvestigator",
            "processor",
            "resourceProvider",
            "user"
          ],
          "type": "string"
        }
      },
      "required": [
        "id",
        "name",
        "role"
      ],
      "type": "object"
    },
    "DatasetInternals": {
      "properties": {
        "created_at_internal": {
          "description": "The dataset's internal creation date on the site",
          "format": "date-time",
          "type": "string"
        },
        "last_modified_internal": {
          "description": "The dataset's internal last modification date",
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "created_at_internal",
        "last_modified_internal"
      ],
      "type": "object"
    },
    "DatasetPermissions": {
      "properties": {
        "delete": {
          "type": "boolean"
        },
        "edit": {
          "type": "boolean"
        },
        "edit_resources": {
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "Dataset_2": {
      "properties": {
        "access_audiences": {
          "$ref": "#/$defs/AccessAudience__read"
        },
        "access_type": {
          "type": "string"
        },
        "access_type_reason": {
          "type": "string"
        },
        "access_type_reason_category": {
          "type": "string"
        },
        "acronym": {
          "description": "An optional dataset acronym",
          "type": "string"
        },
        "archived": {
          "description": "The archival date if archived",
          "format": "date-time",
          "type": "string"
        },
        "authorization_request_url": {
          "type": "string"
        },
        "badges": {
          "description": "The dataset badges",
          "items": {
            "$ref": "#/$defs/Badge__read"
          },
          "readOnly": true,
          "type": "array"
        },
        "community_resources": {
          "description": "Link to the dataset community resources",
          "type": "object"
        },
        "contact_points": {
          "description": "The dataset contact points",
          "items": {
            "$ref": "#/$defs/ContactPoint__read_2"
          },
          "type": "array"
        },
        "created_at": {
          "description": "The dataset creation date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "deleted": {
          "description": "The deletion date if deleted",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "description": {
          "description": "The dataset description in markdown",
          "format": "markdown",
          "type": "string"
        },
        "description_short": {
          "description": "The dataset short description",
          "type": "string"
        },
        "extras": {
          "description": "Extras attributes as key-value pairs",
          "type": "object"
        },
        "featured": {
          "description": "Is the dataset featured",
          "type": "boolean"
        },
        "frequency": {
          "default": "unknown",
          "description": "The update frequency (full Frequency object if `X-Get-Datasets-Full-Objects` is set, ID of the frequency otherwise)",
          "type": "object"
        },
        "frequency_date": {
          "description": "Next expected update date, you will be notified once that date is reached.",
          "format": "date-time",
          "type": "string"
        },
        "harvest": {
          "allOf": [
            {
              "$ref": "#/$defs/HarvestDatasetMetadata"
            }
          ],
          "description": "Dataset harvest metadata attributes",
          "readOnly": true
        },
        "id": {
          "description": "The dataset identifier",
          "readOnly": true,
          "type": "string"
        },
        "internal": {
          "allOf": [
            {
              "$ref": "#/$defs/DatasetInternals"
            }
          ],
          "description": "Site internal and specific object's data",
          "readOnly": true
        },
        "last_modified": {
          "description": "The dataset last modification date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "last_update": {
          "description": "The resources last modification date",
          "format": "date-time",
          "type": "string"
        },
        "license": {
          "default": "notspecified",
          "description": "The dataset license (full License object if `X-Get-Datasets-Full-Objects` is set, ID of the license otherwise)",
          "type": "object"
        },
        "metrics": {
          "description": "The dataset metrics",
          "type": "object"
        },
        "organization": {
          "allOf": [
            {
              "$ref": "#/$defs/OrganizationReference_2"
            }
          ],
          "description": "The producer organization"
        },
        "owner": {
          "allOf": [
            {
              "$ref": "#/$defs/UserReference_2"
            }
          ],
          "description": "The user information"
        },
        "page": {
          "description": "The dataset web page URL",
          "readOnly": true,
          "type": "string"
        },
        "permissions": {
          "$ref": "#/$defs/DatasetPermissions"
        },
        "private": {
          "description": "Is the dataset private to the owner or the organization",
          "type": "boolean"
        },
        "quality": {
          "description": "The dataset quality",
          "readOnly": true,
          "type": "object"
        },
        "resources": {
          "description": "Link to the dataset resources",
          "type": "object"
        },
        "slug": {
          "description": "The dataset permalink string",
          "readOnly": true,
          "type": "string"
        },
        "spatial": {
          "allOf": [
            {
              "$ref": "#/$defs/SpatialCoverage"
            }
          ],
          "description": "The spatial coverage"
        },
        "tags": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "temporal_coverage": {
          "allOf": [
            {
              "$ref": "#/$defs/TemporalCoverage"
            }
          ],
          "description": "The temporal coverage"
        },
        "title": {
          "description": "The dataset title",
          "type": "string"
        },
        "uri": {
          "description": "The API URI for this dataset",
          "readOnly": true,
          "type": "string"
        }
      },
      "required": [
        "created_at",
        "description",
        "frequency",
        "last_modified",
        "last_update",
        "title"
      ],
      "type": "object",
      "x-mask": "{id,title,acronym,slug,description,description_short,created_at,last_modified,deleted,private,tags,badges,resources,community_resources,frequency,frequency_date,extras,metrics,organization,owner,temporal_coverage,spatial,license,access_type,access_audiences,access_type_reason_category,access_type_reason,authorization_request_url,uri,page,last_update,archived,quality,harvest,internal,contact_points,featured,permissions}"
    },
    "GeoJSON": {
      "properties": {
        "coordinates": {
          "description": "The geometry as coordinates lists",
          "items": {
            "type": "object"
          },
          "type": "array"
        },
        "type": {
          "description": "The GeoJSON Type",
          "enum": [
            "Point",
            "LineString",
            "Polygon",
            "MultiPoint",
            "MultiLineString",
            "MultiPolygon"
          ],
          "type": "string"
        }
      },
      "required": [
        "coordinates",
        "type"
      ],
      "type": "object"
    },
    "HarvestDatasetMetadata": {
      "properties": {
        "archived": {
          "description": "The reason the dataset has been archived",
          "type": "string"
        },
        "archived_at": {
          "description": "The archive date",
          "format": "date-time",
          "type": "string"
        },
        "backend": {
          "description": "Harvest backend used",
          "type": "string"
        },
        "created_at": {
          "description": "The dataset harvested creation date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "dct_identifier": {
          "description": "The dct:identifier property from the harvested dataset",
          "type": "string"
        },
        "domain": {
          "description": "The harvested domain",
          "type": "string"
        },
        "issued_at": {
          "description": "The dataset harvested release date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "last_update": {
          "description": "The last harvest date",
          "format": "date-time",
          "type": "string"
        },
        "modified_at": {
          "description": "The dataset harvest last modification date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "remote_id": {
          "description": "The dataset remote id on the source portal",
          "type": "string"
        },
        "remote_url": {
          "description": "The dataset remote url",
          "type": "string"
        },
        "source_id": {
          "description": "The harvester id",
          "type": "string"
        },
        "uri": {
          "description": "The dataset harveted uri",
          "type": "string"
        }
      },
      "type": "object"
    },
    "OrganizationPermissions": {
      "properties": {
        "delete": {
          "type": "boolean"
        },
        "edit": {
          "type": "boolean"
        },
        "harvest": {
          "type": "boolean"
        },
        "members": {
          "type": "boolean"
        },
        "private": {
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "OrganizationReference_2": {
      "properties": {
        "acronym": {
          "description": "The organization acronym",
          "type": "string"
        },
        "badges": {
          "description": "The organization badges",
          "items": {
            "$ref": "#/$defs/Badge__read"
          },
          "readOnly": true,
          "type": "array"
        },
        "logo": {
          "description": "The organization logo URL",
          "type": "string"
        },
        "logo_thumbnail": {
          "description": "The organization logo thumbnail URL. This is the square (100x100) and cropped version.",
          "type": "string"
        },
        "name": {
          "description": "The organization name",
          "readOnly": true,
          "type": "string"
        },
        "page": {
          "description": "The organization web page URL",
          "readOnly": true,
          "type": "string"
        },
        "permissions": {
          "allOf": [
            {
              "$ref": "#/$defs/OrganizationPermissions"
            }
          ],
          "readOnly": true
        },
        "slug": {
          "description": "The organization string used as permalink",
          "readOnly": true,
          "type": "string"
        },
        "uri": {
          "description": "The API URI for this organization",
          "readOnly": true,
          "type": "string"
        }
      },
      "type": "object"
    },
    "SpatialCoverage": {
      "properties": {
        "geom": {
          "allOf": [
            {
              "$ref": "#/$defs/GeoJSON"
            }
          ],
          "description": "A multipolygon for the whole coverage"
        },
        "granularity": {
          "default": "other",
          "description": "The spatial/territorial granularity (full Granularity object if `X-Get-Datasets-Full-Objects` is set, ID of the granularity otherwise)",
          "type": "object"
        },
        "zones": {
          "description": "The covered zones identifiers (full GeoZone objects if `X-Get-Datasets-Full-Objects` is set, IDs of the zones otherwise)",
          "type": "object"
        }
      },
      "type": "object"
    },
    "TemporalCoverage": {
      "properties": {
        "end": {
          "description": "The temporal coverage end date",
          "format": "date-time",
          "type": "string"
        },
        "start": {
          "description": "The temporal coverage start date",
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "start"
      ],
      "type": "object"
    },
    "UserReference_2": {
      "properties": {
        "avatar": {
          "description": "The user avatar URL",
          "type": "string"
        },
        "avatar_thumbnail": {
          "description": "The user avatar thumbnail URL. This is the square (500x500) and cropped version.",
          "type": "string"
        },
        "first_name": {
          "description": "The user first name",
          "readOnly": true,
          "type": "string"
        },
        "last_name": {
          "description": "The user larst name",
          "readOnly": true,
          "type": "string"
        },
        "page": {
          "description": "The user web page URL",
          "readOnly": true,
          "type": "string"
        },
        "slug": {
          "description": "The user permalink string",
          "readOnly": true,
          "type": "string"
        },
        "uri": {
          "description": "The API URI for this user",
          "readOnly": true,
          "type": "string"
        }
      },
      "type": "object"
    }
  }
}