Azure / autorest.typescript

Extension for AutoRest (https://github.com/Azure/autorest) that generates TypeScript code. The transpiled javascript code is isomorphic. It can be run in browser and in node.js environment.
MIT License
179 stars 75 forks source link

Sample generation issues from refreshing MPG samples #2909

Open kazrael2119 opened 1 week ago

kazrael2119 commented 1 week ago

spec pr: https://github.com/Azure/azure-rest-api-specs/pull/31543

1: can't publish samples as folder is dirty(this should be the publish issue not sample gen)

2: genereate unexpected client level parameter : subsriptionId if the client doesn't need it. https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4332275&view=logs&j=47092895-c7c8-567a-c7a6-8c88f3ec178e&t=d293a8e8-c6af-5091-cdf7-4c66482dd6f2&l=793

3: missing property in operation level: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4332275&view=logs&j=47092895-c7c8-567a-c7a6-8c88f3ec178e&t=d293a8e8-c6af-5091-cdf7-4c66482dd6f2&l=796 sample from automation pr: https://github.com/azure-sdk/azure-sdk-for-js/pull/12847/files#diff-f48a5c560070894caa90594d30e7f69278578d503b21ecd790efdfac65973134L27-R17

4: error message: Type 'string' is not assignable to type 'Uint8Array' tsp file: link: https://github.com/kazrael2119/azure-rest-api-specs/blob/support-sample-gen-for-ts/specification/contosowidgetmanager/Contoso.Management/employee.tsp#L25-L28

  /** Profile of employee */
  @encode("base64url")
  profile?: bytes;

generated code:https://github.com/azure-sdk/azure-sdk-for-js/blob/e20dffad1c0889fffda4b9b86c7b7fba78fec584/sdk/contoso/arm-contoso/src/models/models.ts#L45-L46

 /** Profile of employee */
  profile?: Uint8Array;

generated sample:https://github.com/azure-sdk/azure-sdk-for-js/blob/e20dffad1c0889fffda4b9b86c7b7fba78fec584/sdk/contoso/arm-contoso/samples-dev/employeesCreateOrUpdateSample.ts#L24

profile: "ms",

5: missing required property: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4345745&view=logs&j=47092895-c7c8-567a-c7a6-8c88f3ec178e&t=d293a8e8-c6af-5091-cdf7-4c66482dd6f2&l=20682 this property exists in spec example, but does not be generated in sdk sample

kazrael2119 commented 2 days ago

(durabletask) https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4345745&view=logs&j=47092895-c7c8-567a-c7a6-8c88f3ec178e&t=d293a8e8-c6af-5091-cdf7-4c66482dd6f2&l=13869 (hybridconnectivity) https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4345745&view=logs&j=47092895-c7c8-567a-c7a6-8c88f3ec178e&t=d293a8e8-c6af-5091-cdf7-4c66482dd6f2&l=18664 (neonpostgres) https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4345745&view=logs&j=47092895-c7c8-567a-c7a6-8c88f3ec178e&t=d293a8e8-c6af-5091-cdf7-4c66482dd6f2&l=23273

these should be the spec example issue