Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate SDK from OpenApi #5046

Open
thomasp98296 opened this issue Dec 9, 2024 · 2 comments
Open

Unable to generate SDK from OpenApi #5046

thomasp98296 opened this issue Dec 9, 2024 · 2 comments
Assignees
Labels
needs-author-feedback Workflow: More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@thomasp98296
Copy link

Before asking the question:

  • [YES] have you checked the faq, the documentation in the docs folder and couldn't find the information there
  • [YES] have you checked existing issues for a similar question?

I have a Swagger with a new version (2024-10-01-preview). I am following this https://eng.ms/docs/products/azure-developer-experience/develop/sdk-generate-mgmt-dotnet#generate-sdks-from-api-specs to generate the SDK. The instruction is simple - simply update the require and the tag in the autorest.md. When I run "dotnet build /t:GenerateCode" command, it looks like it is trying to generate the sdk for my version (2024-10-01-preview), however it exited due to the error below. I looked around but not sure how to resolve this. Can someone give me some help here? Is it related to the tool?

c:\REPOS\azure-sdk-for-net\sdk\monitor\Azure.ResourceManager.Monitor>dotnet build /t:GenerateCode
Determining projects to restore...
All projects are up-to-date for restore.
AutoRest code generation utility [cli version: 3.7.1; node: v20.9.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
AutoRest code generation utility [cli version: 3.7.1; node: v20.9.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info | AutoRest core version selected from configuration: 3.9.7.
info | AutoRest core version selected from configuration: 3.9.7.
info | Loading AutoRest core 'C:\Users\thompham.autorest@[email protected]\nodemodules@autorest\core\dist' (3.9.7)
info | Loading AutoRest core 'C:\Users\thompham.autorest@[email protected]\nodemodules@autorest\core\dist' (3.9.7)
warning | DeprecatedConfig | Using directive.0.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.0.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.1.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.2.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.3.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.4.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.5.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.6.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.7.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.8.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.9.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.10.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.11.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.12.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.13.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.14.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.15.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.16.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.17.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.18.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.19.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.20.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.21.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.22.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.23.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.24.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.25.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.26.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.27.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.28.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.29.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.30.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.31.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.32.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.33.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.34.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.35.suppress which is deprecated and will be removed in the future.
warning | DeprecatedConfig | Using directive.36.suppress which is deprecated and will be removed in the future.
info | Loading local AutoRest extension '@autorest/csharp' (C:/Users/thompham/.nuget/packages/microsoft.azure.autorest.csharp/3.0.0-beta.
20231107.1/buildMultiTargeting/../tools/net6.0/any/)
info | Loading AutoRest extension '@autorest/modelerfour' (4.26.0->4.26.0)
info | Loading local AutoRest extension '@autorest/csharp' (C:/Users/thompham/.nuget/packages/microsoft.azure.autorest.csharp/3.0.0-beta.
20241025.1/buildMultiTargeting/../tools/net8.0/any/)
info | Loading AutoRest extension '@autorest/modelerfour' (4.26.0->4.26.0)
info | Loading AutoRest extension '@autorest/testmodeler' (2.6.1->2.6.1)
warning | PreCheck/SchemaMissingType | The schema 'SanitizersToRemove' with an undefined type and declared properties is a bit ambiguous. This
has been auto-corrected to 'type:object'
- file:///c:/REPOS/azure-sdk-for-net/sdk/core/Azure.Core.TestFramework/src/testproxy.json:859:5
warning | PreCheck/CheckDuplicateSchemas | Checking for duplicate schemas, this could take a (long) while. Run with --verbose for more detail.
warning | OutdatedExtension | Semantic violation: Extension 'x-ms-code-generation-settings' is not supported in Autorest V3. It will just be ig
nored. (info > x-ms-code-generation-settings)
- https://github.com/Azure/azure-rest-api-specs/blob/b49c302778c85cf6ff59b183b2f0f076a87ae58b/specification/monitor/resource-manager/Micros
oft.Insights/preview/2024-10-01-preview/actionGroups_API.json:5:5
warning | IgnoredPropertyNextToRef | Semantic violation: Sibling values alongside $ref will be ignored. See https://github.com/Azure/autorest/b
lob/main/docs/openapi/howto/$ref-siblings.md for allowed values (components > schemas > TestNotificationDetailsResponse > properties > context)
keys: [ �[32m'type'�[39m ]
- https://github.com/Azure/azure-rest-api-specs/blob/b49c302778c85cf6ff59b183b2f0f076a87ae58b/specification/monitor/resource-manager/Micros
oft.Insights/preview/2024-10-01-preview/actionGroups_API.json:489:9
warning | IgnoredPropertyNextToRef | Semantic violation: Sibling values alongside $ref will be ignored. See https://github.com/Azure/autorest/b
lob/main/docs/openapi/howto/$ref-siblings.md for allowed values (components > schemas > IncidentReceiver > properties > connection)
keys: [ �[32m'type'�[39m ]
- https://github.com/Azure/azure-rest-api-specs/blob/b49c302778c85cf6ff59b183b2f0f076a87ae58b/specification/monitor/resource-manager/Micros
oft.Insights/preview/2024-10-01-preview/actionGroups_API.json:1004:9
warning | IgnoredPropertyNextToRef | Semantic violation: Sibling values alongside $ref will be ignored. See https://github.com/Azure/autorest/b
lob/main/docs/openapi/howto/$ref-siblings.md for allowed values (components > schemas > ScheduledQueryRuleProperties > properties > actions)
keys: [ �[32m'type'�[39m ]
- https://github.com/Azure/azure-rest-api-specs/blob/b49c302778c85cf6ff59b183b2f0f076a87ae58b/specification/monitor/resource-manager/Micros
oft.Insights/preview/2024-01-01-preview/scheduledQueryRule_API.json:435:9
warning | IgnoredPropertyNextToRef | Semantic violation: Sibling values alongside $ref will be ignored. See https://github.com/Azure/autorest/b
lob/main/docs/openapi/howto/$ref-siblings.md for allowed values (components > schemas > ScheduledQueryRuleProperties > properties > resolveConf
iguration)
keys: [ �[32m'type'�[39m ]
- https://github.com/Azure/azure-rest-api-specs/blob/b49c302778c85cf6ff59b183b2f0f076a87ae58b/specification/monitor/resource-manager/Micros
oft.Insights/preview/2024-01-01-preview/scheduledQueryRule_API.json:457:9
warning | IgnoredPropertyNextToRef | Semantic violation: Sibling values alongside $ref will be ignored. See https://github.com/Azure/autorest/b
lob/main/docs/openapi/howto/$ref-siblings.md for allowed values (components > schemas > ScheduledQueryRuleResource > properties > properties)
keys: [ �[32m'required'�[39m ]
- https://github.com/Azure/azure-rest-api-specs/blob/b49c302778c85cf6ff59b183b2f0f076a87ae58b/specification/monitor/resource-manager/Micros
oft.Insights/preview/2024-01-01-preview/scheduledQueryRule_API.json:534:9
warning | IgnoredPropertyNextToRef | Semantic violation: Sibling values alongside $ref will be ignored. See https://github.com/Azure/autorest/b
lob/main/docs/openapi/howto/$ref-siblings.md for allowed values (components > schemas > Resource > properties > systemData)
keys: [ �[32m'type'�[39m ]
warning | PreCheck/CheckDuplicateSchemas | Checking for duplicate schemas, this could take a (long) while. Run with --verbose for more detail.
error | PreCheck/DuplicateSchema | Duplicate Schema named 'ErrorResponse' (10 differences):
- properties.code.$ref: "#/components/schemas/schemas:121" => "#/components/schemas/schemas:441"
- properties.code.description: "Error code" => "The error code."
- properties.code.readOnly: => true
- properties.message.$ref: "#/components/schemas/schemas:122" => "#/components/schemas/schemas:442"
- properties.message.description: "Error message indicating why the operation failed." => "The error message."
- properties.message.readOnly: => true
- properties.target: => {"$ref":"#/components/schemas/schemas:443","description":"The error target.","readOnly":true}
- properties.details: => {"x-ms-identifiers":["message","target"],"$ref":"#/components/schemas/schemas:444","description":"The error d
etails.","readOnly":true}
- properties.additionalInfo: => {"x-ms-identifiers":[],"$ref":"#/components/schemas/schemas:445","description":"The error additional i
nfo.","readOnly":true}
- title: => "Error Response"; This error can be temporarily avoided by using the 'modelerfour.lenient-model-deduplication' setting.
NOTE: This setting will be removed in a future version of @autorest/modelerfour; schemas should be updated to fix this issue sooner than that.
EXEC : fatal | error : 1 errors occured -- cannot continue. [c:\REPOS\azure-sdk-for-net\sdk\monitor\Azure.ResourceManager.Monitor\src\Azure.Res
ourceManager.Monitor.csproj]
fatal | Process() cancelled due to failure
EXEC : error | error : Plugin prechecker reported failure. [c:\REPOS\azure-sdk-for-net\sdk\monitor\Azure.ResourceManager.Monitor\src\Azure.Reso
urceManager.Monitor.csproj]
error | Autorest completed with an error. If you think the error message is unclear, or is a bug, please declare an issues at https://github.
com/Azure/autorest/issues with the error message you are seeing.
C:\Users\thompham.nuget\packages\microsoft.azure.autorest.csharp\3.0.0-beta.20241025.1\buildMultiTargeting\Microsoft.Azure.AutoRest.CSharp.targe
ts(58,5): error MSB3073: The command "npx autorest@ --max-memory-size=8192 --skip-csproj --skip-upgrade-check --version=3.9.7 c:\REPOS\azure-sdk-
for-net\sdk\monitor\Azure.ResourceManager.Monitor\src/autorest.md --use=C:\Users\thompham.nuget\packages\microsoft.azure.autorest.csharp\3.0.0-
beta.20241025.1\buildMultiTargeting../tools/net8.0/any/ --clear-output-folder=true --shared-source-folders="c:\REPOS\azure-sdk-for-net\eng/../s
dk/core/Azure.Core/src/Shared/;C:\Users\thompham.nuget\packages\microsoft.azure.autorest.csharp\3.0.0-beta.20241025.1\buildMultiTargeting../con
tent/Generator.Shared/" --output-folder=c:\REPOS\azure-sdk-for-net\sdk\monitor\Azure.ResourceManager.Monitor\src/Generated --namespace=Azure.Reso
urceManager.Monitor" exited with code 1. [c:\REPOS\azure-sdk-for-net\sdk\monitor\Azure.ResourceManager.Monitor\src\Azure.ResourceManager.Monitor.
csproj]
info | Autorest completed in 4.94s. 33 files generated.

Build FAILED.

EXEC : fatal | error : 1 errors occured -- cannot continue. [c:\REPOS\azure-sdk-for-net\sdk\monitor\Azure.ResourceManager.Monitor\src\Azure.Res
ourceManager.Monitor.csproj]
EXEC : error | error : Plugin prechecker reported failure. [c:\REPOS\azure-sdk-for-net\sdk\monitor\Azure.ResourceManager.Monitor\src\Azure.Reso
urceManager.Monitor.csproj]
C:\Users\thompham.nuget\packages\microsoft.azure.autorest.csharp\3.0.0-beta.20241025.1\buildMultiTargeting\Microsoft.Azure.AutoRest.CSharp.targe
ts(58,5): error MSB3073: The command "npx autorest@ --max-memory-size=8192 --skip-csproj --skip-upgrade-check --version=3.9.7 c:\REPOS\azure-sdk-
for-net\sdk\monitor\Azure.ResourceManager.Monitor\src/autorest.md --use=C:\Users\thompham.nuget\packages\microsoft.azure.autorest.csharp\3.0.0-
beta.20241025.1\buildMultiTargeting../tools/net8.0/any/ --clear-output-folder=true --shared-source-folders="c:\REPOS\azure-sdk-for-net\eng/../s
dk/core/Azure.Core/src/Shared/;C:\Users\thompham.nuget\packages\microsoft.azure.autorest.csharp\3.0.0-beta.20241025.1\buildMultiTargeting../con
tent/Generator.Shared/" --output-folder=c:\REPOS\azure-sdk-for-net\sdk\monitor\Azure.ResourceManager.Monitor\src/Generated --namespace=Azure.Reso
urceManager.Monitor" exited with code 1. [c:\REPOS\azure-sdk-for-net\sdk\monitor\Azure.ResourceManager.Monitor\src\Azure.ResourceManager.Monitor.
csproj]
0 Warning(s)
3 Error(s)

Time Elapsed 00:00:08.12

@thomasp98296 thomasp98296 added the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Dec 9, 2024
@ArthurMa1978
Copy link
Member

Thank you for your feedback @thomasp98296 , @archerzz please help to look into this question.

@archerzz
Copy link
Member

@thomasp98296 There are duplicated model definitions in your current spec:

error | PreCheck/DuplicateSchema | Duplicate Schema named 'ErrorResponse' (10 differences)

You have 2 ErrorResponse:

One way to avoid this error, as previously done in your SDK customization, is renaming one of them. See those renaming of ErrorResponse: https://github.com/Azure/azure-sdk-for-net/blob/b5479302dbfdd595160fca202bd3f1afbf378c48/sdk/monitor/Azure.ResourceManager.Monitor/src/autorest.md?plain=1#L403-L411

@archerzz archerzz added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-author-feedback Workflow: More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

3 participants