azure-tools/typespec-autorest crashes when trying to build out a commit from the azure-rest-api-specs repo for OpenAI.
Stack trace (I used instead of my local path, but it's otherwise unchanged):
Emitter "@azure-tools/typespec-autorest" crashed! This is a bug.
Please file an issue at https://github.com/Azure/typespec-azure/issues
TypeError: Cannot read properties of undefined (reading 'stateMap')
at getScopedDecoratorData (<root>/sdk/ai/azopenai/testdata/node_modules/@azure-tools/typespec-client-generator-core/dist/src/decorators.js:13:36)
at shouldFlattenProperty (<root>/sdk/ai/azopenai/testdata/node_modules/@azure-tools/typespec-client-generator-core/dist/src/decorators.js:732:12)
at applyIntrinsicDecorators (<root>/sdk/ai/azopenai/testdata/node_modules/@azure-tools/typespec-autorest/dist/src/openapi.js:1515:13)
at getOpenAPI2Parameter (<root>/sdk/ai/azopenai/testdata/node_modules/@azure-tools/typespec-autorest/dist/src/openapi.js:879:27)
at resolveHost (<root>/sdk/ai/azopenai/testdata/node_modules/@azure-tools/typespec-autorest/dist/src/openapi.js:166:27)
at getOpenAPIForService (<root>/sdk/ai/azopenai/testdata/node_modules/@azure-tools/typespec-autorest/dist/src/openapi.js:45:12)
at getAllServicesAtAllVersions (<root>/sdk/ai/azopenai/testdata/node_modules/@azure-tools/typespec-autorest/dist/src/emit.js:101:38)
at emitAllServiceAtAllVersions (<root>/sdk/ai/azopenai/testdata/node_modules/@azure-tools/typespec-autorest/dist/src/emit.js:113:28)
at Object.$onEmit [as emitFunction] (<root>/sdk/ai/azopenai/testdata/node_modules/@azure-tools/typespec-autorest/dist/src/emit.js:16:11)
at runEmitter (<root>/sdk/ai/azopenai/testdata/node_modules/@typespec/compiler/dist/src/core/program.js:452:27)
Describe the bug
azure-tools/typespec-autorest crashes when trying to build out a commit from the azure-rest-api-specs repo for OpenAI.
Stack trace (I used instead of my local path, but it's otherwise unchanged):
Package.json dependencies:
Reproduction
I uploaded a standalone version of this project here: https://github.com/richardpark-msft/openai-gen-bug
I apologize that it's not small, but it does demonstrate the problem readily. I added a 'repro' command script, so you can just do:
And you'll get the error.
Checklist