microsoft / microsoft/typespec
[Bug]: Protobuf emitter does not recognise array defined by `is Array<T>`
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
### Describe the bug
When using the ProtoBuf emitter, arrays are only recognised as such when they are defined inline on the model property. If you reference a model which has `is Array`, it is not recognised.
An empty `message` is printed for the "array model", and `repeated` is missing on the reference to that model. But I beleive it should be extracting the item type anyway and using that.
The problem seems to be around the `isArray` checks in the emitter and also the extraction of the item type. I hacked these locally and got it working, but currently they do not consider this case.
### Reproduction
[Playground Link](https://typespec.io/playground?c=aW1wb3J0ICJAdHlwZXNwZWMvcHJvdG9idWYiOwoKdXNpbmcgVHlwZVNwZWMuUMcbOwoKQHBhY2thZ2UoewogIG5hbWU6ICJleGFtcGxlIiwKfSkKxBRzcGFjZSBFxhc7CgoKbW9kZWwgQXJyYXlJdGVtIMQ9QGZpZWxkKDEpIGlkPzogaW50MzIKfc0sx0IgaXPGEDzJQj47yClSb290xVAvLyBPdXRwdXQgb25seS7XYjsKxitSZXF1aXJlZMsoMikgYct2Ou0AhDsKfQ%3D%3D&e=%40typespec%2Fprotobuf&options=%7B%7D)
### 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.