{
  "$schema": "https://raw.githubusercontent.com/elyra-ai/elyra/master/elyra/metadata/schemas/meta-schema.json",
  "$id": "https://raw.githubusercontent.com/elyra-ai/elyra/master/elyra/metadata/schemas/code-snippet.json",
  "title": "Code Snippet",
  "name": "code-snippet",
  "schemaspace": "code-snippets",
  "schemaspace_id": "aa60988f-8f7c-4d09-a243-c54ef9c2f7fb",
  "uihints": {
    "title": "Code Snippets",
    "icon": "elyra:code-snippet",
    "reference_url": "https://elyra.readthedocs.io/en/v3.8.0/user_guide/code-snippets.html"
  },
  "properties": {
    "schema_name": {
      "title": "Schema Name",
      "description": "The schema associated with this instance",
      "type": "string",
      "const": "code-snippet"
    },
    "display_name": {
      "title": "Display Name",
      "description": "The display name of the Code Snippet",
      "type": "string",
      "minLength": 1
    },
    "metadata": {
      "description": "Additional data specific to this Code Snippet",
      "type": "object",
      "properties": {
        "description": {
          "title": "Description",
          "description": "Code snippet description",
          "type": "string"
        },
        "tags": {
          "title": "Tags",
          "description": "Tags for categorizing snippets",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "allOf": [
              { "minLength": 1 },
              { "pattern": "^[^ \t]+" },
              { "pattern": "[^ \t]+$" }
            ]
          },
          "uihints": {
            "field_type": "tags"
          }
        },
        "language": {
          "title": "Language",
          "description": "Code snippet implementation language",
          "type": "string",
          "uihints": {
            "field_type": "dropdown",
            "default_choices": ["Python", "Java", "R", "Scala", "Markdown"],
            "category": "Source"
          },
          "minLength": 1
        },
        "code": {
          "title": "Code",
          "description": "Code snippet code lines",
          "type": "array",
          "uihints": {
            "field_type": "code",
            "category": "Source"
          }
        }
      },
      "required": ["language", "code"]
    }
  },
  "required": ["schema_name", "display_name", "metadata"]
}
