> This page is for API Definitions.

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For task-scoped instructions for coding agents working in a Fern project, see https://buildwithfern.com/learn/home/fern-instructions.md.

# Schema names

> Override auto-generated names for inline schemas using the `x-fern-type-name` extension

OpenAPI allows you to define inlined schemas that do not have names.

**`Inline type in openapi.yml`**

```yaml title="Inline type in openapi.yml" {11}
components:
  schemas:
    Movie:
      type: object
      properties:
        name:
          type: string
        cast:
          type: array
          items:
            type: object
            properties:
              firstName:
                type: string
              lastName:
                type: string
              age:
                type: integer
```

Fern automatically generates names for all the inlined schemas. For example, in this example,
Fern would generate the name `CastItem` for the inlined array item schema.

**`Auto-generated name`**

```typescript title="Auto-generated name" {6}
export interface Movie {
  name?: string;
  cast?: CastItem[];
}

export interface CastItem {
  firstName?: string;
  lastName?: string;
  age?: integer;
}
```

If you want to override the generated name, you can use the extension `x-fern-type-name`.

**`openapi.yml`**

```yaml title="openapi.yml" {12}
components:
  schemas:
    Movie:
      type: object
      properties:
        name:
          type: string
        cast:
          type: array
          items:
            type: object
            x-fern-type-name: Person
            properties:
              firstName:
                type: string
              lastName:
                type: string
              age:
                type: integer
```

This would replace `CastItem` with `Person` and the generated code would read more idiomatically:

**`Overridden name`**

```typescript title="Overridden name" {6}
export interface Movie {
  name?: string;
  cast?: Person[];
}

export interface Person {
  firstName?: string;
  lastName?: string;
  age?: integer;
}
```