microsoft / microsoft/typespec
Spreading record on derived models doesn't validate compatibility with parent model
Open
bug
compiler:core
triaged:core
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
Considering we have spread overriding in model inheritance, I'd like to confirm how to interpret the additional property information for model `B` here:
- A: Does that mean union of `string | int32` ? Model B could accept both additional properties.
- B: Does that mean `int32` to override `string`? Model B could only accept int32 properties.
[playground](https://cadlplayground.z22.web.core.windows.net/?c=bW9kZWwgQSB7DQogIC4uLlJlY29yZDxzdHJpbmc%2BOw0KfQ0KDQrGJkIgZXh0ZW5kc9IwaW50MzLHLw%3D%3D&e=%40typespec%2Fopenapi3&options=%7B%7D)
```ts
model A {
...Record;
}
model B extends A {
...Record;
}
```
Contributor guide
Assessment
This issue has not been assessed yet.