## Documentation index

This index lists every available documentation page and its Markdown source.

- [About VDL](https://vdl.varavel.com/docs/about/index.md)
- [Guides](https://vdl.varavel.com/docs/guides/index.md)
  - [Installation](https://vdl.varavel.com/docs/guides/installation/index.md)
  - [CLI Commands](https://vdl.varavel.com/docs/guides/cli/index.md)
  - [Editor Integration](https://vdl.varavel.com/docs/guides/editors/index.md)
  - [Project Configuration](https://vdl.varavel.com/docs/guides/configuration/index.md)
  - [Creating Plugins](https://vdl.varavel.com/docs/guides/creating-plugins/index.md)
- [Language](https://vdl.varavel.com/docs/language/index.md)
  - [Start Here](https://vdl.varavel.com/docs/language/start-here/index.md)
  - [Files and Comments](https://vdl.varavel.com/docs/language/files/index.md)
  - [Includes](https://vdl.varavel.com/docs/language/includes/index.md)
  - [Docstrings](https://vdl.varavel.com/docs/language/docstrings/index.md)
  - [Types](https://vdl.varavel.com/docs/language/types/index.md)
  - [Field Types](https://vdl.varavel.com/docs/language/field-types/index.md)
  - [Enums](https://vdl.varavel.com/docs/language/enums/index.md)
  - [Constants and Literals](https://vdl.varavel.com/docs/language/constants/index.md)
  - [Annotations](https://vdl.varavel.com/docs/language/annotations/index.md)
  - [Spreads and References](https://vdl.varavel.com/docs/language/spreads-references/index.md)
  - [Naming and Validation](https://vdl.varavel.com/docs/language/naming-validation/index.md)
- [VDL Plugin Protocols](https://vdl.varavel.com/docs/protocols/index.md)
  - [Introduction](https://vdl.varavel.com/docs/protocols/introduction/index.md)
  - [VPP-0: Core](https://vdl.varavel.com/docs/protocols/core/index.md)
  - [VPP-1: Deprecations](https://vdl.varavel.com/docs/protocols/deprecations/index.md)
  - [VPP-2: HTTP-RPC](https://vdl.varavel.com/docs/protocols/http-rpc/index.md)
  - [VPP-3: Policy](https://vdl.varavel.com/docs/protocols/policy/index.md)
  - [VPP-4: Events](https://vdl.varavel.com/docs/protocols/events/index.md)
- [Reference](https://vdl.varavel.com/docs/reference/index.md)
  - [Language Specification](https://vdl.varavel.com/docs/reference/spec/index.md)
  - [Formatting Guide](https://vdl.varavel.com/docs/reference/formatting-guide/index.md)


## Documentation content

The documentation for the current page follows, reproduced verbatim.


## What Types Are

`type` declarations define reusable data shapes.

The most common form is an object type:

```vdl
type User {
  id string
  email string
}
```

But a type can also be an alias for another type expression:

```vdl
type UserId string
type Tags string[]
type Metadata map[string]
```

## Object Types

Object types use braces and contain fields.

```vdl
type Product {
  id string
  name string
  price float
  active bool
}
```

Each field is written as:

```text
fieldName TypeName
```

There are no colons and no commas.

## Optional Fields

Add `?` after the field name to make a field optional.

```vdl
type UserProfile {
  userId string
  displayName? string
  avatarUrl? string
}
```

Optional means the field may be absent in generated representations, depending on the target plugin.

## Type Aliases

A type can name any valid field type.

```vdl
type UserId string
type UserIds string[]
type UserMetadata map[string]
```

Aliases are useful when you want semantic names without repeating raw primitives everywhere.

```vdl
type EmailAddress string

type User {
  id string
  email EmailAddress
}
```

## Object Types Can Reference Other Types

```vdl
type Address {
  line1 string
  line2? string
  city string
  country string
}

type Customer {
  id string
  billingAddress Address
  shippingAddress? Address
}
```

References must point to declared types or enums.

## Inline Objects

Use an inline object when a nested shape is only useful in one place.

```vdl
type CheckoutSession {
  id string
  payment {
    provider string
    amountCents int
    currency string
  }
}
```

Inline objects can contain fields, nested inline objects, and spreads.

## Empty Objects

An object type can be empty, but it is rarely useful.

```vdl
type EmptyObject {
}
```

Prefer adding fields when the contract has meaningful data.

## Field Names Must Be Unique

Within an object or inline object, each field name must be unique.

Good:

```vdl
type Product {
  id string
  sku string
}
```

Invalid:

```vdl
type Product {
  id string
  id int
}
```

## Naming

Type names should use `PascalCase`:

```vdl
type UserProfile {
  displayName string
}
```

Field names should use `camelCase`:

```vdl
type UserProfile {
  displayName string
  createdAt datetime
}
```

The analyzer reports diagnostics when names do not follow these conventions.
