microsoft / microsoft/typespec
Cannot use rest resource with merge patch
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
```tsp
import "@typespec/http";
import "@typespec/rest";
using Http;
@Rest.resource("/foos")
model Foo {
@key
@visibility(Lifecycle.Read)
id: string;
one: "two";
}
op doStuff(@body foo: Http.MergePatchCreateOrUpdate): void;
```
```
error
@typespec/rest/resource-missing-key
Type 'FooMergePatchCreateOrUpdate' is used as a resource and therefore must have a key. Use @key to designate a property as the key.
14:1
```
[Playground Link](https://typespec.io/playground/?c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7CtIZcmVzdCI7Cgp1c2luZyBIdHRwOwoKQFJlc3QucmVzb3VyY2UoIi9mb29zIikKbW9kZWwgRm9vIHsKICBAa2V5xAd2aXNpYmlsaXR5KExpZmVjeWNsZS5SZWFkKQogIGlkOiBzdHJpbmc7CgogIG9uZTogInR3byI7Cn0KCm9wIGRvU3R1ZmYoQGJvZHkgZm9vOuUAhi5NZXJnZVBhdGNoQ3JlYXRlT3JVcGRhdGU8Rm9vPik6IHZvaWQ7Cgo%3D&e=%40typespec%2Fopenapi3&options=%7B%7D)
Contributor guide
Assessment
This issue has not been assessed yet.