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

[BUG] [JS SDK] generateMetadata cannot be set to false under @azure-tools/typespec-ts #31610

Open
maorleger opened this issue Nov 19, 2024 · 2 comments
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved.

Comments

@maorleger
Copy link
Member

API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/2822c0909ef7e9aa52c2921e5f0fdb0027ee3f82/specification/keyvault/Security.KeyVault.Administration/tspconfig.yaml

API Spec version

N/A

Describe the bug

When generateMetadata is false, JS SDK CI validation will fail due to automation deleting all files when generating JS SDK (including package.json)

Example typespec-ts configuration:

  "@azure-tools/typespec-ts":
    package-dir: "keyvault-admin"
    generateMetadata: false
    generateTest: false
    experimentalExtensibleEnums: true
    isModularLibrary: true
    packageDetails:
      name: "@azure/keyvault-admin"
      description: "Azure Key Vault Administration"
    flavor: azure

Expected behavior

JS SDK code generation should not be a destructive operation for files it does not regenerate

Actual behavior

Adding the above typespec-ts entry to the yaml causes CI to start failing with (what I think is): [automation_generate.sh] [ERROR]: Failed to generate package due to Error: Could not read package.json: Error: ENOENT: no such file or directory, open '/mnt/vss/_work/1/s/azure-sdk-for-js/sdk/keyvault/keyvault-admin/package.json'

Reproduction Steps

(this tspconfig.yaml has not been merged yet, depending on whether its merged the steps may change)

  1. checkout commit sha 2822c0909ef7e9aa52c2921e5f0fdb0027ee3f82
  2. Create a pull request

Environment

No response

@maorleger maorleger added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Nov 19, 2024
@maorleger maorleger changed the title [BUG] [JS SDK] [BUG] [JS SDK] generateMetadata cannot be set to false under @azure-tools/typespec-ts Nov 19, 2024
@maorleger
Copy link
Member Author

A bit more infor:

this commit in this PR 2822c09 adds typespec-ts input for keyvault-admin
generateMetadata is false as expected for packages that are pre-existing and being converted (we do not need to generate package.json files and such)
keyvault-admin is a brownfield service that is migrating from swagger to typespec azure-sdk-for-js/sdk/keyvault/keyvault-admin at main · Azure/azure-sdk-for-js
Adding the above typespec-ts entry to the yaml causes CI to start failing with (what I think is): [automation_generate.sh] [ERROR]: Failed to generate package due to Error: Could not read package.json: Error: ENOENT: no such file or directory, open '/mnt/vss/_work/1/s/azure-sdk-for-js/sdk/keyvault/keyvault-admin/package.json'
https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4325911&view=logs&j=47092895-c7c8-567a-c7a6-8c88f3ec178e&t=d293a8e8-c6af-5091-cdf7-4c66482dd6f2&l=347

The generated JS PR shows that all the metadata files are deleted: [AutoPR default] [Key Vault] TypeSpec for Administration library by azure-sdk · Pull Request #12803 · azure-sdk/azure-sdk-for-js

@v-jiaodi
Copy link
Member

@mccoyp Please help take a look, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved.
Projects
None yet
Development

No branches or pull requests

3 participants