{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/dwp-exchange-catalogue-entry/latest.json",
  "title": "Catalogue entry",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/dwp/schemas/main/exchange/publishing-tools/catalogue-entry-schema.json",
    "sourceSha256": "7cf0c8111be5fefa76b3a92d11f7832043d1b6c04bd9f3e2494f808d3a592a7c",
    "fileMatch": [
      "**/exchange-config/portal/catalogue-entry.yaml",
      "**/exchange-config/portal/catalogue-entry.yml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "description": {
      "type": "string",
      "minLength": 10,
      "maxLength": 200
    },
    "primaryContact": {
      "type": "object",
      "title": "Primary contact",
      "description": "Contact details for the owner of the asset, i.e. the Product Owner.These details will be used when customers make enquiries or request access to the asset through the portal.",
      "required": [
        "emailAddress"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 2,
          "maxLength": 60
        },
        "emailAddress": {
          "type": "string",
          "description": "must end with `gov.uk`",
          "pattern": "^.*@.*gov\\.uk$"
        },
        "role": {
          "type": "string",
          "minLength": 2
        }
      },
      "examples": [
        {
          "name": "Jo Doe",
          "emailAddress": "jo.doe@dwp.gov.uk",
          "role": "PO"
        }
      ],
      "additionalProperties": false
    },
    "technical_documentation": {
      "type": "object",
      "title": "Technical documentation",
      "description": "Allows you to provide paths to technical documentation to be published to the portal.",
      "required": [
        "oas_path"
      ],
      "properties": {
        "oas_path": {
          "type": "string",
          "description": "Path to the technical documentation, relative to the current working directory.",
          "pattern": "((?:[^/]*/)*)(?=\\.(yaml|yml))"
        }
      },
      "examples": [
        {
          "oas_path": "../oas/pet-store.yaml"
        }
      ],
      "additionalProperties": false
    },
    "filters": {
      "title": "Filters",
      "type": "object",
      "description": "A list of filtering options to improve searchability on the portal. Please check the README file to check the valid combinations of `lifecycle`, `profile`, and `access`.",
      "required": [
        "asset_type",
        "owner",
        "categories",
        "visibility",
        "lifecycle",
        "profile",
        "access"
      ],
      "allOf": [
        {
          "$ref": "#/properties/filters/$defs/active-lifecycle"
        },
        {
          "$ref": "#/properties/filters/$defs/deprecated-lifecycle"
        }
      ],
      "examples": [
        {
          "asset_type": "REST API",
          "owner": "Integration",
          "categories": [
            "Address"
          ],
          "visibility": "Internal",
          "lifecycle": "Prod",
          "profile": "Transitional",
          "access": "Open"
        }
      ],
      "properties": {
        "asset_type": {
          "type": "string",
          "enum": [
            "REST API",
            "SOAP API",
            "Event",
            "Datasets"
          ],
          "examples": [
            "REST API"
          ]
        },
        "owner": {
          "type": "string",
          "enum": [
            "AME Payments",
            "Citizen Income",
            "Citizen Information",
            "Document Repository Services",
            "Integration",
            "Legacy Bridge",
            "Notifications Platform",
            "Personal Independence Payment",
            "Reference Data Service",
            "Retirement, Bereavement & Care",
            "Common Capabilities",
            "Other"
          ],
          "examples": [
            "Integration"
          ]
        },
        "categories": {
          "title": "Categories",
          "type": "array",
          "minLength": 1,
          "maxLength": 3,
          "items": {
            "type": "string",
            "enum": [
              "Address",
              "Awards",
              "Citizen",
              "Data",
              "Document Services",
              "Financial",
              "GUID",
              "SMS",
              "Other"
            ]
          },
          "examples": [
            [
              "Address"
            ]
          ]
        },
        "visibility": {
          "type": "string",
          "description": "The scope of visibility for the API, either Public (visible to all) or Internal (visible to dwp only)",
          "enum": [
            "Internal",
            "Public"
          ],
          "examples": [
            "Internal"
          ]
        },
        "lifecycle": {
          "type": "string",
          "enum": [
            "In Development",
            "Pre-Prod",
            "Prod",
            "Deprecated",
            "Removed"
          ],
          "examples": [
            "In Development"
          ]
        },
        "profile": {
          "type": "string",
          "title": "The profile Schema",
          "enum": [
            "Strategic",
            "Transitional",
            "Legacy"
          ],
          "examples": [
            "Strategic"
          ]
        },
        "access": {
          "type": "string",
          "description": "The availability of the API",
          "enum": [
            "Open",
            "Closed"
          ],
          "examples": [
            "Open"
          ]
        }
      },
      "$defs": {
        "active-lifecycle": {
          "if": {
            "properties": {
              "lifecycle": {
                "enum": [
                  "In Development",
                  "Pre-Prod",
                  "Prod"
                ]
              }
            }
          },
          "then": {
            "properties": {
              "profile": {
                "enum": [
                  "Strategic",
                  "Transitional"
                ]
              },
              "access": {
                "enum": [
                  "Open",
                  "Closed"
                ]
              }
            }
          }
        },
        "deprecated-lifecycle": {
          "if": {
            "properties": {
              "lifecycle": {
                "enum": [
                  "Deprecated",
                  "Removed"
                ]
              }
            }
          },
          "then": {
            "properties": {
              "profile": {
                "const": "Legacy"
              },
              "access": {
                "const": "Closed"
              }
            }
          }
        }
      },
      "additionalProperties": false
    },
    "searchTags": {
      "type": "string",
      "description": "Tags to label the asset in order to increase discoverability. Minimum of 3 in CSV format.",
      "pattern": "^([^,]+(,|$)){3,}$",
      "examples": [
        "tag1, tag2, tag3"
      ]
    },
    "relatedAssets": {
      "title": "Related assets",
      "description": "A list of other assets that are related to the asset being published. Must match the Asset ID on the related asset's business documentation page on the portal at <https://gitlab.com/dwp/integration/api-exchange/exchange-content/-/tree/main/output/dwp/portal/workspaces/primary/content/_catalogueEntries>.",
      "type": "array",
      "items": {
        "type": "string",
        "examples": [
          "integration-alive-check-service-v1"
        ]
      }
    }
  },
  "required": [
    "description",
    "primaryContact",
    "filters",
    "searchTags"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "description": "This is an example service",
      "primaryContact": {
        "emailAddress": "test@gov.uk"
      },
      "technical_documentation": {
        "oas_path": "../oas/path-to-spec.yml"
      },
      "filters": {
        "asset_type": "REST API",
        "owner": "Integration",
        "categories": [
          "Address"
        ],
        "visibility": "Internal",
        "lifecycle": "Pre-Prod",
        "profile": "Transitional",
        "access": "Closed"
      },
      "searchTags": "test1,test2,test3"
    }
  ]
}
