{
  "openapi": "3.1.0",
  "info": {
    "title": "Core Data Element (DAK) API",
    "description": "Logical Model for representing Core Data Elements from a DAK. A core data element can be one of: a ValueSet, a CodeSystem, a ConceptMap, or a Logical Model adherent to SGLogicalModel. This is the ONE EXCEPTION to allowing FHIR R4 models into the DAK LMs.",
    "version": "1.0.0"
  },
  "paths": {
    "/StructureDefinition-CoreDataElement.schema.json": {
      "get": {
        "summary": "JSON Schema definition for the Logical Model StructureDefinition-CoreDataElement",
        "description": "This endpoint serves the JSON Schema definition for the Logical Model StructureDefinition-CoreDataElement.",
        "responses": {
          "200": {
            "description": "The JSON Schema for StructureDefinition-CoreDataElement",
            "content": {
              "application/schema+json": {
                "schema": {
                  "$ref": "./StructureDefinition-CoreDataElement.schema.json"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "StructureDefinition-CoreDataElement": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "http://smart.who.int/base/StructureDefinition-CoreDataElement.schema.json",
        "title": "Core Data Element (DAK)",
        "description": "Logical Model for representing Core Data Elements from a DAK. A core data element can be one of: a ValueSet, a CodeSystem, a ConceptMap, or a Logical Model adherent to SGLogicalModel. This is the ONE EXCEPTION to allowing FHIR R4 models into the DAK LMs.",
        "type": "object",
        "properties": {
          "resourceType": {
            "type": "string",
            "const": "CoreDataElement",
            "description": "Resource type identifier for CoreDataElement logical model"
          },
          "@context": {
            "description": "JSON-LD context for this logical model with ValueSet vocabularies",
            "anyOf": [
              {
                "type": "string",
                "format": "uri",
                "description": "URI reference to external JSON-LD context"
              },
              {
                "type": "object",
                "description": "Inline JSON-LD context",
                "properties": {
                  "@version": {
                    "type": "number",
                    "const": 1.1
                  },
                  "fhir": {
                    "type": "string",
                    "const": "http://hl7.org/fhir/"
                  }
                },
                "additionalProperties": {
                  "type": "string",
                  "format": "uri"
                }
              },
              {
                "type": "array",
                "description": "Array of JSON-LD context objects/URIs",
                "items": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uri"
                    },
                    {
                      "type": "object"
                    }
                  ]
                }
              }
            ]
          },
          "@type": {
            "type": "string",
            "description": "JSON-LD type identifier for CoreDataElement logical model",
            "examples": [
              "LogicalModel-CoreDataElement"
            ]
          },
          "type": {
            "$ref": "./ValueSet-CoreDataElementTypeVS.schema.json",
            "description": "Type of core data element: valueset, codesystem, conceptmap, or logicalmodel"
          },
          "canonical": {
            "type": "string",
            "format": "uri",
            "description": "Canonical URI/IRI pointing to the ValueSet, CodeSystem, ConceptMap, or Logical Model definition"
          },
          "id": {
            "type": "string",
            "description": "Identifier for the core data element"
          },
          "description[x]": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "string",
                "format": "uri"
              }
            ],
            "description": "Description of the core data element - either Markdown content or a URI to a Markdown file (absolute or relative to repository root)"
          }
        },
        "required": [
          "resourceType",
          "type",
          "canonical"
        ],
        "allOf": [
          {
            "$ref": "./StructureDefinition-FHIRSchemaBase.schema.json"
          },
          {
            "type": "object",
            "properties": {
              "resourceDefinition": {
                "type": "string",
                "format": "uri",
                "const": "http://smart.who.int/base/StructureDefinition/CoreDataElement"
              },
              "fhir:parent": {
                "type": "string",
                "const": "http://hl7.org/fhir/StructureDefinition/Base"
              },
              "jsonld:valuesets": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "const": [
                  "CoreDataElementTypeVS"
                ]
              },
              "jsonld:contextTemplate": {
                "type": "object",
                "const": {
                  "@version": 1.1,
                  "fhir": "http://hl7.org/fhir/",
                  "CoreDataElementTypeVS": "http://smart.who.int/base/ValueSet-CoreDataElementTypeVS.jsonld"
                }
              }
            }
          }
        ]
      }
    }
  }
}