microsoft / microsoft/typespec
[Bug]: tsp-openapi3: nested descriptions not imported
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
### Describe the bug
Nested fields in a model are not imported from OpenAPI, even though they are _exported_ to OpenAPI.
_detected as part of the "TypeSpec for Sefaria" hack._
### Reproduction
Easiest way to see is to round-trip this model:
```
model Error {
/** Foo */
foo: {
/** Bar */
bar: string
}
}
```
TSP -> OpenAPI: [Playground](https://typespec.io/playground?c=bW9kZWwgRXJyb3IgewogIC8qKiBGb28gKi8KICBmb286xRbGGEJhcsYYICBiYXI6IHN0cmluZwogIH0KfQ%3D%3D&e=%40typespec%2Fopenapi3&options=%7B%7D)
Result from importing the OpenAPI output: [Playground](https://typespec.io/playground?c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7CtIZb3BlbmFwadwcMyI7Cgp1c2luZyBIdHRwO8cMT3BlbkFQSTsKCkBzZXJ2aWNlKHsKICB0aXRsZTogIijFCSkiLAp9KQpAaW5mb8UfdmVyc2lvbjogIjAuMC4wxh9uYW1lc3BhY2XGPjsKCm1vZGVsIEVycm9yIMQ3LyoqCiAgICogRm9vxQkvCiAgZm9vOsUeICBiYXI6IHN0cmluZzsKICB9Owp9Cg%3D%3D&e=%40typespec%2Fopenapi3&options=%7B%7D)
```
model Error {
/**
* Foo
*/
foo: {
bar: string;
};
}
```
### Checklist
- [X] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md)
- [X] Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
Contributor guide
Assessment
This issue has not been assessed yet.