From e1af0bb025c8d6f3cb159099f5c3b1c7d1d57e16 Mon Sep 17 00:00:00 2001 From: Xiaogang Ding Date: Tue, 5 Aug 2025 16:44:05 +0800 Subject: [PATCH] Fixed an issue related to duration --- .scripts/publish.yaml | 2 +- packages/typespec-powershell/src/utils/modelUtils.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.scripts/publish.yaml b/.scripts/publish.yaml index 31b4b6cd80a..4670952d437 100644 --- a/.scripts/publish.yaml +++ b/.scripts/publish.yaml @@ -40,7 +40,7 @@ steps: npx @microsoft/rush publish --publish --pack --include-all --tag latest # publish the packages (tag as preview by default) - echo "//registry.npmjs.org/:_authToken=$(azure-sdk-npm-token)" > ./.npmrc + echo "//registry.npmjs.org/:_authToken=$(azure-powershell-npm-token)" > ./.npmrc for file in common/temp/artifacts/packages/*.tgz do common/temp/pnpm-local/node_modules/.bin/pnpm publish $file --no-git-checks --tag latest --access public || echo no-worries diff --git a/packages/typespec-powershell/src/utils/modelUtils.ts b/packages/typespec-powershell/src/utils/modelUtils.ts index d77026d6fbb..0a45a2d47a7 100644 --- a/packages/typespec-powershell/src/utils/modelUtils.ts +++ b/packages/typespec-powershell/src/utils/modelUtils.ts @@ -465,6 +465,9 @@ function getSchemaForScalar( case "base64url": schema.type = SchemaType.ByteArray; break; + case "duration": + schema.type = SchemaType.Duration; + break; } } function isBinaryAsRequestBody() { @@ -1515,7 +1518,7 @@ function getSchemaForStdScalar( outputTypeName: "string" }; case "duration": - return { type: "string", format, description }; + return { type: "string", format: "duration", description }; case "url": return { type: "string", format: "uri" }; }