{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/listings-api/json-schema/listings-api-listing-union-schema.json",
  "title": "ListingUnion",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/listings-api-listings-api-openapi.yml#/components/schemas/ListingUnion",
  "oneOf": [
    {
      "$ref": "#/$defs/ListingType"
    },
    {
      "$ref": "#/$defs/PremiumListingType"
    },
    {
      "$ref": "#/$defs/AdditionalListingType"
    }
  ],
  "$defs": {
    "AdditionalListingType": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "site": {
          "$ref": "#/$defs/SiteType"
        }
      }
    },
    "ContextInfoType": {
      "type": "object",
      "description": "(also defined by packaging) (also defined by task-manager)",
      "properties": {
        "key": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      }
    },
    "ErrorType": {
      "type": "object",
      "description": "(also defined by contests) (also defined by packaging) (also defined by task-manager) (also defined by social-media) (also defined by messenger) (also defined by crm-integration) (also defined by crawler) (also defined by media-manager)",
      "properties": {
        "message": {
          "type": "string"
        },
        "contextInfo": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ContextInfoType"
          }
        },
        "code": {
          "type": "string"
        }
      }
    },
    "ListingSyncStatusType": {
      "type": "string",
      "enum": [
        "IN_PROGRESS",
        "SYNCED",
        "FAILED",
        "REQUIRING_ACTION",
        "AVAILABLE",
        "COMPLETED",
        "PENDING_APPROVAL",
        "CANNOT_SUBMIT"
      ]
    },
    "ListingType": {
      "type": "object",
      "description": "A single listing on an external directory site.",
      "properties": {
        "id": {
          "type": "string"
        },
        "databaseId": {
          "type": "string"
        },
        "listingUrl": {
          "type": "string"
        },
        "syncStatus": {
          "$ref": "#/$defs/ListingSyncStatusType"
        },
        "displayStatus": {
          "type": "string"
        },
        "syncIssue": {
          "type": "string"
        },
        "actionRequired": {
          "type": "boolean"
        },
        "site": {
          "$ref": "#/$defs/SiteType"
        },
        "lastUpdate": {
          "type": "string"
        },
        "verified": {
          "type": "boolean"
        },
        "errors": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ErrorType"
          }
        },
        "indexStatus": {
          "type": "boolean"
        },
        "httpStatus": {
          "type": "integer",
          "format": "int32"
        },
        "issueType": {
          "type": "string"
        }
      }
    },
    "PremiumListingType": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "site": {
          "$ref": "#/$defs/SiteType"
        }
      }
    },
    "SiteType": {
      "type": "object",
      "description": "Directory site metadata.",
      "properties": {
        "id": {
          "type": "string"
        },
        "databaseId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "syScore": {
          "type": "string"
        },
        "addOn": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "databaseId",
        "url"
      ]
    }
  }
}