Skip to content

Add inline named models support#9694

Draft
johanste wants to merge 11 commits intomicrosoft:mainfrom
johanste:copilot/add-inline-named-models-support
Draft

Add inline named models support#9694
johanste wants to merge 11 commits intomicrosoft:mainfrom
johanste:copilot/add-inline-named-models-support

Conversation

@johanste
Copy link
Contributor

Asked copilot to enable support for inline model names:

model Outer {
   inner: model Inner {
      size: int32;
   }
}

is equivalent to:

model Outer {
   inner: Inner;
}

model Inner {
  size: int32;
}

@bterlson , @witemple-msft , I'm very curious to see what ya think...

Copilot AI and others added 11 commits February 10, 2026 02:21
Add optional `id` field to `ModelExpressionNode` to support inline
named models in property type positions. Example:

```typespec
model Parent {
    child: model Child {
        age: int32;
    }
}
```

Co-authored-by: johanste <15110018+johanste@users.noreply.github.com>
Co-authored-by: johanste <15110018+johanste@users.noreply.github.com>
Co-authored-by: johanste <15110018+johanste@users.noreply.github.com>
…rator and nesting support with tests

Co-authored-by: johanste <15110018+johanste@users.noreply.github.com>
…st, response, and template parameter

Co-authored-by: johanste <15110018+johanste@users.noreply.github.com>
Co-authored-by: johanste <15110018+johanste@users.noreply.github.com>
Co-authored-by: johanste <15110018+johanste@users.noreply.github.com>
Co-authored-by: johanste <15110018+johanste@users.noreply.github.com>
Co-authored-by: johanste <15110018+johanste@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added the compiler:core Issues for @typespec/compiler label Feb 11, 2026
@github-actions
Copy link
Contributor

All changed packages have been documented.

  • @typespec/compiler
Show changes

@typespec/compiler - feature ✏️

Add support for inline named model expressions in property type positions

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 11, 2026

Open in StackBlitz

npm i https://pkg.pr.new/microsoft/typespec/@typespec/compiler@9694
npm i https://pkg.pr.new/microsoft/typespec/@typespec/playground@9694

commit: 4df0e57

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:core Issues for @typespec/compiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants