You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, after upgrading to TypeSpec/Compiler 0.67.1, I found that it no longer works.
I noticed two major issues
It will report issues as below.
Diagnostics were reported during compilation:
../C:/Users/xidi/source/autorest.powershell/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/main.tsp:21:1 - error @azure-tools/typespec-azure-resource-manager/single-arm-provider: Only one @armProviderNamespace can be declared in a typespec spec at once.
> 21 | @armProviderNamespace
| ^^^^^^^^^^^^^^^^^^^^^
../C:/Users/xidi/source/autorest.powershell/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/resources/WebhookResource.tsp:29:7 - error @azure-tools/typespec-azure-resource-manager/arm-resource-missing-arm-namespace: The @armProviderNamespace decorator must be used to define the ARM namespace of the service. This is best applied to the file-level namespace.
> 29 | model WebhookResource extends Azure.ResourceManager.Foundations.ProxyResource {
| ^^^^^^^^^^^^^^^
../C:/Users/xidi/source/autorest.powershell/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/resources/SnapshotResource.tsp:23:7 - error @azure-tools/typespec-azure-resource-manager/arm-resource-missing-arm-namespace: The @armProviderNamespace decorator must be used to define the ARM namespace of the service. This is best applied to the file-level namespace.
> 23 | model SnapshotResource extends Azure.ResourceManager.Foundations.ProxyResource {
| ^^^^^^^^^^^^^^^^
../C:/Users/xidi/source/autorest.powershell/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/resources/ScopingConfigurationResource.tsp:31:7 - error @azure-tools/typespec-azure-resource-manager/arm-resource-missing-arm-namespace: The @armProviderNamespace decorator must be used to define the ARM namespace of the service. This is best applied to the file-level namespace.
> 31 | model ScopingConfigurationResource
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../C:/Users/xidi/source/autorest.powershell/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/resources/EvidenceResource.tsp:25:7 - error @azure-tools/typespec-azure-resource-manager/arm-resource-missing-arm-namespace: The @armProviderNamespace decorator must be used to define the ARM namespace of the service. This is best applied to the file-level namespace.
> 25 | model EvidenceResource extends Azure.ResourceManager.Foundations.ProxyResource {
| ^^^^^^^^^^^^^^^^
../C:/Users/xidi/source/autorest.powershell/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/resources/ReportResource.tsp:25:7 - error @azure-tools/typespec-azure-resource-manager/arm-resource-missing-arm-namespace: The @armProviderNamespace decorator must be used to define the ARM namespace of the service. This is best applied to the file-level namespace.
> 25 | model ReportResource extends Azure.ResourceManager.Foundations.ProxyResource {
| ^^^^^^^^^^^^^^
../C:/Users/xidi/source/autorest.powershell/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/resources/ReportResource.tsp:25:7 - error @azure-tools/typespec-azure-resource-manager/arm-resource-missing: No @armResource registration found for type ReportResource
> 25 | model ReportResource extends Azure.ResourceManager.Foundations.ProxyResource {
| ^^^^^^^^^^^^^^
../C:/Users/xidi/source/autorest.powershell/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/resources/WebhookResource.tsp:29:7 - error @azure-tools/typespec-azure-resource-manager/parent-type: Parent type ReportResource of WebhookResource is not registered as an ARM resource type.
> 29 | model WebhookResource extends Azure.ResourceManager.Foundations.ProxyResource {
| ^^^^^^^^^^^^^^^
../C:/Users/xidi/source/autorest.powershell/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/resources/ReportResource.tsp:25:7 - error @azure-tools/typespec-azure-resource-manager/arm-resource-missing: No @armResource registration found for type ReportResource
> 25 | model ReportResource extends Azure.ResourceManager.Foundations.ProxyResource {
| ^^^^^^^^^^^^^^
../C:/Users/xidi/source/autorest.powershell/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/resources/WebhookResource.tsp:29:7 - error @azure-tools/typespec-azure-resource-manager/parent-type: Parent type ReportResource of WebhookResource is not registered as an ARM resource type.
> 29 | model WebhookResource extends Azure.ResourceManager.Foundations.ProxyResource {
| ^^^^^^^^^^^^^^^
../C:/Users/xidi/source/autorest.powershell/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/resources/ReportResource.tsp:25:7 - error @azure-tools/typespec-azure-resource-manager/arm-resource-missing: No @armResource registration found for type ReportResource
> 25 | model ReportResource extends Azure.ResourceManager.Foundations.ProxyResource {
| ^^^^^^^^^^^^^^
../C:/Users/xidi/source/autorest.powershell/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/resources/SnapshotResource.tsp:23:7 - error @azure-tools/typespec-azure-resource-manager/parent-type: Parent type ReportResource of SnapshotResource is not registered as an ARM resource type.
> 23 | model SnapshotResource extends Azure.ResourceManager.Foundations.ProxyResource {
| ^^^^^^^^^^^^^^^^
../C:/Users/xidi/source/autorest.powershell/tests-upgrade/tests-emitter/AppComplianceAutomation.Management/resources/ReportResource.tsp:25:7 - error @azure-tools/typespec-azure-resource-manager/arm-resource-missing: No @armResource registration found for type ReportResource
> 25 | model ReportResource extends Azure.ResourceManager.Foundations.ProxyResource {
| ^^^^^^^^^^^^^^
...
The API listServices will return two duplicated services.
Some investigation
The root cause of the issue appears to be the presence of two copies of TypeSpec/Compiler: one in my emitter project and another in my test project.
How to workaround the issue
I can work around the issue by packaging my emitter locally and then installing the emitter package. However, this process is very inconvenient for testing and debugging my emitter.
Go to the root folder and execute rush update and rush rebuild
Go to tests-upgrade/tests-emitter, edit package.json, remove "@azure-tools/typespec-powershell": "file:../../common/temp/artifacts/packages/azure-tools-typespec-powershell-0.0.1.tgz", and run npm install
Go to tests-upgrade/tests-emitter/AppComplianceAutomation.Management and run tsp compile ./ --emit c:\Users\<username>\source\autorest.powershell\packages\typespec-powershell or node --inspect-brk 'C:\Users\<username>\source\autorest.powershell\packages\typespec-powershell\node_modules\@typespec\compiler\cmd\tsp.js' compile ./ --emit C:\Users\<username>\source\autorest.powershell\packages\typespec-powershell to debug the code
You will see the issues I mention above
Following the same steps with TSP before version 0.67.1, everything worked fine. You can check out the main branch (which still uses version 0.64.0) of the repo mentioned above to give it a try.
How to workaround
Add "@azure-tools/typespec-powershell": "file:../../common/temp/artifacts/packages/azure-tools-typespec-powershell-0.0.1.tgz", back to the package.json file I mentioned above
Ok so the problem is that Relam is treated as a singleton class and keeps track of types added to it but if you load multiple instance of it(like in this example) it will have multiple singleton and not behave as expected.
Describe the bug
I used to be able to use a local build emitter to generate code for testing or debugging purposes.
However, after upgrading to TypeSpec/Compiler 0.67.1, I found that it no longer works.
I noticed two major issues
Some investigation
The root cause of the issue appears to be the presence of two copies of TypeSpec/Compiler: one in my emitter project and another in my test project.
How to workaround the issue
I can work around the issue by packaging my emitter locally and then installing the emitter package. However, this process is very inconvenient for testing and debugging my emitter.
Reproduction
rush update
andrush rebuild
"@azure-tools/typespec-powershell": "file:../../common/temp/artifacts/packages/azure-tools-typespec-powershell-0.0.1.tgz",
and runnpm install
npm install -g @typespec/compiler@latest
tsp compile ./ --emit c:\Users\<username>\source\autorest.powershell\packages\typespec-powershell
ornode --inspect-brk 'C:\Users\<username>\source\autorest.powershell\packages\typespec-powershell\node_modules\@typespec\compiler\cmd\tsp.js' compile ./ --emit C:\Users\<username>\source\autorest.powershell\packages\typespec-powershell
to debug the codeFollowing the same steps with TSP before version 0.67.1, everything worked fine. You can check out the main branch (which still uses version 0.64.0) of the repo mentioned above to give it a try.
How to workaround
"@azure-tools/typespec-powershell": "file:../../common/temp/artifacts/packages/azure-tools-typespec-powershell-0.0.1.tgz",
back to the package.json file I mentioned aboverush publish --publish --pack --include-all --tag latest
npm install
tsp compile ./ --emit @azure-tools/typespec-powershell
Checklist
The text was updated successfully, but these errors were encountered: