{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "CityJSONFeature v2.0.2",
  "$id": "https://www.cityjson.org/schemas/2.0.2/cityjsonfeature.schema.json",  
  "description": "CityJSONFeature schema v2.0.2",
  "type": "object",
  "properties": {
    "type": {
      "const": "CityJSONFeature"
    },
    "id": { "type": "string" },
    "CityObjects": {
      "type": "object",
      "additionalProperties": {
        "oneOf": [
          {
            "$ref": "cityobjects.schema.json#/Bridge"
          },
          {
            "$ref": "cityobjects.schema.json#/BridgeConstructiveElement"
          },
          {
            "$ref": "cityobjects.schema.json#/BridgeFurniture"
          },
          {
            "$ref": "cityobjects.schema.json#/BridgeInstallation"
          },
          {
            "$ref": "cityobjects.schema.json#/BridgePart"
          },
          {
            "$ref": "cityobjects.schema.json#/BridgeRoom"
          },
          {
            "$ref": "cityobjects.schema.json#/Building"
          },
          {
            "$ref": "cityobjects.schema.json#/BuildingConstructiveElement"
          },
          {
            "$ref": "cityobjects.schema.json#/BuildingFurniture"
          },
          {
            "$ref": "cityobjects.schema.json#/BuildingInstallation"
          },
          {
            "$ref": "cityobjects.schema.json#/BuildingPart"
          },
          {
            "$ref": "cityobjects.schema.json#/BuildingRoom"
          },
          {
            "$ref": "cityobjects.schema.json#/BuildingStorey"
          },
          {
            "$ref": "cityobjects.schema.json#/BuildingUnit"
          },
          {
            "$ref": "cityobjects.schema.json#/CityFurniture"
          },
          {
            "$ref": "cityobjects.schema.json#/CityObjectGroup"
          },
          {
            "$ref": "cityobjects.schema.json#/ExtensionObject"
          },
          {
            "$ref": "cityobjects.schema.json#/GenericCityObject"
          },          
          {
            "$ref": "cityobjects.schema.json#/LandUse"
          },
          {
            "$ref": "cityobjects.schema.json#/OtherConstruction"
          },
          {
            "$ref": "cityobjects.schema.json#/PlantCover"
          },
          {
            "$ref": "cityobjects.schema.json#/Railway"
          },
          {
            "$ref": "cityobjects.schema.json#/Road"
          },
          {
            "$ref": "cityobjects.schema.json#/SolitaryVegetationObject"
          },
          {
            "$ref": "cityobjects.schema.json#/TINRelief"
          },
          {
            "$ref": "cityobjects.schema.json#/TransportSquare"
          },
          {
            "$ref": "cityobjects.schema.json#/Tunnel"
          },
          {
            "$ref": "cityobjects.schema.json#/TunnelConstructiveElement"
          },
          {
            "$ref": "cityobjects.schema.json#/TunnelFurniture"
          },
          {
            "$ref": "cityobjects.schema.json#/TunnelHollowSpace"
          },
          {
            "$ref": "cityobjects.schema.json#/TunnelInstallation"
          },
          {
            "$ref": "cityobjects.schema.json#/TunnelPart"
          },
          {
            "$ref": "cityobjects.schema.json#/WaterBody"
          },
          {
            "$ref": "cityobjects.schema.json#/Waterway"
          }
        ]
      }
    },
    "vertices": {
      "type": "array",
      "items": {
        "type": "array",
        "items": {
          "type": "number"
        },
        "minItems": 3,
        "maxItems": 3
      }
    },
    "appearance": {
      "type": "object",
      "properties": {
        "default-theme-texture": {
          "type": "string"
        },
        "default-theme-material": {
          "type": "string"
        },
        "materials": {
          "type": "array",
          "items": {
            "$ref": "appearance.schema.json#/Material"
          }
        },
        "textures": {
          "type": "array",
          "items": {
            "$ref": "appearance.schema.json#/Texture"
          }
        },
        "vertices-texture": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "minItems": 2,
            "maxItems": 2
          }
        }
      },
      "additionalProperties": false
    }
  },
  "required": [
    "type",
    "id",
    "CityObjects",
    "vertices"
  ],
  "not": {
    "anyOf": [
      { "required": ["transform"] },
      { "required": ["version"] },
      { "required": ["metadata"] },
      { "required": ["geometry-templates"] },
      { "required": ["extensions"] }
    ]
  },
  "additionalProperties": true
}
