TypeSpec · JSON Structure

Typespec Model Structure

Structural definition of a TypeSpec model type

Type: object Properties: 8
API DesignCode GenerationOpenAPIProtocol BuffersSpecification Language

Typespec Model Structure is a JSON Structure definition published by TypeSpec, describing 8 properties. It conforms to the https://json-schema.org/draft/2020-12/schema meta-schema.

Properties

kind name namespace properties baseModel indexer decorators isFinished

Meta-schema: https://json-schema.org/draft/2020-12/schema

JSON Structure

typespec-model-structure.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "TypeSpec Model Structure",
  "description": "Structural definition of a TypeSpec model type",
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "enum": ["Model"],
      "description": "TypeSpec node kind"
    },
    "name": {
      "type": "string",
      "description": "Model type name"
    },
    "namespace": {
      "type": "object",
      "description": "Containing namespace"
    },
    "properties": {
      "type": "object",
      "description": "Map of property names to ModelProperty nodes",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "name": {"type": "string"},
          "type": {"type": "object"},
          "optional": {"type": "boolean"},
          "decorators": {"type": "array"}
        }
      }
    },
    "baseModel": {
      "type": "object",
      "description": "Extended base model (via `extends`)"
    },
    "indexer": {
      "type": "object",
      "description": "Index signature for record types"
    },
    "decorators": {
      "type": "array",
      "description": "Applied decorators"
    },
    "isFinished": {
      "type": "boolean",
      "description": "Whether the model has been fully resolved"
    }
  }
}