diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 898c03946a..859a534df2 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -206,12 +206,12 @@ extends: - task: EsrpCodeSigning@5 displayName: "ESRP CodeSigning" inputs: - ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' - AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' - AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' - AuthAKVName: 'akv-prod-eastus' - AuthCertName: 'ReferenceLibraryPrivateCert' - AuthSignCertName: 'ReferencePackagePublisherCertificate' + ConnectedServiceName: "Federated DevX ESRP Managed Identity Connection" + AppRegistrationClientId: "65035b7f-7357-4f29-bf25-c5ee5c3949f8" + AppRegistrationTenantId: "cdc5aeea-15c5-4db6-b079-fcadd2505dc2" + AuthAKVName: "akv-prod-eastus" + AuthCertName: "ReferenceLibraryPrivateCert" + AuthSignCertName: "ReferencePackagePublisherCertificate" FolderPath: '$(Build.SourcesDirectory)\src' signConfigType: inlineSignParams UseMinimatch: true @@ -281,12 +281,12 @@ extends: - task: EsrpCodeSigning@5 displayName: "ESRP CodeSigning Nuget Packages" inputs: - ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' - AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' - AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' - AuthAKVName: 'akv-prod-eastus' - AuthCertName: 'ReferenceLibraryPrivateCert' - AuthSignCertName: 'ReferencePackagePublisherCertificate' + ConnectedServiceName: "Federated DevX ESRP Managed Identity Connection" + AppRegistrationClientId: "65035b7f-7357-4f29-bf25-c5ee5c3949f8" + AppRegistrationTenantId: "cdc5aeea-15c5-4db6-b079-fcadd2505dc2" + AuthAKVName: "akv-prod-eastus" + AuthCertName: "ReferenceLibraryPrivateCert" + AuthSignCertName: "ReferencePackagePublisherCertificate" FolderPath: "$(Build.ArtifactStagingDirectory)" UseMinimatch: true Pattern: "*.nupkg" @@ -401,12 +401,12 @@ extends: - task: EsrpCodeSigning@5 condition: and(succeeded(), startsWith('${{ distribution.architecture }}', 'win')) inputs: - ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' - AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' - AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' - AuthAKVName: 'akv-prod-eastus' - AuthCertName: 'ReferenceLibraryPrivateCert' - AuthSignCertName: 'ReferencePackagePublisherCertificate' + ConnectedServiceName: "Federated DevX ESRP Managed Identity Connection" + AppRegistrationClientId: "65035b7f-7357-4f29-bf25-c5ee5c3949f8" + AppRegistrationTenantId: "cdc5aeea-15c5-4db6-b079-fcadd2505dc2" + AuthAKVName: "akv-prod-eastus" + AuthCertName: "ReferenceLibraryPrivateCert" + AuthSignCertName: "ReferencePackagePublisherCertificate" FolderPath: $(Build.ArtifactStagingDirectory)/binaries/${{ distribution.architecture }} signConfigType: inlineSignParams UseMinimatch: true @@ -469,12 +469,12 @@ extends: timeoutInMinutes: 15 retryCountOnTaskFailure: 4 inputs: - ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' - AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' - AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' - AuthAKVName: 'akv-prod-eastus' - AuthCertName: 'ReferenceLibraryPrivateCert' - AuthSignCertName: 'ReferencePackagePublisherCertificate' + ConnectedServiceName: "Federated DevX ESRP Managed Identity Connection" + AppRegistrationClientId: "65035b7f-7357-4f29-bf25-c5ee5c3949f8" + AppRegistrationTenantId: "cdc5aeea-15c5-4db6-b079-fcadd2505dc2" + AuthAKVName: "akv-prod-eastus" + AuthCertName: "ReferenceLibraryPrivateCert" + AuthSignCertName: "ReferencePackagePublisherCertificate" FolderPath: $(Build.ArtifactStagingDirectory)/binaries signConfigType: inlineSignParams UseMinimatch: true @@ -501,12 +501,12 @@ extends: timeoutInMinutes: 15 retryCountOnTaskFailure: 4 inputs: - ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' - AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' - AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' - AuthAKVName: 'akv-prod-eastus' - AuthCertName: 'ReferenceLibraryPrivateCert' - AuthSignCertName: 'ReferencePackagePublisherCertificate' + ConnectedServiceName: "Federated DevX ESRP Managed Identity Connection" + AppRegistrationClientId: "65035b7f-7357-4f29-bf25-c5ee5c3949f8" + AppRegistrationTenantId: "cdc5aeea-15c5-4db6-b079-fcadd2505dc2" + AuthAKVName: "akv-prod-eastus" + AuthCertName: "ReferenceLibraryPrivateCert" + AuthSignCertName: "ReferencePackagePublisherCertificate" FolderPath: $(Build.ArtifactStagingDirectory)/binaries signConfigType: inlineSignParams UseMinimatch: true @@ -562,12 +562,12 @@ extends: inputs: versionSpec: "18.x" - ${{ each distribution in parameters.distributions }}: - - task: DownloadPipelineArtifact@2 - displayName: Download ${{ distribution.jobPrefix }} binaries from artifacts - inputs: - artifact: Binaries_${{ distribution.jobPrefix }} - source: current - targetPath: $(Build.ArtifactStagingDirectory)/Binaries + - task: DownloadPipelineArtifact@2 + displayName: Download ${{ distribution.jobPrefix }} binaries from artifacts + inputs: + artifact: Binaries_${{ distribution.jobPrefix }} + source: current + targetPath: $(Build.ArtifactStagingDirectory)/Binaries - pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch ${{ parameters.previewBranch }} displayName: "Set version suffix" - pwsh: $(Build.SourcesDirectory)/scripts/get-version-from-csproj.ps1 @@ -599,19 +599,19 @@ extends: workingDirectory: $(Build.SourcesDirectory)/vscode/microsoft-kiota name: getExtensionFileName - script: vsce generate-manifest -i $(getExtensionFileName.extensionFileName).vsix -o $(getExtensionFileName.extensionFileName).manifest - displayName: 'Generate extension manifest' + displayName: "Generate extension manifest" workingDirectory: $(Build.SourcesDirectory)/vscode/microsoft-kiota - script: cp $(getExtensionFileName.extensionFileName).manifest $(getExtensionFileName.extensionFileName).signature.p7s - displayName: 'Prepare manifest for signing' + displayName: "Prepare manifest for signing" workingDirectory: $(Build.SourcesDirectory)/vscode/microsoft-kiota - task: EsrpCodeSigning@5 inputs: - ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' - AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' - AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' - AuthAKVName: 'akv-prod-eastus' - AuthCertName: 'ReferenceLibraryPrivateCert' - AuthSignCertName: 'ReferencePackagePublisherCertificate' + ConnectedServiceName: "Federated DevX ESRP Managed Identity Connection" + AppRegistrationClientId: "65035b7f-7357-4f29-bf25-c5ee5c3949f8" + AppRegistrationTenantId: "cdc5aeea-15c5-4db6-b079-fcadd2505dc2" + AuthAKVName: "akv-prod-eastus" + AuthCertName: "ReferenceLibraryPrivateCert" + AuthSignCertName: "ReferencePackagePublisherCertificate" FolderPath: $(Build.SourcesDirectory)/vscode/microsoft-kiota UseMinimatch: true Pattern: '**\*.signature.p7s' @@ -630,7 +630,7 @@ extends: MaxConcurrency: 25 MaxRetryAttempts: 5 PendingAnalysisWaitTimeoutMinutes: 5 - displayName: 'Sign extension' + displayName: "Sign extension" - task: CopyFiles@2 displayName: Prepare staging folder for upload inputs: @@ -682,7 +682,7 @@ extends: inputs: azureSubscription: "kiota-vscode-marketplace-publish" scriptType: "pscore" - scriptLocation: 'inlineScript' + scriptLocation: "inlineScript" inlineScript: | $aadToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv Get-ChildItem -Path $(Pipeline.Workspace) -Filter *.vsix -Recurse | ForEach-Object { @@ -707,6 +707,15 @@ extends: os: linux image: ubuntu-latest templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: VSCode + targetPath: "$(Pipeline.Workspace)" + - input: pipelineArtifact + artifactName: Nugets + targetPath: "$(Pipeline.Workspace)" sdl: baseline: baselineFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnbaselines @@ -723,19 +732,11 @@ extends: clean: true submodules: true - ${{ each distribution in parameters.distributions }}: - - task: DownloadPipelineArtifact@2 - displayName: Download ${{ distribution.jobPrefix }} binaries from artifacts - inputs: - artifact: Binaries_${{ distribution.jobPrefix }} - source: current - - task: DownloadPipelineArtifact@2 - inputs: - artifact: VSCode - source: current - - task: DownloadPipelineArtifact@2 - inputs: - artifact: Nugets - source: current + - task: DownloadPipelineArtifact@2 + displayName: Download ${{ distribution.jobPrefix }} binaries from artifacts + inputs: + artifact: Binaries_${{ distribution.jobPrefix }} + source: current - pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch ${{ parameters.previewBranch }} displayName: "Set version suffix" - pwsh: $(Build.SourcesDirectory)/scripts/get-version-from-csproj.ps1 @@ -779,6 +780,13 @@ extends: isPreRelease: true - deployment: deploy_kiota + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: "$(Pipeline.Workspace)" pool: name: Azure-Pipelines-1ESPT-ExDShared os: linux @@ -790,11 +798,6 @@ extends: deploy: steps: - download: none - - task: DownloadPipelineArtifact@2 - displayName: Download nupkg from artifacts - inputs: - artifact: Nugets - source: current - powershell: | Remove-Item "$(Pipeline.Workspace)/Microsoft.OpenApi.Kiota.Builder.*.nupkg" -Verbose displayName: remove other nupkgs to avoid duplication @@ -802,11 +805,18 @@ extends: displayName: "NuGet push" inputs: packagesToPush: "$(Pipeline.Workspace)/Microsoft.OpenApi.Kiota.*.nupkg" - packageParentPath: '$(Pipeline.Workspace)' + packageParentPath: "$(Pipeline.Workspace)" nuGetFeedType: external publishFeedCredentials: "OpenAPI Nuget Connection" - deployment: deploy_builder + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: "$(Pipeline.Workspace)" pool: name: Azure-Pipelines-1ESPT-ExDShared os: linux @@ -818,11 +828,6 @@ extends: deploy: steps: - download: none - - task: DownloadPipelineArtifact@2 - displayName: Download nupkg from artifacts - inputs: - artifact: Nugets - source: current - powershell: | Remove-Item "$(Pipeline.Workspace)/Microsoft.OpenApi.Kiota.*.nupkg" -Verbose -Exclude "*.Builder.*" displayName: remove other nupkgs to avoid duplication @@ -830,6 +835,6 @@ extends: displayName: "NuGet push" inputs: packagesToPush: "$(Pipeline.Workspace)/Microsoft.OpenApi.Kiota.Builder.*.nupkg" - packageParentPath: '$(Pipeline.Workspace)' + packageParentPath: "$(Pipeline.Workspace)" nuGetFeedType: external publishFeedCredentials: "OpenAPI Nuget Connection" diff --git a/.vscode/settings.json b/.vscode/settings.json index dd2e4eae3e..dbeb6ba174 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -51,5 +51,6 @@ "java.configuration.updateBuildConfiguration": "automatic", "dotnet-test-explorer.testProjectPath": "tests/**/*.Tests.csproj", "editor.formatOnSave": true, - "dotnet.defaultSolution": "kiota.sln" + "dotnet.defaultSolution": "kiota.sln", + "azure-pipelines.1ESPipelineTemplatesSchemaFile": true } diff --git a/CHANGELOG.md b/CHANGELOG.md index 7649b49a9c..17076aa315 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,12 +11,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added a notion of support experience for languages in preparation for new community implemented languages. + ### Changed - Fixed python generation in scenarios with opening/closing tags for code comments. [#5636](https://github.com/microsoft/kiota/issues/5636) - Fixed Python error when a class inherits from a base class and implements an interface. [5637](https://github.com/microsoft/kiota/issues/5637) - Fix anyOf/oneOf generation in TypeScript. [5353](https://github.com/microsoft/kiota/issues/5353) - Fixed invalid code in Php caused by "*/*/" in property description. [5635](https://github.com/microsoft/kiota/issues/5635) +- Fixed TypeScript generation error when generating usings from shaken serializers. [#5634](https://github.com/microsoft/kiota/issues/5634) ## [1.20.0] - 2024-11-07 @@ -154,7 +157,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added uri-form encoded serialization for PHP. [#2074](https://github.com/microsoft/kiota/issues/2074) - Added information message with base URL in the CLI experience. [#4635](https://github.com/microsoft/kiota/issues/4635) - Added optional parameter --disable-ssl-validation for generate, show, and download commands. [#4176](https://github.com/microsoft/kiota/issues/4176) -- For _Debug_ builds of kiota, the `--log-level` / `--ll` option is now observed if specified explicitly on the command line. It still defaults to `Debug` for _Debug_ builds and `Warning` for _Release_ builds. [#4739](https://github.com/microsoft/kiota/pull/4739) +- For *Debug* builds of kiota, the `--log-level` / `--ll` option is now observed if specified explicitly on the command line. It still defaults to `Debug` for *Debug* builds and `Warning` for *Release* builds. [#4739](https://github.com/microsoft/kiota/pull/4739) ### Changed @@ -756,7 +759,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed unused generated import for PHP Generation. - Fixed a bug where long namespaces would make Ruby packaging fail. - Fixed a bug where classes with namespace names are generated outside namespace in Python. [#2188](https://github.com/microsoft/kiota/issues/2188) -- Changed signature of escaped reserved names from {x}_escaped to {x}_ in line with Python style guides. +- Changed signature of escaped reserved names from {x}*escaped to {x}* in line with Python style guides. - Add null checks in generated Shell language code. - Fixed a bug where Go indexers would fail to pass the index parameter. - Fixed a bug where path segments with parameters could be missing words. [#2209](https://github.com/microsoft/kiota/issues/2209) @@ -1505,4 +1508,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Initial GitHub release - diff --git a/it/config.json b/it/config.json index dab857bc52..777f0a36fd 100644 --- a/it/config.json +++ b/it/config.json @@ -29,10 +29,6 @@ "apisguru::github.com:api.github.com": { "MockServerITFolder": "gh", "Suppressions": [ - { - "Language": "typescript", - "Rationale": "https://github.com/microsoft/kiota/issues/5634" - }, { "Language": "ruby", "Rationale": "https://github.com/microsoft/kiota/issues/1816" diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 1db973fb3f..db8bccbe26 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -66,7 +66,7 @@ yapf==0.43.0 zipp==3.21.0 ; python_version >= '3.7' -aiohttp==3.11.6 ; python_version >= '3.6' +aiohttp==3.11.7 ; python_version >= '3.6' aiosignal==1.3.1 ; python_version >= '3.7' @@ -136,5 +136,5 @@ sniffio==1.3.1 ; python_version >= '3.7' uritemplate==4.1.1 ; python_version >= '3.6' -yarl==1.17.2 ; python_version >= '3.7' +yarl==1.18.0 ; python_version >= '3.7' diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 73ff774303..69086998a8 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -10,20 +10,20 @@ "license": "MIT", "dependencies": { "@azure/identity": "^4.5.0", - "@microsoft/kiota-abstractions": "^1.0.0-preview.75", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.75", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.75", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.75", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.75", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.75", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.75", + "@microsoft/kiota-abstractions": "^1.0.0-preview.77", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.77", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.77", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.77", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.77", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.77", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.77", "express": "^5.0.1", "node-fetch": "^2.7.0" }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@stylistic/eslint-plugin-ts": "^2.11.0", - "@types/node": "^22.9.1", + "@types/node": "^22.9.3", "@typescript-eslint/eslint-plugin": "^8.15.0", "@typescript-eslint/parser": "^8.15.0", "esbuild": "^0.24.0", @@ -766,9 +766,9 @@ } }, "node_modules/@microsoft/kiota-abstractions": { - "version": "1.0.0-preview.75", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.75.tgz", - "integrity": "sha512-4AHGZbBK0TF3Juoqv4nm/hatY9gmxMliEI6LBnJ0NX/bnrbkXYWYFqd77UNLqunum+UO9Z5TXkZ61iH/SfnJOw==", + "version": "1.0.0-preview.77", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.77.tgz", + "integrity": "sha512-fbG40A34f0E62mw+zN8tM3OUukpeh97scSf5At75vo4AGdidE2RGExbi97V0DqvqIxCgO8dEvR4zdweX74rzug==", "dependencies": { "@opentelemetry/api": "^1.7.0", "@std-uritemplate/std-uritemplate": "^1.0.1", @@ -790,59 +790,59 @@ } }, "node_modules/@microsoft/kiota-authentication-azure": { - "version": "1.0.0-preview.75", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.75.tgz", - "integrity": "sha512-+ypoLdiMMX3iXnR8dGlqCanej+G/CNJG4dYuTBsYoBKVi1scZ7Drg1pSSu22mTllJ0f4UBA+G89vs6tt/4DVrA==", + "version": "1.0.0-preview.77", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.77.tgz", + "integrity": "sha512-K63DttRxyysR2MJU3KqTheqWJq7NiX7ffnN5VgdgRMm4Nfpc35lZ0PwdscBuEZNMdQuU/Ghb5VdytsCllTJv3A==", "dependencies": { "@azure/core-auth": "^1.5.0", - "@microsoft/kiota-abstractions": "^1.0.0-preview.75", + "@microsoft/kiota-abstractions": "^1.0.0-preview.77", "@opentelemetry/api": "^1.7.0", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-http-fetchlibrary": { - "version": "1.0.0-preview.75", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.75.tgz", - "integrity": "sha512-JDLNjZSV0V05by63BOg7SY67YHzVbSeFnWsEViCO4iYMf0rUEVI4Il02YzMISQr6NE2ewiUmHhyyzBmCzZbjiA==", + "version": "1.0.0-preview.77", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.77.tgz", + "integrity": "sha512-4jMeJ1BJI19i41gPVXrcC8ii1VMYAnCpwqhRZv3SFSvboGAdS1Vyanakp5dxPoVOSN7vIgq/sOnKaxFCyENX+w==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.75", + "@microsoft/kiota-abstractions": "^1.0.0-preview.77", "@opentelemetry/api": "^1.7.0", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-form": { - "version": "1.0.0-preview.75", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.75.tgz", - "integrity": "sha512-6ePhlseALvXClmMbckPMSQkdxLDTdpKqb1zXjcNmyizBIUWOXIJOshS0vto8CVFn24hXej4XPPG5zbpds77caw==", + "version": "1.0.0-preview.77", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.77.tgz", + "integrity": "sha512-Kq8vkJuzfiPyVmj2ganGUPTNalEHUanN7AZbCt/cVWYDZX53VpgZzcaEgGP73FXToP9yaRIi33kGwLGeg3sPMQ==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.75", + "@microsoft/kiota-abstractions": "^1.0.0-preview.77", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-json": { - "version": "1.0.0-preview.75", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.75.tgz", - "integrity": "sha512-Kew92emgw6DEHnkIdxlPzwc7Tr4yyD0b4BlsjSRJ/si72Z6wLAP/WOe7SpBYuKhFpkxCbpoSG6/SAZLqaFcw3A==", + "version": "1.0.0-preview.77", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.77.tgz", + "integrity": "sha512-e/jXIId+B7QiFbpqpniux8DStfL0uU3oK7D4ds/PSXaH+ZKawX1W6XPU3mle3b+ZYxh0H79sU78NTARSMej9Xg==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.75", + "@microsoft/kiota-abstractions": "^1.0.0-preview.77", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-multipart": { - "version": "1.0.0-preview.75", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.75.tgz", - "integrity": "sha512-xdt1gSnZiDbOCE4v68s3KiUo7Nt4cRs5J8dvZUSjMlJCecYGt1xxL9FVY6ZLW8JxwAQANEULgSaS2s4ajaWxdA==", + "version": "1.0.0-preview.77", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.77.tgz", + "integrity": "sha512-JFJPJbDIMxok0sv4dpuqg01LHOKvoOMMTKPwRxEJMdXyqq2yULvx/+3YVe3o8BEdnMlAjA59ZE5LOJU7+XezQA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.75", + "@microsoft/kiota-abstractions": "^1.0.0-preview.77", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-text": { - "version": "1.0.0-preview.75", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.75.tgz", - "integrity": "sha512-1FE2Jj32HSVFTaH9jWnoGfoVbPy+zxBeos+IJY5kyb9Gq/v3VMfgOgbjLQZs2ZtT8u/oDc8bTIIns2Yx9/CFIQ==", + "version": "1.0.0-preview.77", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.77.tgz", + "integrity": "sha512-kemhCVV3muzKJ54FyfM6a4Rp1JA5q0GfPISmxXj9cyCtjYcguAD8q98+1owSeKFwjk2BGVRBZFixoZwcrmGf5g==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.75", + "@microsoft/kiota-abstractions": "^1.0.0-preview.77", "tslib": "^2.6.2" } }, @@ -936,9 +936,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "22.9.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz", - "integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==", + "version": "22.9.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.3.tgz", + "integrity": "sha512-F3u1fs/fce3FFk+DAxbxc78DF8x0cY09RRL8GnXLmkJ1jvx3TtPdWoTT5/NiYfI5ASqXBmfqJi9dZ3gxMx4lzw==", "dev": true, "dependencies": { "undici-types": "~6.19.8" diff --git a/it/typescript/package.json b/it/typescript/package.json index 48c43a3067..1411552c61 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -20,7 +20,7 @@ "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@stylistic/eslint-plugin-ts": "^2.11.0", - "@types/node": "^22.9.1", + "@types/node": "^22.9.3", "@typescript-eslint/eslint-plugin": "^8.15.0", "@typescript-eslint/parser": "^8.15.0", "esbuild": "^0.24.0", @@ -32,13 +32,13 @@ }, "dependencies": { "@azure/identity": "^4.5.0", - "@microsoft/kiota-abstractions": "^1.0.0-preview.75", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.75", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.75", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.75", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.75", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.75", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.75", + "@microsoft/kiota-abstractions": "^1.0.0-preview.77", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.77", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.77", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.77", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.77", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.77", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.77", "express": "^5.0.1", "node-fetch": "^2.7.0" } diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index cd178188c5..6bf2e472f7 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -35,7 +35,7 @@ $(NoWarn);CS8785;NU5048;NU5104;CA1724;CA1055;CA1848;CA1308;CA1822 - + diff --git a/src/Kiota.Builder/LanguageInformation.cs b/src/Kiota.Builder/LanguageInformation.cs index c0b36309aa..d58dfa3b6a 100644 --- a/src/Kiota.Builder/LanguageInformation.cs +++ b/src/Kiota.Builder/LanguageInformation.cs @@ -15,9 +15,13 @@ public LanguageMaturityLevel MaturityLevel { get; set; } + public SupportExperience SupportExperience + { + get; set; + } #pragma warning disable CA2227 #pragma warning disable CA1002 - public List Dependencies { get; set; } = new(); + public List Dependencies { get; set; } = []; #pragma warning restore CA1002 #pragma warning restore CA2227 public string DependencyInstallCommand { get; set; } = string.Empty; @@ -32,11 +36,12 @@ public void SerializeAsV3(IOpenApiWriter writer) ArgumentNullException.ThrowIfNull(writer); writer.WriteStartObject(); writer.WriteProperty(nameof(MaturityLevel).ToFirstCharacterLowerCase(), MaturityLevel.ToString()); + writer.WriteProperty(nameof(SupportExperience).ToFirstCharacterLowerCase(), SupportExperience.ToString()); writer.WriteProperty(nameof(DependencyInstallCommand).ToFirstCharacterLowerCase(), DependencyInstallCommand); - writer.WriteOptionalCollection(nameof(Dependencies).ToFirstCharacterLowerCase(), Dependencies, (w, x) => x.SerializeAsV3(w)); + writer.WriteOptionalCollection(nameof(Dependencies).ToFirstCharacterLowerCase(), Dependencies, static (w, x) => x.SerializeAsV3(w)); writer.WriteProperty(nameof(ClientClassName).ToFirstCharacterLowerCase(), ClientClassName); writer.WriteProperty(nameof(ClientNamespaceName).ToFirstCharacterLowerCase(), ClientNamespaceName); - writer.WriteOptionalCollection(nameof(StructuredMimeTypes).ToFirstCharacterLowerCase(), StructuredMimeTypes, (w, x) => w.WriteValue(x)); + writer.WriteOptionalCollection(nameof(StructuredMimeTypes).ToFirstCharacterLowerCase(), StructuredMimeTypes, static (w, x) => w.WriteValue(x)); writer.WriteEndObject(); } public static LanguageInformation Parse(IOpenApiAny source) @@ -66,6 +71,14 @@ public static LanguageInformation Parse(IOpenApiAny source) foreach (var entry in structuredMimeTypesValue.OfType()) extension.StructuredMimeTypes.Add(entry.Value); } + if (rawObject.TryGetValue(nameof(MaturityLevel).ToFirstCharacterLowerCase(), out var maturityLevel) && maturityLevel is OpenApiString maturityLevelValue && Enum.TryParse(maturityLevelValue.Value, true, out var parsedMaturityLevelValue)) + { + extension.MaturityLevel = parsedMaturityLevelValue; + } + if (rawObject.TryGetValue(nameof(SupportExperience).ToFirstCharacterLowerCase(), out var supportExperience) && supportExperience is OpenApiString supportExperienceValue && Enum.TryParse(supportExperienceValue.Value, true, out var parsedSupportExperienceValue)) + { + extension.SupportExperience = parsedSupportExperienceValue; + } return extension; } } @@ -116,7 +129,14 @@ public enum LanguageMaturityLevel { Experimental, Preview, - Stable + Stable, + Abandoned +} + +public enum SupportExperience +{ + Microsoft, + Community } public enum DependencyType diff --git a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs index 4b634c7d08..ca06132982 100644 --- a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs +++ b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs @@ -1493,22 +1493,26 @@ private static void AddDeserializerUsingToDiscriminatorFactory(CodeElement codeE foreach (var mappedType in parsableFactoryFunction.OriginalMethodParentClass.DiscriminatorInformation.DiscriminatorMappings) { - if (mappedType.Value is CodeType type && type.TypeDefinition is CodeClass mappedClass) + if (mappedType.Value is not + { TypeDefinition: CodeClass { Parent: CodeNamespace codeNamespace } mappedClass } + || codeNamespace.FindChildByName( + $"{ModelDeserializerPrefix}{mappedClass.Name.ToFirstCharacterUpperCase()}") is not + { } deserializer) { - var deserializer = GetSerializationFunctionsForNamespace(mappedClass).Item2; + continue; + } - if (deserializer.Parent is not null) + if (deserializer.Parent is not null) + { + parsableFactoryFunction.AddUsing(new CodeUsing { - parsableFactoryFunction.AddUsing(new CodeUsing + Name = deserializer.Parent.Name, + Declaration = new CodeType { - Name = deserializer.Parent.Name, - Declaration = new CodeType - { - Name = deserializer.Name, - TypeDefinition = deserializer - }, - }); - } + Name = deserializer.Name, + TypeDefinition = deserializer + }, + }); } } } diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs index b75590008a..f9f41d41a8 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs @@ -102,7 +102,7 @@ private void WriteRequestsMetadataConstant(CodeConstant codeElement, LanguageWri var isStream = conventions.StreamTypeName.Equals(returnType, StringComparison.OrdinalIgnoreCase); var isEnum = executorMethod.ReturnType is CodeType codeType && codeType.TypeDefinition is CodeEnum; var returnTypeWithoutCollectionSymbol = GetReturnTypeWithoutCollectionSymbol(executorMethod, returnType); - var isPrimitive = IsPrimitiveType(returnTypeWithoutCollectionSymbol); + var isPrimitive = IsPrimitiveType(returnTypeWithoutCollectionSymbol) || IsKiotaPrimitive(returnTypeWithoutCollectionSymbol); var isPrimitiveAlias = GetPrimitiveAlias(returnTypeWithoutCollectionSymbol) is not null; writer.StartBlock($"{executorMethod.Name.ToFirstCharacterLowerCase()}: {{"); var urlTemplateValue = executorMethod.HasUrlTemplateOverride ? $"\"{executorMethod.UrlTemplateOverride}\"" : uriTemplateConstant.Name.ToFirstCharacterUpperCase(); @@ -169,7 +169,7 @@ private string GetTypeFactory(bool isVoid, bool isStream, CodeMethod codeElement { if (isVoid) return string.Empty; var typeName = conventions.TranslateType(codeElement.ReturnType); - if (isStream || IsPrimitiveType(typeName)) return $" \"{typeName}\""; + if (isStream || IsPrimitiveType(typeName) || IsKiotaPrimitive(typeName)) return $" \"{typeName}\""; if (GetPrimitiveAlias(typeName) is { } alias && !string.IsNullOrEmpty(alias)) return $" \"{alias}\""; return $" {GetFactoryMethodName(codeElement.ReturnType, codeElement, writer)}"; diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs index 1710944648..c21197ae14 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs @@ -117,7 +117,7 @@ private void WriteComposedTypeSerializer(CodeFunction codeElement, LanguageWrite private void WriteSerializationFunctionForCodeIntersectionType(CodeComposedTypeBase composedType, CodeParameter composedParam, CodeFunction method, LanguageWriter writer) { - foreach (var mappedType in composedType.Types.Where(x => !IsPrimitiveType(x, composedType))) + foreach (var mappedType in composedType.Types.Where(x => !IsPrimitiveType(x, composedType) && x.TypeDefinition != null)) { var functionName = GetSerializerFunctionName(method, mappedType); var variableName = composedParam.Name.ToFirstCharacterLowerCase(); @@ -611,9 +611,17 @@ private static string GetDefaultValueSuffix(CodeProperty otherProp) private static string GetDefaultValueLiteralForProperty(CodeProperty codeProperty) { if (string.IsNullOrEmpty(codeProperty.DefaultValue)) return string.Empty; - if (codeProperty.Type is CodeType propertyType && propertyType.TypeDefinition is CodeEnum enumDefinition && enumDefinition.CodeEnumObject is not null) - return $"{enumDefinition.CodeEnumObject.Name.ToFirstCharacterUpperCase()}.{codeProperty.DefaultValue.Trim('"').CleanupSymbolName().ToFirstCharacterUpperCase()}"; - return codeProperty.DefaultValue; + if (codeProperty.Type is CodeType propertyType && propertyType.TypeDefinition is CodeEnum enumDefinition && + enumDefinition.CodeEnumObject is not null) + { + var codeEnumOption = enumDefinition.Options.First(x => + x.SymbolName.Equals(codeProperty.DefaultValue.Trim('"').CleanupSymbolName(), + StringComparison.OrdinalIgnoreCase)); + return $"{enumDefinition.CodeEnumObject.Name.ToFirstCharacterUpperCase()}.{codeEnumOption.Name.Trim('"').CleanupSymbolName().ToFirstCharacterUpperCase()}"; + } + + // only string primitive should keep quotes + return codeProperty.Type.Name.Equals("string", StringComparison.Ordinal) ? codeProperty.DefaultValue : codeProperty.DefaultValue.Trim('"'); } private void WriteDefensiveStatements(CodeMethod codeElement, LanguageWriter writer) { diff --git a/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs b/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs index 90a6ac83e3..a963796ba6 100644 --- a/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs +++ b/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs @@ -99,7 +99,7 @@ public override string GetParameterSignature(CodeParameter parameter, CodeElemen // add a 'Parsable' type to the parameter if it is composed of non-Parsable types var parsableTypes = ( - composedType != null && !composedType.IsComposedOfObjects(IsPrimitiveType), + composedType != null && (!composedType.IsComposedOfObjects(IsPrimitiveType) || composedType.Types.Any(x => x.IsCollection)), parameter.Parent is CodeMethod method && (method.IsOfKind(CodeMethodKind.Deserializer, CodeMethodKind.Serializer)) ) switch { @@ -237,6 +237,18 @@ TYPE_LOWERCASE_BOOLEAN or }; } + // Types that are imported from kiota-abstractions and considered as primitive types + public static bool IsKiotaPrimitive(string typeName) + { + return typeName switch + { + TYPE_DATE_ONLY or + TYPE_TIME_ONLY or + TYPE_DURATION => true, + _ => false, + }; + } + public static string? GetPrimitiveAlias(string typeName) { return typeName switch @@ -252,7 +264,18 @@ TYPE_LOWERCASE_BOOLEAN or private static bool IsPrimitiveTypeOrPrimitiveCollection(CodeType codeType, CodeComposedTypeBase codeComposedTypeBase) => IsPrimitiveType(codeType, codeComposedTypeBase, false); - internal static string RemoveInvalidDescriptionCharacters(string originalDescription) => originalDescription?.Replace("\\", "/", StringComparison.OrdinalIgnoreCase) ?? string.Empty; + private static Dictionary InvalidCharactersReplacements = new(StringComparer.OrdinalIgnoreCase) { + { "\\", "/"}, + { "/*", "//*"} + }; + + internal static string RemoveInvalidDescriptionCharacters(string originalDescription) + { + if (string.IsNullOrEmpty(originalDescription)) return string.Empty; + originalDescription = InvalidCharactersReplacements + .Aggregate(originalDescription, (current, replacement) => current.Replace(replacement.Key, replacement.Value, StringComparison.OrdinalIgnoreCase)); + return originalDescription; + } public override bool WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = "") { ArgumentNullException.ThrowIfNull(writer); diff --git a/src/kiota/Handlers/KiotaInfoCommandHandler.cs b/src/kiota/Handlers/KiotaInfoCommandHandler.cs index 949b4f00b3..f60ab7f85e 100644 --- a/src/kiota/Handlers/KiotaInfoCommandHandler.cs +++ b/src/kiota/Handlers/KiotaInfoCommandHandler.cs @@ -113,6 +113,7 @@ private void ShowLanguagesTable() }; view.AddColumn(static x => x.Key, "Language"); view.AddColumn(static x => x.Value.MaturityLevel.ToString(), "Maturity Level"); + view.AddColumn(static x => x.Value.SupportExperience.ToString(), "Support Experience"); var console = new SystemConsole(); using var terminal = new SystemConsoleTerminal(console); var layout = new StackLayoutView { view }; @@ -125,6 +126,7 @@ private void ShowLanguageInformation(GenerationLanguage language, LanguagesInfor if (!json) { DisplayInfo($"The language {language} is currently in {languageInformation.MaturityLevel} maturity level.", + $"The support experience is provided by {languageInformation.SupportExperience}.", "After generating code for this language, you need to install the following packages:"); var orderedDependencies = languageInformation.Dependencies.OrderBy(static x => x.Name).Select(static x => x).ToList(); var filteredDependencies = (dependencyTypes.ToHashSet(), orderedDependencies.Any(static x => x.DependencyType is DependencyType.Bundle)) switch diff --git a/src/kiota/KiotaConfigurationExtensions.cs b/src/kiota/KiotaConfigurationExtensions.cs index c54572b1f6..33842b6978 100644 --- a/src/kiota/KiotaConfigurationExtensions.cs +++ b/src/kiota/KiotaConfigurationExtensions.cs @@ -37,6 +37,7 @@ public static void BindConfiguration(this KiotaConfiguration configObject, IConf ClientNamespaceName = section[nameof(LanguageInformation.ClientNamespaceName)] ?? string.Empty, DependencyInstallCommand = section[nameof(LanguageInformation.DependencyInstallCommand)] ?? string.Empty, MaturityLevel = Enum.TryParse(section[nameof(LanguageInformation.MaturityLevel)], true, out var ml) ? ml : LanguageMaturityLevel.Experimental, + SupportExperience = Enum.TryParse(section[nameof(LanguageInformation.SupportExperience)], true, out var se) ? se : SupportExperience.Community, }; section.GetSection(nameof(lngInfo.StructuredMimeTypes)).LoadHashSet(lngInfo.StructuredMimeTypes); var dependenciesSection = section.GetSection(nameof(lngInfo.Dependencies)); diff --git a/src/kiota/appsettings.json b/src/kiota/appsettings.json index 3e76f73085..a53ec54fe0 100644 --- a/src/kiota/appsettings.json +++ b/src/kiota/appsettings.json @@ -24,6 +24,7 @@ "Languages": { "CSharp": { "MaturityLevel": "Stable", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "Microsoft.Kiota.Abstractions", @@ -70,6 +71,7 @@ }, "Java": { "MaturityLevel": "Stable", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "com.microsoft.kiota:microsoft-kiota-abstractions", @@ -123,6 +125,7 @@ }, "Go": { "MaturityLevel": "Stable", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "github.com/microsoft/kiota-abstractions-go", @@ -169,6 +172,7 @@ }, "TypeScript": { "MaturityLevel": "Preview", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "@microsoft/kiota-abstractions", @@ -215,6 +219,7 @@ }, "PHP": { "MaturityLevel": "Stable", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "microsoft/kiota-abstractions", @@ -256,6 +261,7 @@ }, "Python": { "MaturityLevel": "Stable", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "microsoft-kiota-abstractions", @@ -302,6 +308,7 @@ }, "Ruby": { "MaturityLevel": "Experimental", + "SupportExperience": "Community", "Dependencies": [ { "Name": "microsoft_kiota_abstractions", @@ -328,11 +335,13 @@ }, "Swift": { "MaturityLevel": "Experimental", + "SupportExperience": "Community", "Dependencies": [], "DependencyInstallCommand": "" }, "CLI": { "MaturityLevel": "Preview", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "Microsoft.Kiota.Abstractions", @@ -378,4 +387,4 @@ "DependencyInstallCommand": "dotnet add package {0} --version {1}" } } -} +} \ No newline at end of file diff --git a/tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiKiotaExtensionTests.cs b/tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiKiotaExtensionTests.cs index beb4c3fe4f..872f0ca6db 100644 --- a/tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiKiotaExtensionTests.cs +++ b/tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiKiotaExtensionTests.cs @@ -27,6 +27,7 @@ public void Serializes() }, DependencyInstallCommand = "dotnet add package", MaturityLevel = LanguageMaturityLevel.Preview, + SupportExperience = SupportExperience.Microsoft, ClientClassName = "GraphServiceClient", ClientNamespaceName = "Microsoft.Graph", StructuredMimeTypes = new() { @@ -43,7 +44,7 @@ public void Serializes() value.Write(writer, OpenApiSpecVersion.OpenApi3_0); var result = sWriter.ToString(); - Assert.Equal("{\"languagesInformation\":{\"CSharp\":{\"maturityLevel\":\"Preview\",\"dependencyInstallCommand\":\"dotnet add package\",\"dependencies\":[{\"name\":\"Microsoft.Graph.Core\",\"version\":\"1.0.0\",\"type\":\"Bundle\"}],\"clientClassName\":\"GraphServiceClient\",\"clientNamespaceName\":\"Microsoft.Graph\",\"structuredMimeTypes\":[\"application/json\",\"application/xml\"]}}}", result); + Assert.Equal("{\"languagesInformation\":{\"CSharp\":{\"maturityLevel\":\"Preview\",\"supportExperience\":\"Microsoft\",\"dependencyInstallCommand\":\"dotnet add package\",\"dependencies\":[{\"name\":\"Microsoft.Graph.Core\",\"version\":\"1.0.0\",\"type\":\"Bundle\"}],\"clientClassName\":\"GraphServiceClient\",\"clientNamespaceName\":\"Microsoft.Graph\",\"structuredMimeTypes\":[\"application/json\",\"application/xml\"]}}}", result); } [Fact] public void Parses() @@ -61,6 +62,7 @@ public void Parses() }}, {"dependencyInstallCommand", new OpenApiString("dotnet add package") }, {"maturityLevel", new OpenApiString("Preview")}, + {"supportExperience", new OpenApiString("Microsoft")}, {"clientClassName", new OpenApiString("GraphServiceClient")}, {"clientNamespaceName", new OpenApiString("Microsoft.Graph")}, {"structuredMimeTypes", new OpenApiArray { @@ -75,7 +77,8 @@ public void Parses() Assert.NotNull(value); Assert.True(value.LanguagesInformation.TryGetValue("CSharp", out var CSEntry)); Assert.Equal("dotnet add package", CSEntry.DependencyInstallCommand); - Assert.Equal(LanguageMaturityLevel.Experimental, CSEntry.MaturityLevel); //expected as we're not parsing the value from the description + Assert.Equal(LanguageMaturityLevel.Preview, CSEntry.MaturityLevel); + Assert.Equal(SupportExperience.Microsoft, CSEntry.SupportExperience); Assert.Equal("GraphServiceClient", CSEntry.ClientClassName); Assert.Equal("Microsoft.Graph", CSEntry.ClientNamespaceName); Assert.Single(CSEntry.Dependencies); diff --git a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs index 6eee533f97..79025ef0fa 100644 --- a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs @@ -1116,6 +1116,23 @@ public async Task WritesConstructorWithEnumValueAsync() { Name = "pictureSize" }).First(); + + codeEnum.AddOption( + new CodeEnumOption + { + Name = "256x256", + SerializationName = "256x256" + }, + new CodeEnumOption + { + Name = "512x512", + SerializationName = "512x512" + }, + new CodeEnumOption + { + Name = "1024x1024", + SerializationName = "1024x1024" + }); parentClass.AddProperty(new CodeProperty { Name = propName, diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 8091030d4c..aed8e0922b 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -35,7 +35,7 @@ "sinon": "^19.0.2", "ts-loader": "^9.5.1", "typemoq": "^2.1.0", - "typescript": "^5.6.3", + "typescript": "^5.7.2", "webpack": "^5.96.1", "webpack-cli": "^5.1.4" }, @@ -731,9 +731,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "22.9.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz", - "integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==", + "version": "22.9.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.3.tgz", + "integrity": "sha512-F3u1fs/fce3FFk+DAxbxc78DF8x0cY09RRL8GnXLmkJ1jvx3TtPdWoTT5/NiYfI5ASqXBmfqJi9dZ3gxMx4lzw==", "dev": true, "dependencies": { "undici-types": "~6.19.8" @@ -5175,11 +5175,10 @@ } }, "node_modules/typescript": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", - "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true, - "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index 7fc89765e0..2054f765d6 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -485,7 +485,7 @@ "sinon": "^19.0.2", "ts-loader": "^9.5.1", "typemoq": "^2.1.0", - "typescript": "^5.6.3", + "typescript": "^5.7.2", "webpack": "^5.96.1", "webpack-cli": "^5.1.4" },