microsoft / microsoft/typespec
openapi3 - model extends Array generates invalid schema
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
[Playground link](https://typespec.io/playground/?c=bW9kZWwgQSBleHRlbmRzIEFycmF5PGludDMyPiB7fQ0KDQrGI0IgadMe&e=%40typespec%2Fopenapi3&options=%7B%7D)
When a TypeSpec model extends an array, the generated Open API schema is invalid. The schema has `type: object`, while the `allOf` subschema has `type: array`. These contradict.
__Example TypeSpec:__
```tsp
model A extends Array {}
model B is Array {}
```
__Expected Open API Schemas:__
```yml
components:
schemas:
A:
type: array
items:
type: integer
format: int32
B:
type: array
items:
type: integer
format: int32
```
__Actual Open API Schemas:__
```yml
components:
schemas:
A:
type: object
allOf:
- type: array
items:
type: integer
format: int32
B:
type: array
items:
type: integer
format: int32
```
Contributor guide
Assessment
This issue has not been assessed yet.