diff --git a/.github/workflows/auto-merge-dependabot.yml b/.github/workflows/auto-merge-dependabot.yml index 72d96dd1d5..3d9334e960 100644 --- a/.github/workflows/auto-merge-dependabot.yml +++ b/.github/workflows/auto-merge-dependabot.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v2.1.0 + uses: dependabot/fetch-metadata@v2.2.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 994458dca3..60df475d63 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -74,7 +74,7 @@ jobs: run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT - name: Push to GitHub Packages - Nightly if: contains(github.ref, env.PREVIEW_BRANCH) - uses: docker/build-push-action@v6.2.0 + uses: docker/build-push-action@v6.3.0 with: push: true platforms: linux/amd64,linux/arm64/v8,linux/arm/v7 @@ -84,7 +84,7 @@ jobs: # we can't get the sequence number from ADO so we default it back to github run number - name: Push to GitHub Packages - Release if: contains(github.ref, 'refs/tags/v') - uses: docker/build-push-action@v6.2.0 + uses: docker/build-push-action@v6.3.0 with: push: true platforms: linux/amd64,linux/arm64/v8,linux/arm/v7 diff --git a/CHANGELOG.md b/CHANGELOG.md index a579967daa..66f4df46c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,22 +5,36 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + ## [Unreleased] +### Added + ### Changed -- Implemented partial class model declarations. [4894](https://github.com/microsoft/kiota/issues/4894) + +## [1.16.0] - 2024-07-05 ### Added ### Changed +- Implemented partial class model declarations. [4894](https://github.com/microsoft/kiota/issues/4894) +- Fixed a bug where the Go file names were too long +- Fixed a bug where the declarative copilot information would be erased if any. [#4935](https://github.com/microsoft/kiota/issues/4935) +- Fixes bug with model names in Go generated from camel case namespace. [https://github.com/microsoftgraph/msgraph-sdk-go/issues/721] - Plugins OpenAPI extensions are only added when generating plugins to reduce the risk of parsing errors. [#4834](https://github.com/microsoft/kiota/issues/4834) - TypeScript imports are now using ES6 imports with the .js extension. - Remove LINQ usage in generated code. - Ensures descriptions are not empty in sliced OpenApi file when generating a plugin. - Plugins do not emit parameters anymore. [#4841](https://github.com/microsoft/kiota/issues/4841) - References to C# types generated by kiota are prefixed with `global::` to avoid name collisions. [#4796](https://github.com/microsoft/kiota/issues/4796) - +- Ensures HashSet properties in `KiotaLock` maintain IgnoreCase comparer across runs [#4916](https://github.com/microsoft/kiota/issues/4916) +- Dropped `client base url set to` message when generating plugins. [#4905](https://github.com/microsoft/kiota/issues/4905) +- Emit `[GeneratedCode]` attribute for C# types. [#4907](https://github.com/microsoft/kiota/issues/4907) +- Fixes error property disambiguation when the property has the same name as class [#4893](https://github.com/microsoft/kiota/issues/) +- Fixes missing imports for `UntypedNode` for method parameter and return value scenarios. [#4925](https://github.com/microsoft/kiota/issues/4925) +- Normalize path separators in lock and workspace files to use `/` as the path separator. [#4228](https://github.com/microsoft/kiota/issues/4228) ## [1.15.0] - 2024-06-06 @@ -879,7 +893,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Split parsable interface and additional property/data interface in Ruby. [#1654](https://github.com/microsoft/kiota/issues/1654) - Changed format of datetimes in Go to be converted to ISO 8601 by default when place in path parameters(Go) - Defined the Access Token Provider Interface for Ruby authentication. [#1638](https://github.com/microsoft/kiota/issues/1638) -- Reduce code verbosity on Go Getters and Setters. [G0#26][https://github.com/microsoftgraph/msgraph-sdk-go-core/issues/26] +- Reduce code verbosity on Go Getters and Setters. [G0#26](https://github.com/microsoftgraph/msgraph-sdk-go-core/issues/26) ## [0.3.0] - 2022-07-08 @@ -1380,3 +1394,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Initial GitHub release + diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index c7e072911e..521552e9d9 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -10,13 +10,13 @@ - - - - - - - + + + + + + + diff --git a/it/go/go.mod b/it/go/go.mod index c5c42cbcd9..eb34744bb8 100644 --- a/it/go/go.mod +++ b/it/go/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 - github.com/microsoft/kiota-abstractions-go v1.6.0 + github.com/microsoft/kiota-abstractions-go v1.6.1 github.com/microsoft/kiota-authentication-azure-go v1.0.2 github.com/microsoft/kiota-http-go v1.4.1 github.com/microsoft/kiota-serialization-form-go v1.0.0 @@ -26,7 +26,7 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/std-uritemplate/std-uritemplate/go v0.0.55 // indirect + github.com/std-uritemplate/std-uritemplate/go v0.0.57 // indirect github.com/stretchr/testify v1.9.0 // indirect go.opentelemetry.io/otel v1.24.0 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect diff --git a/it/go/go.sum b/it/go/go.sum index dc69d0369c..3184eb8dc0 100644 --- a/it/go/go.sum +++ b/it/go/go.sum @@ -24,8 +24,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/microsoft/kiota-abstractions-go v1.6.0 h1:qbGBNMU0/o5myKbikCBXJFohVCFrrpx2cO15Rta2WyA= -github.com/microsoft/kiota-abstractions-go v1.6.0/go.mod h1:7YH20ZbRWXGfHSSvdHkdztzgCB9mRdtFx13+hrYIEpo= +github.com/microsoft/kiota-abstractions-go v1.6.1 h1:NXK50S3BwJn9Wj6bO0YFuAig7y2WVgdQ/ie1ktMl2J4= +github.com/microsoft/kiota-abstractions-go v1.6.1/go.mod h1:FI1I2OHg0E7bK5t8DPnw+9C/CHVyLP6XeqDBT+95pTE= github.com/microsoft/kiota-authentication-azure-go v1.0.2 h1:tClGeyFZJ+4Bakf8u0euPM4wqy4ethycdOgx3jyH3pI= github.com/microsoft/kiota-authentication-azure-go v1.0.2/go.mod h1:aTcti0bUJEcq7kBfQG4Sr4ElvRNuaalXcFEu4iEyQ6M= github.com/microsoft/kiota-http-go v1.4.1 h1:zR54JahUOcu8h9C5z00fcQChzX8d01+BwhkTS8H16Ro= @@ -43,8 +43,8 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjL github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/std-uritemplate/std-uritemplate/go v0.0.55 h1:muSH037g97K7U2f94G9LUuE8tZlJsoSSrPsO9V281WY= -github.com/std-uritemplate/std-uritemplate/go v0.0.55/go.mod h1:rG/bqh/ThY4xE5de7Rap3vaDkYUT76B0GPJ0loYeTTc= +github.com/std-uritemplate/std-uritemplate/go v0.0.57 h1:GHGjptrsmazP4IVDlUprssiEf9ESVkbjx15xQXXzvq4= +github.com/std-uritemplate/std-uritemplate/go v0.0.57/go.mod h1:rG/bqh/ThY4xE5de7Rap3vaDkYUT76B0GPJ0loYeTTc= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 93a0e9e679..d36b449781 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -2,7 +2,7 @@ astroid==3.2.2 ; python_full_version >= '3.7.2' -certifi==2024.6.2 ; python_version >= '3.6' +certifi==2024.7.4 ; python_version >= '3.6' charset-normalizer==3.3.2 ; python_full_version >= '3.7.0' @@ -40,7 +40,7 @@ platformdirs==4.2.2 ; python_version >= '3.7' pluggy==1.5.0 ; python_version >= '3.7' -pylint==3.2.4 +pylint==3.2.5 pytest==8.2.2 @@ -54,7 +54,7 @@ tomli==2.0.1 ; python_version < '3.11' tomli-w==1.0.0 ; python_version >= '3.7' -tomlkit==0.12.5 ; python_version >= '3.7' +tomlkit==0.13.0 ; python_version >= '3.7' typing-extensions==4.12.2 ; python_version >= '3.7' @@ -102,7 +102,7 @@ microsoft-kiota-abstractions==1.3.3 microsoft-kiota-authentication-azure==1.0.0 -microsoft-kiota-http==1.3.1 +microsoft-kiota-http==1.3.2 microsoft-kiota-serialization-json==1.2.0 diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 1c46b8c5bf..951715b403 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -10,22 +10,22 @@ "license": "MIT", "dependencies": { "@azure/identity": "^4.3.0", - "@microsoft/kiota-abstractions": "^1.0.0-preview.56", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.51", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.55", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.45", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.56", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.34", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.53", + "@microsoft/kiota-abstractions": "^1.0.0-preview.57", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.52", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.56", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.46", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.57", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.35", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.54", "express": "^4.19.2", "node-fetch": "^2.7.0" }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.14.9", + "@types/node": "^20.14.10", "@typescript-eslint/eslint-plugin": "^7.7.1", "@typescript-eslint/parser": "^7.8.0", - "esbuild": "^0.21.5", + "esbuild": "^0.23.0", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "minimist": "^1.2.8", @@ -261,9 +261,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", - "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.0.tgz", + "integrity": "sha512-3sG8Zwa5fMcA9bgqB8AfWPQ+HFke6uD3h1s3RIwUNK8EG7a4buxvuFTs3j1IMs2NXAk9F30C/FF4vxRgQCcmoQ==", "cpu": [ "ppc64" ], @@ -273,13 +273,13 @@ "aix" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", - "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.0.tgz", + "integrity": "sha512-+KuOHTKKyIKgEEqKbGTK8W7mPp+hKinbMBeEnNzjJGyFcWsfrXjSTNluJHCY1RqhxFurdD8uNXQDei7qDlR6+g==", "cpu": [ "arm" ], @@ -289,13 +289,13 @@ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", - "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.0.tgz", + "integrity": "sha512-EuHFUYkAVfU4qBdyivULuu03FhJO4IJN9PGuABGrFy4vUuzk91P2d+npxHcFdpUnfYKy0PuV+n6bKIpHOB3prQ==", "cpu": [ "arm64" ], @@ -305,13 +305,13 @@ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", - "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.0.tgz", + "integrity": "sha512-WRrmKidLoKDl56LsbBMhzTTBxrsVwTKdNbKDalbEZr0tcsBgCLbEtoNthOW6PX942YiYq8HzEnb4yWQMLQuipQ==", "cpu": [ "x64" ], @@ -321,13 +321,13 @@ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", - "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.0.tgz", + "integrity": "sha512-YLntie/IdS31H54Ogdn+v50NuoWF5BDkEUFpiOChVa9UnKpftgwzZRrI4J132ETIi+D8n6xh9IviFV3eXdxfow==", "cpu": [ "arm64" ], @@ -337,13 +337,13 @@ "darwin" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", - "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.0.tgz", + "integrity": "sha512-IMQ6eme4AfznElesHUPDZ+teuGwoRmVuuixu7sv92ZkdQcPbsNHzutd+rAfaBKo8YK3IrBEi9SLLKWJdEvJniQ==", "cpu": [ "x64" ], @@ -353,13 +353,13 @@ "darwin" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", - "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.0.tgz", + "integrity": "sha512-0muYWCng5vqaxobq6LB3YNtevDFSAZGlgtLoAc81PjUfiFz36n4KMpwhtAd4he8ToSI3TGyuhyx5xmiWNYZFyw==", "cpu": [ "arm64" ], @@ -369,13 +369,13 @@ "freebsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", - "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.0.tgz", + "integrity": "sha512-XKDVu8IsD0/q3foBzsXGt/KjD/yTKBCIwOHE1XwiXmrRwrX6Hbnd5Eqn/WvDekddK21tfszBSrE/WMaZh+1buQ==", "cpu": [ "x64" ], @@ -385,13 +385,13 @@ "freebsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", - "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.0.tgz", + "integrity": "sha512-SEELSTEtOFu5LPykzA395Mc+54RMg1EUgXP+iw2SJ72+ooMwVsgfuwXo5Fn0wXNgWZsTVHwY2cg4Vi/bOD88qw==", "cpu": [ "arm" ], @@ -401,13 +401,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", - "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.0.tgz", + "integrity": "sha512-j1t5iG8jE7BhonbsEg5d9qOYcVZv/Rv6tghaXM/Ug9xahM0nX/H2gfu6X6z11QRTMT6+aywOMA8TDkhPo8aCGw==", "cpu": [ "arm64" ], @@ -417,13 +417,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", - "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.0.tgz", + "integrity": "sha512-P7O5Tkh2NbgIm2R6x1zGJJsnacDzTFcRWZyTTMgFdVit6E98LTxO+v8LCCLWRvPrjdzXHx9FEOA8oAZPyApWUA==", "cpu": [ "ia32" ], @@ -433,13 +433,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", - "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.0.tgz", + "integrity": "sha512-InQwepswq6urikQiIC/kkx412fqUZudBO4SYKu0N+tGhXRWUqAx+Q+341tFV6QdBifpjYgUndV1hhMq3WeJi7A==", "cpu": [ "loong64" ], @@ -449,13 +449,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", - "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.0.tgz", + "integrity": "sha512-J9rflLtqdYrxHv2FqXE2i1ELgNjT+JFURt/uDMoPQLcjWQA5wDKgQA4t/dTqGa88ZVECKaD0TctwsUfHbVoi4w==", "cpu": [ "mips64el" ], @@ -465,13 +465,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", - "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.0.tgz", + "integrity": "sha512-cShCXtEOVc5GxU0fM+dsFD10qZ5UpcQ8AM22bYj0u/yaAykWnqXJDpd77ublcX6vdDsWLuweeuSNZk4yUxZwtw==", "cpu": [ "ppc64" ], @@ -481,13 +481,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", - "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.0.tgz", + "integrity": "sha512-HEtaN7Y5UB4tZPeQmgz/UhzoEyYftbMXrBCUjINGjh3uil+rB/QzzpMshz3cNUxqXN7Vr93zzVtpIDL99t9aRw==", "cpu": [ "riscv64" ], @@ -497,13 +497,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", - "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.0.tgz", + "integrity": "sha512-WDi3+NVAuyjg/Wxi+o5KPqRbZY0QhI9TjrEEm+8dmpY9Xir8+HE/HNx2JoLckhKbFopW0RdO2D72w8trZOV+Wg==", "cpu": [ "s390x" ], @@ -513,13 +513,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", - "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.0.tgz", + "integrity": "sha512-a3pMQhUEJkITgAw6e0bWA+F+vFtCciMjW/LPtoj99MhVt+Mfb6bbL9hu2wmTZgNd994qTAEw+U/r6k3qHWWaOQ==", "cpu": [ "x64" ], @@ -529,13 +529,13 @@ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", - "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.0.tgz", + "integrity": "sha512-cRK+YDem7lFTs2Q5nEv/HHc4LnrfBCbH5+JHu6wm2eP+d8OZNoSMYgPZJq78vqQ9g+9+nMuIsAO7skzphRXHyw==", "cpu": [ "x64" ], @@ -545,13 +545,29 @@ "netbsd" ], "engines": { - "node": ">=12" + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.0.tgz", + "integrity": "sha512-suXjq53gERueVWu0OKxzWqk7NxiUWSUlrxoZK7usiF50C6ipColGR5qie2496iKGYNLhDZkPxBI3erbnYkU0rQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", - "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.0.tgz", + "integrity": "sha512-6p3nHpby0DM/v15IFKMjAaayFhqnXV52aEmv1whZHX56pdkK+MEaLoQWj+H42ssFarP1PcomVhbsR4pkz09qBg==", "cpu": [ "x64" ], @@ -561,13 +577,13 @@ "openbsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", - "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.0.tgz", + "integrity": "sha512-BFelBGfrBwk6LVrmFzCq1u1dZbG4zy/Kp93w2+y83Q5UGYF1d8sCzeLI9NXjKyujjBBniQa8R8PzLFAUrSM9OA==", "cpu": [ "x64" ], @@ -577,13 +593,13 @@ "sunos" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", - "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.0.tgz", + "integrity": "sha512-lY6AC8p4Cnb7xYHuIxQ6iYPe6MfO2CC43XXKo9nBXDb35krYt7KGhQnOkRGar5psxYkircpCqfbNDB4uJbS2jQ==", "cpu": [ "arm64" ], @@ -593,13 +609,13 @@ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", - "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.0.tgz", + "integrity": "sha512-7L1bHlOTcO4ByvI7OXVI5pNN6HSu6pUQq9yodga8izeuB1KcT2UkHaH6118QJwopExPn0rMHIseCTx1CRo/uNA==", "cpu": [ "ia32" ], @@ -609,13 +625,13 @@ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", - "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.0.tgz", + "integrity": "sha512-Arm+WgUFLUATuoxCJcahGuk6Yj9Pzxd6l11Zb/2aAuv5kWWvvfhLFo2fni4uSK5vzlUdCGZ/BdV5tH8klj8p8g==", "cpu": [ "x64" ], @@ -625,7 +641,7 @@ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@eslint-community/eslint-utils": { @@ -718,12 +734,12 @@ "dev": true }, "node_modules/@microsoft/kiota-abstractions": { - "version": "1.0.0-preview.56", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.56.tgz", - "integrity": "sha512-mVrmuCvD9V/h19/cwXDQFPEObq5ipM+HK39rhvXe1EsaBjHdbmIaiiVJMNNy9ZRKSniUreb5f12ailomLrWATA==", + "version": "1.0.0-preview.57", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.57.tgz", + "integrity": "sha512-U6rIiel+39XfljrLzWU3vsgkYExHOodJuuIEwqvKZd6rqaAXOLJHq/AR78Gu48ySy5KRXOEgtfRnRMsJpr04fA==", "dependencies": { "@opentelemetry/api": "^1.7.0", - "@std-uritemplate/std-uritemplate": "^0.0.59", + "@std-uritemplate/std-uritemplate": "^1.0.1", "guid-typescript": "^1.0.9", "tinyduration": "^3.3.0", "tslib": "^2.6.2", @@ -743,9 +759,9 @@ } }, "node_modules/@microsoft/kiota-authentication-azure": { - "version": "1.0.0-preview.51", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.51.tgz", - "integrity": "sha512-1YHZO4F5bsy5Ug6KQZUtpo7zRPJkIl4Gd1n9rOuadbZuh26usDhB2ymfxqS/MA5YM3XN4aw/AnCTsWVfdVg/NA==", + "version": "1.0.0-preview.52", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.52.tgz", + "integrity": "sha512-eEjS5zY30e4vDBnvaXNagKkReAmqLktVstLEEk5vSFea1kOq0NW5+V0DORnfIEGsa4vSX8vYAVyIpeswZ6HVzQ==", "dependencies": { "@azure/core-auth": "^1.5.0", "@microsoft/kiota-abstractions": "*", @@ -754,9 +770,9 @@ } }, "node_modules/@microsoft/kiota-http-fetchlibrary": { - "version": "1.0.0-preview.55", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.55.tgz", - "integrity": "sha512-5AGHsXc3FNW5Vwf1cz3ON65ZmnW8ZHatRgZRWzT0LjeGGFiKz/3CNKVgYG1Xudk5w7JwuM1DO9VAlqfw8uiHqQ==", + "version": "1.0.0-preview.56", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.56.tgz", + "integrity": "sha512-J2OkBBPMSzw24e6cZoBwymvrqhF5YoPIPRYmCDQvTGjRwV3VbAMmJIc0oxWYA2yj+i8Opp2D4X7nTly4hckFEw==", "dependencies": { "@microsoft/kiota-abstractions": "*", "@opentelemetry/api": "^1.7.0", @@ -765,9 +781,9 @@ } }, "node_modules/@microsoft/kiota-serialization-form": { - "version": "1.0.0-preview.45", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.45.tgz", - "integrity": "sha512-UnYECyOCCq5Rr+EtKRo/MSY+7r+M7ZoCMUvKX5jAP3b3cpkKy33wSi269SlFxh7ibNmjWB1tnDENuu+iVC4H9w==", + "version": "1.0.0-preview.46", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.46.tgz", + "integrity": "sha512-0DpWPkUbzyuxxlaGvIbuRbK44CpIW1c28kS0zHUKBN5PBbhAojBQd3zEK0L0IUVcF8FABADdSGklHQ16J8v2vg==", "dependencies": { "@microsoft/kiota-abstractions": "*", "guid-typescript": "^1.0.9", @@ -775,9 +791,9 @@ } }, "node_modules/@microsoft/kiota-serialization-json": { - "version": "1.0.0-preview.56", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.56.tgz", - "integrity": "sha512-PKQ9xJP7sj+kWFZVkF9TDlsoYA7BDP+4SNq4+A5Dod0qxi2pdb3UoBZUMLr8DENaaKWStQpNpx2+Yad8wJlxxw==", + "version": "1.0.0-preview.57", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.57.tgz", + "integrity": "sha512-P0fiHMfLV4qVyxcvEGGBWaGv1bwfZ+SAhw+9gYR53UBZZiIdW182cykbE3hSD2Xd0kolSrYseNrYO4U7GI873Q==", "dependencies": { "@microsoft/kiota-abstractions": "*", "guid-typescript": "^1.0.9", @@ -785,9 +801,9 @@ } }, "node_modules/@microsoft/kiota-serialization-multipart": { - "version": "1.0.0-preview.34", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.34.tgz", - "integrity": "sha512-dPkIXIdnO5SACdKyAh3HYsuvFJ2I1L/Z0BUnzv9gGGQW8h8DsFi3J1HEYsahhD7en35WWCSKVzESe+aWtp9hDw==", + "version": "1.0.0-preview.35", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.35.tgz", + "integrity": "sha512-YuHBp40D9KT4ijawm77I3YftxBuG5u1dl0GAm6tyHGjXSxHt/HRgjMy92dnOnDeGCTSUXwoCe1Ut2zBoHwi2FQ==", "dependencies": { "@microsoft/kiota-abstractions": "*", "guid-typescript": "^1.0.9", @@ -795,9 +811,9 @@ } }, "node_modules/@microsoft/kiota-serialization-text": { - "version": "1.0.0-preview.53", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.53.tgz", - "integrity": "sha512-W6BwkmvL85pLxmY38o60vc2RtBDatSeT4x/MJEAXkVZCpIkXh0p0Pe/Fiy3xkyvRNdHTUbklz5wpw1shLucleg==", + "version": "1.0.0-preview.54", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.54.tgz", + "integrity": "sha512-UCa0fTROYkB3vgUILCAwfPmDjEiy3lFwh6STQ6Cg7wGRY4sRIW1dzct6GtjP0jiRCs8UJwL9q5SfyzvKYit5qw==", "dependencies": { "@microsoft/kiota-abstractions": "*", "guid-typescript": "^1.0.9", @@ -848,9 +864,9 @@ } }, "node_modules/@std-uritemplate/std-uritemplate": { - "version": "0.0.59", - "resolved": "https://registry.npmjs.org/@std-uritemplate/std-uritemplate/-/std-uritemplate-0.0.59.tgz", - "integrity": "sha512-S9RcLJbm9ZgrHGZ//iDPH3T2pssGC5ae+jugRsKTooubZ9VjZc4W3sH+kBAh5rQY+D/mC6pWmFQrY3oIPtSPiw==" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@std-uritemplate/std-uritemplate/-/std-uritemplate-1.0.2.tgz", + "integrity": "sha512-35k/Nn+wlqkOf9AxIlhOA19mndrUMDspRuV3lO/9IgqKk0W7b8LwuWup5bGt4wZ1sCZij/lDTQMTY9WKTKrusg==" }, "node_modules/@types/json-schema": { "version": "7.0.15", @@ -859,9 +875,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.14.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", - "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", + "version": "20.14.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.10.tgz", + "integrity": "sha512-MdiXf+nDuMvY0gJKxyfZ7/6UFsETO7mGKF54MVD/ekJS6HdFtpZFBgrh6Pseu64XTb2MLyFPlbW6hj8HYRQNOQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -1614,41 +1630,42 @@ } }, "node_modules/esbuild": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", - "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.0.tgz", + "integrity": "sha512-1lvV17H2bMYda/WaFb2jLPeHU3zml2k4/yagNMG8Q/YtfMjCwEUZa2eXXMgZTVSL5q1n4H7sQ0X6CdJDqqeCFA==", "dev": true, "hasInstallScript": true, "bin": { "esbuild": "bin/esbuild" }, "engines": { - "node": ">=12" + "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.21.5", - "@esbuild/android-arm": "0.21.5", - "@esbuild/android-arm64": "0.21.5", - "@esbuild/android-x64": "0.21.5", - "@esbuild/darwin-arm64": "0.21.5", - "@esbuild/darwin-x64": "0.21.5", - "@esbuild/freebsd-arm64": "0.21.5", - "@esbuild/freebsd-x64": "0.21.5", - "@esbuild/linux-arm": "0.21.5", - "@esbuild/linux-arm64": "0.21.5", - "@esbuild/linux-ia32": "0.21.5", - "@esbuild/linux-loong64": "0.21.5", - "@esbuild/linux-mips64el": "0.21.5", - "@esbuild/linux-ppc64": "0.21.5", - "@esbuild/linux-riscv64": "0.21.5", - "@esbuild/linux-s390x": "0.21.5", - "@esbuild/linux-x64": "0.21.5", - "@esbuild/netbsd-x64": "0.21.5", - "@esbuild/openbsd-x64": "0.21.5", - "@esbuild/sunos-x64": "0.21.5", - "@esbuild/win32-arm64": "0.21.5", - "@esbuild/win32-ia32": "0.21.5", - "@esbuild/win32-x64": "0.21.5" + "@esbuild/aix-ppc64": "0.23.0", + "@esbuild/android-arm": "0.23.0", + "@esbuild/android-arm64": "0.23.0", + "@esbuild/android-x64": "0.23.0", + "@esbuild/darwin-arm64": "0.23.0", + "@esbuild/darwin-x64": "0.23.0", + "@esbuild/freebsd-arm64": "0.23.0", + "@esbuild/freebsd-x64": "0.23.0", + "@esbuild/linux-arm": "0.23.0", + "@esbuild/linux-arm64": "0.23.0", + "@esbuild/linux-ia32": "0.23.0", + "@esbuild/linux-loong64": "0.23.0", + "@esbuild/linux-mips64el": "0.23.0", + "@esbuild/linux-ppc64": "0.23.0", + "@esbuild/linux-riscv64": "0.23.0", + "@esbuild/linux-s390x": "0.23.0", + "@esbuild/linux-x64": "0.23.0", + "@esbuild/netbsd-x64": "0.23.0", + "@esbuild/openbsd-arm64": "0.23.0", + "@esbuild/openbsd-x64": "0.23.0", + "@esbuild/sunos-x64": "0.23.0", + "@esbuild/win32-arm64": "0.23.0", + "@esbuild/win32-ia32": "0.23.0", + "@esbuild/win32-x64": "0.23.0" } }, "node_modules/escape-html": { diff --git a/it/typescript/package.json b/it/typescript/package.json index 0477862b19..e89b3b589c 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -19,10 +19,10 @@ "prettier": "./.prettierrc.json", "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.14.9", + "@types/node": "^20.14.10", "@typescript-eslint/eslint-plugin": "^7.7.1", "@typescript-eslint/parser": "^7.8.0", - "esbuild": "^0.21.5", + "esbuild": "^0.23.0", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "minimist": "^1.2.8", @@ -31,13 +31,13 @@ }, "dependencies": { "@azure/identity": "^4.3.0", - "@microsoft/kiota-abstractions": "^1.0.0-preview.56", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.51", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.55", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.45", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.56", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.34", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.53", + "@microsoft/kiota-abstractions": "^1.0.0-preview.57", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.52", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.56", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.46", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.57", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.35", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.54", "express": "^4.19.2", "node-fetch": "^2.7.0" } diff --git a/src/Kiota.Builder/Configuration/GenerationConfiguration.cs b/src/Kiota.Builder/Configuration/GenerationConfiguration.cs index 7200211e63..1f9de43628 100644 --- a/src/Kiota.Builder/Configuration/GenerationConfiguration.cs +++ b/src/Kiota.Builder/Configuration/GenerationConfiguration.cs @@ -197,7 +197,7 @@ private string NormalizeDescriptionLocation(string targetDirectory) !OpenAPIFilePath.StartsWith("http", StringComparison.OrdinalIgnoreCase) && Path.IsPathRooted(OpenAPIFilePath) && Path.GetFullPath(OpenAPIFilePath).StartsWith(Path.GetFullPath(targetDirectory), StringComparison.Ordinal)) - return "./" + Path.GetRelativePath(targetDirectory, OpenAPIFilePath); + return "./" + Path.GetRelativePath(targetDirectory, OpenAPIFilePath).NormalizePathSeparators(); return OpenAPIFilePath; } public bool IsPluginConfiguration => PluginTypes.Count != 0; diff --git a/src/Kiota.Builder/Extensions/StringExtensions.cs b/src/Kiota.Builder/Extensions/StringExtensions.cs index 1eb95f5f9d..1c66ed83d3 100644 --- a/src/Kiota.Builder/Extensions/StringExtensions.cs +++ b/src/Kiota.Builder/Extensions/StringExtensions.cs @@ -299,4 +299,10 @@ public static string GetFileExtension(this string path) if (string.IsNullOrEmpty(path)) return string.Empty; return Path.GetExtension(path).TrimStart('.'); } + public static string NormalizePathSeparators(this string path) + { + if (string.IsNullOrEmpty(path)) return string.Empty; + if (Path.DirectorySeparatorChar != '/') return path.Replace(Path.DirectorySeparatorChar, '/'); + return path; + } } diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 4d3aec1bdb..e0ee11755c 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Kiota.Builder Microsoft.OpenApi.Kiota.Builder ./nupkg - 1.16.0 + 1.17.0 $(VersionSuffix) https://github.com/microsoft/kiota/releases diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 226e831e78..f3535b3cf0 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -432,7 +432,10 @@ internal void SetApiRootUrl() if (openApiDocument is not null && openApiDocument.GetAPIRootUrl(config.OpenAPIFilePath) is string candidateUrl) { config.ApiRootUrl = candidateUrl; - logger.LogInformation("Client root URL set to {ApiRootUrl}", candidateUrl); + if (!config.IsPluginConfiguration) + { + logger.LogInformation("Client root URL set to {ApiRootUrl}", candidateUrl); + } } else logger.LogWarning("No server url found in the OpenAPI document. The base url will need to be set when using the client."); diff --git a/src/Kiota.Builder/Lock/KiotaLock.cs b/src/Kiota.Builder/Lock/KiotaLock.cs index 433861a2fa..a5d38c2fc4 100644 --- a/src/Kiota.Builder/Lock/KiotaLock.cs +++ b/src/Kiota.Builder/Lock/KiotaLock.cs @@ -70,11 +70,11 @@ public bool DisableSSLValidation /// /// The serializers used for this client. /// - public HashSet Serializers { get; set; } = new(); + public HashSet Serializers { get; set; } = new(StringComparer.OrdinalIgnoreCase); /// /// The deserializers used for this client. /// - public HashSet Deserializers { get; set; } = new(); + public HashSet Deserializers { get; set; } = new(StringComparer.OrdinalIgnoreCase); /// /// The structured mime types used for this client. /// @@ -84,15 +84,15 @@ public bool DisableSSLValidation /// /// The path patterns for API endpoints to include for this client. /// - public HashSet IncludePatterns { get; set; } = new(); + public HashSet IncludePatterns { get; set; } = new(StringComparer.OrdinalIgnoreCase); /// /// The path patterns for API endpoints to exclude for this client. /// - public HashSet ExcludePatterns { get; set; } = new(); + public HashSet ExcludePatterns { get; set; } = new(StringComparer.OrdinalIgnoreCase); /// /// The OpenAPI validation rules to disable during the generation. /// - public HashSet DisabledValidationRules { get; set; } = new(); + public HashSet DisabledValidationRules { get; set; } = new(StringComparer.OrdinalIgnoreCase); #pragma warning restore CA2227 /// /// Updates the passed configuration with the values from the lock file. @@ -108,13 +108,13 @@ public void UpdateGenerationConfigurationFromLock(GenerationConfiguration config config.UsesBackingStore = UsesBackingStore; config.ExcludeBackwardCompatible = ExcludeBackwardCompatible; config.IncludeAdditionalData = IncludeAdditionalData; - config.Serializers = Serializers; - config.Deserializers = Deserializers; + config.Serializers = Serializers.ToHashSet(StringComparer.OrdinalIgnoreCase); + config.Deserializers = Deserializers.ToHashSet(StringComparer.OrdinalIgnoreCase); config.StructuredMimeTypes = new(StructuredMimeTypes); - config.IncludePatterns = IncludePatterns; - config.ExcludePatterns = ExcludePatterns; + config.IncludePatterns = IncludePatterns.ToHashSet(StringComparer.OrdinalIgnoreCase); + config.ExcludePatterns = ExcludePatterns.ToHashSet(StringComparer.OrdinalIgnoreCase); config.OpenAPIFilePath = DescriptionLocation; - config.DisabledValidationRules = DisabledValidationRules; + config.DisabledValidationRules = DisabledValidationRules.ToHashSet(StringComparer.OrdinalIgnoreCase); config.DisableSSLValidation = DisableSSLValidation; } /// @@ -136,13 +136,13 @@ public KiotaLock(GenerationConfiguration config) UsesBackingStore = config.UsesBackingStore; ExcludeBackwardCompatible = config.ExcludeBackwardCompatible; IncludeAdditionalData = config.IncludeAdditionalData; - Serializers = config.Serializers; - Deserializers = config.Deserializers; + Serializers = config.Serializers.ToHashSet(StringComparer.OrdinalIgnoreCase); + Deserializers = config.Deserializers.ToHashSet(StringComparer.OrdinalIgnoreCase); StructuredMimeTypes = config.StructuredMimeTypes.ToList(); - IncludePatterns = config.IncludePatterns; - ExcludePatterns = config.ExcludePatterns; + IncludePatterns = config.IncludePatterns.ToHashSet(StringComparer.OrdinalIgnoreCase); + ExcludePatterns = config.ExcludePatterns.ToHashSet(StringComparer.OrdinalIgnoreCase); DescriptionLocation = config.OpenAPIFilePath; - DisabledValidationRules = config.DisabledValidationRules; + DisabledValidationRules = config.DisabledValidationRules.ToHashSet(StringComparer.OrdinalIgnoreCase); DisableSSLValidation = config.DisableSSLValidation; } } diff --git a/src/Kiota.Builder/Lock/LockManagementService.cs b/src/Kiota.Builder/Lock/LockManagementService.cs index db4a17c30d..b35c2ba12f 100644 --- a/src/Kiota.Builder/Lock/LockManagementService.cs +++ b/src/Kiota.Builder/Lock/LockManagementService.cs @@ -7,6 +7,7 @@ using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Kiota.Builder.Extensions; namespace Kiota.Builder.Lock; @@ -83,7 +84,7 @@ private static string GetRelativeDescriptionPath(string descriptionPath, string { if (IsDescriptionLocal(descriptionPath) && Path.GetDirectoryName(lockFilePath) is string lockFileDirectoryPath) - return Path.GetRelativePath(lockFileDirectoryPath, descriptionPath); + return Path.GetRelativePath(lockFileDirectoryPath, descriptionPath).NormalizePathSeparators(); return descriptionPath; } /// diff --git a/src/Kiota.Builder/PathSegmenters/GoPathSegmenter.cs b/src/Kiota.Builder/PathSegmenters/GoPathSegmenter.cs index 90306fab87..c13a48e7d9 100644 --- a/src/Kiota.Builder/PathSegmenters/GoPathSegmenter.cs +++ b/src/Kiota.Builder/PathSegmenters/GoPathSegmenter.cs @@ -85,7 +85,7 @@ public override string NormalizeFileName(CodeElement currentElement) return currentElement switch { CodeNamespace => "go", - _ => GetLastFileNameSegment(currentElement).ToSnakeCase().EscapeSuffix(specialFileNameSuffixes).ShortenFileName(), + _ => GetLastFileNameSegment(currentElement).ToSnakeCase().EscapeSuffix(specialFileNameSuffixes).ShortenFileName(100), }; } public override string NormalizeNamespaceSegment(string segmentName) => segmentName?.ToLowerInvariant() ?? string.Empty; diff --git a/src/Kiota.Builder/Plugins/Models/AppManifestModel.cs b/src/Kiota.Builder/Plugins/Models/AppManifestModel.cs new file mode 100644 index 0000000000..d277469cb4 --- /dev/null +++ b/src/Kiota.Builder/Plugins/Models/AppManifestModel.cs @@ -0,0 +1,175 @@ +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Kiota.Builder.Plugins.Models; + +internal class AppManifestModel +{ + private const string DefaultSchema = "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json"; + private const string DefaultManifestVersion = "devPreview"; + private const string DefaultVersion = "1.0.0"; + + [JsonPropertyName("$schema")] + public string? Schema + { + get; + set; + } = DefaultSchema; + + public string? ManifestVersion + { + get; + set; + } = DefaultManifestVersion; + + public string? Version + { + get; + set; + } = DefaultVersion; + public string? Id + { + get; set; + } + public Developer? Developer + { + get; init; + } + public string? PackageName + { + get; set; + } + public Name? Name + { + get; set; + } + public Description? Description + { + get; set; + } + public Icons? Icons + { + get; set; + } + public string? AccentColor + { + get; set; + } + public CopilotExtensions? CopilotExtensions + { + get; set; + } + + [JsonExtensionData] + public Dictionary AdditionalData { get; set; } = new(); +} + +[JsonSerializable(typeof(AppManifestModel))] +[JsonSerializable(typeof(JsonElement))] +internal partial class AppManifestModelGenerationContext : JsonSerializerContext +{ +} + +#pragma warning disable CA1054 +internal class Developer +#pragma warning restore CA1054 +{ + public string? Name + { + get; set; + } +#pragma warning disable CA1056 + public string? WebsiteUrl + { + get; set; + } + public string? PrivacyUrl + { + get; set; + } + public string? TermsOfUseUrl + { + get; set; + } +#pragma warning restore CA1056 + + [JsonExtensionData] + public Dictionary AdditionalData { get; set; } = new(); +} + +internal class Name +{ + [JsonPropertyName("short")] + public string? ShortName + { + get; set; + } + [JsonPropertyName("full")] + public string? FullName + { + get; set; + } +} + +internal class Description +{ + [JsonPropertyName("short")] + public string? ShortName + { + get; set; + } + [JsonPropertyName("full")] + public string? FullName + { + get; set; + } +} + +internal class Icons +{ + public string? Color + { + get; + set; + } = "color.png"; + + public string? Outline + { + get; + set; + } = "outline.png"; +} + +internal class CopilotExtensions +{ + public IList Plugins { get; set; } = []; + public IList DeclarativeCopilots { get; set; } = []; + [JsonExtensionData] + public Dictionary AdditionalData { get; set; } = new(); +} + +internal class Plugin +{ + public string? Id + { + get; set; + } + public string? File + { + get; set; + } +} + +internal class DeclarativeCopilot +{ + public string? Id + { + get; set; + } + public string? File + { + get; set; + } +} diff --git a/src/Kiota.Builder/Plugins/PluginsGenerationService.cs b/src/Kiota.Builder/Plugins/PluginsGenerationService.cs index 026f14b47f..0e38aa92b9 100644 --- a/src/Kiota.Builder/Plugins/PluginsGenerationService.cs +++ b/src/Kiota.Builder/Plugins/PluginsGenerationService.cs @@ -3,11 +3,13 @@ using System.IO; using System.Linq; using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; using Kiota.Builder.Configuration; using Kiota.Builder.Extensions; using Kiota.Builder.OpenApiExtensions; +using Kiota.Builder.Plugins.Models; using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.OpenApi.ApiManifest; using Microsoft.OpenApi.Models; @@ -38,9 +40,10 @@ public PluginsGenerationService(OpenApiDocument document, OpenApiUrlTreeNode ope private const string ManifestFileNameSuffix = ".json"; private const string DescriptionPathSuffix = "openapi.yml"; private const string OpenAIManifestFileName = "openai-plugins"; + private const string AppManifestFileName = "manifest.json"; public async Task GenerateManifestAsync(CancellationToken cancellationToken = default) { - // write the description + // 1. write the OpenApi description var descriptionRelativePath = $"{Configuration.ClientClassName.ToLowerInvariant()}-{DescriptionPathSuffix}"; var descriptionFullPath = Path.Combine(Configuration.OutputPath, descriptionRelativePath); var directory = Path.GetDirectoryName(descriptionFullPath); @@ -55,7 +58,8 @@ public async Task GenerateManifestAsync(CancellationToken cancellationToken = de trimmedPluginDocument.SerializeAsV3(descriptionWriter); descriptionWriter.Flush(); - // write the plugins + // 2. write the plugins + foreach (var pluginType in Configuration.PluginTypes) { var manifestFileName = pluginType == PluginType.OpenAI ? OpenAIManifestFileName : $"{Configuration.ClientClassName.ToLowerInvariant()}-{pluginType.ToString().ToLowerInvariant()}"; @@ -93,8 +97,84 @@ public async Task GenerateManifestAsync(CancellationToken cancellationToken = de } await writer.FlushAsync(cancellationToken).ConfigureAwait(false); } + + // 3. write the app manifest if its an Api Plugin + if (Configuration.PluginTypes.Any(static plugin => plugin == PluginType.APIPlugin)) + { + var manifestFullPath = Path.Combine(Configuration.OutputPath, AppManifestFileName); + var pluginFileName = $"{Configuration.ClientClassName.ToLowerInvariant()}-{PluginType.APIPlugin.ToString().ToLowerInvariant()}{ManifestFileNameSuffix}"; + var appManifestModel = await GetAppManifestModelAsync(pluginFileName, manifestFullPath, cancellationToken).ConfigureAwait(false); +#pragma warning disable CA2007 + await using var appManifestStream = File.Open(manifestFullPath, FileMode.Create); +#pragma warning restore CA2007 + await JsonSerializer.SerializeAsync(appManifestStream, appManifestModel, AppManifestModelGenerationContext.AppManifestModel, cancellationToken).ConfigureAwait(false); + } + } + + private async Task GetAppManifestModelAsync(string pluginFileName, string manifestFullPath, CancellationToken cancellationToken) + { + var manifestInfo = ExtractInfoFromDocument(OAIDocument.Info); + // create default model + var manifestModel = new AppManifestModel + { + Id = Guid.NewGuid().ToString(), + Developer = new Developer + { + Name = !string.IsNullOrEmpty(OAIDocument.Info?.Contact?.Name) ? OAIDocument.Info?.Contact?.Name : "Microsoft Kiota.", + WebsiteUrl = !string.IsNullOrEmpty(OAIDocument.Info?.Contact?.Url?.OriginalString) ? OAIDocument.Info?.Contact?.Url?.OriginalString : "https://www.example.com/contact/", + PrivacyUrl = !string.IsNullOrEmpty(manifestInfo.PrivacyUrl) ? manifestInfo.PrivacyUrl : "https://www.example.com/privacy/", + TermsOfUseUrl = !string.IsNullOrEmpty(OAIDocument.Info?.TermsOfService?.OriginalString) ? OAIDocument.Info?.TermsOfService?.OriginalString : "https://www.example.com/terms/", + }, + PackageName = $"com.microsoft.kiota.plugin.{Configuration.ClientClassName}", + Name = new Name + { + ShortName = Configuration.ClientClassName, + FullName = $"API Plugin {Configuration.ClientClassName} for {OAIDocument.Info?.Title.CleanupXMLString() ?? "OpenApi Document"}" + }, + Description = new Description + { + ShortName = !string.IsNullOrEmpty(OAIDocument.Info?.Description.CleanupXMLString()) ? $"API Plugin for {OAIDocument.Info?.Description.CleanupXMLString()}." : OAIDocument.Info?.Title.CleanupXMLString() ?? "OpenApi Document", + FullName = !string.IsNullOrEmpty(OAIDocument.Info?.Description.CleanupXMLString()) ? $"API Plugin for {OAIDocument.Info?.Description.CleanupXMLString()}." : OAIDocument.Info?.Title.CleanupXMLString() ?? "OpenApi Document" + }, + Icons = new Icons(), + AccentColor = "#FFFFFF" + }; + + if (File.Exists(manifestFullPath)) // No need for default, try to update the model from the file + { +#pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task + await using var fileStream = File.OpenRead(manifestFullPath); +#pragma warning restore CA2007 // Consider calling ConfigureAwait on the awaited task + var manifestModelFromFile = await JsonSerializer.DeserializeAsync(fileStream, AppManifestModelGenerationContext.AppManifestModel, cancellationToken).ConfigureAwait(false); + if (manifestModelFromFile != null) + manifestModel = manifestModelFromFile; + } + + manifestModel.CopilotExtensions ??= new CopilotExtensions();// ensure its not null. + + if (manifestModel.CopilotExtensions.Plugins.FirstOrDefault(pluginItem => Configuration.ClientClassName.Equals(pluginItem.Id, StringComparison.OrdinalIgnoreCase)) is { } plugin) + { + plugin.File = pluginFileName; // id is already consitent so make sure the file name is ok + } + else + { + // Add a new plugin entry + manifestModel.CopilotExtensions.Plugins.Add(new Plugin + { + File = pluginFileName, + Id = Configuration.ClientClassName + }); + } + + return manifestModel; } + internal static readonly AppManifestModelGenerationContext AppManifestModelGenerationContext = new(new JsonSerializerOptions + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + WriteIndented = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull + }); private OpenApiDocument GetDocumentWithTrimmedComponentsAndResponses(OpenApiDocument doc) { diff --git a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs index b4073dc385..3bff4b8ff3 100644 --- a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs +++ b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs @@ -294,7 +294,9 @@ protected static void ReplaceReservedExceptionPropertyNames(CodeElement current, provider, replacement, null, - static x => ((x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Custom)) || x is CodeMethod) && x.Parent is CodeClass parent && parent.IsOfKind(CodeClassKind.Model) && parent.IsErrorDefinition + x => (((x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Custom)) || x is CodeMethod) && x.Parent is CodeClass parent && parent.IsOfKind(CodeClassKind.Model) && parent.IsErrorDefinition) // rename properties or method of error classes matching the reserved names. + || (x is CodeClass codeClass && codeClass.IsOfKind(CodeClassKind.Model) && codeClass.IsErrorDefinition + && codeClass.Properties.FirstOrDefault(classProp => provider.ReservedNames.Contains(classProp.Name)) is { } matchingProperty && matchingProperty.Name.Equals(codeClass.Name, StringComparison.OrdinalIgnoreCase)) // rename the a class if it has a matching property and the class has the same name as the property. ); } protected static void ReplaceReservedNames(CodeElement current, IReservedNamesProvider provider, Func replacement, HashSet? codeElementExceptions = null, Func? shouldReplaceCallback = null) @@ -1507,6 +1509,14 @@ internal static void AddPrimaryErrorMessage(CodeElement currentElement, string n { if (asProperty) { + if (currentClass.Properties.FirstOrDefault(property => property.Name.Equals(name, StringComparison.OrdinalIgnoreCase)) is { } sameNameProperty) + { + if (sameNameProperty.Type.Name.Equals(type().Name, StringComparison.OrdinalIgnoreCase)) + currentClass.RemoveChildElementByName(name); // type matches so just remove it for replacement + else + currentClass.RenameChildElement(name, $"{name}Escaped"); // type mismatch so just rename it + } + currentClass.AddProperty(new CodeProperty { Name = name, diff --git a/src/Kiota.Builder/Refiners/GoRefiner.cs b/src/Kiota.Builder/Refiners/GoRefiner.cs index 113d1399c7..555f28350d 100644 --- a/src/Kiota.Builder/Refiners/GoRefiner.cs +++ b/src/Kiota.Builder/Refiners/GoRefiner.cs @@ -19,7 +19,6 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance { cancellationToken.ThrowIfCancellationRequested(); DeduplicateErrorMappings(generatedCode); - NormalizeNamespaceNames(generatedCode); MoveRequestBuilderPropertiesToBaseType(generatedCode, new CodeUsing { @@ -40,6 +39,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance FlattenNestedHierarchy(generatedCode); FlattenGoParamsFileNames(generatedCode); FlattenGoFileNames(generatedCode); + NormalizeNamespaceNames(generatedCode); AddInnerClasses( generatedCode, true, diff --git a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs index 5e6c9673ca..92a5618a92 100644 --- a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs +++ b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs @@ -528,7 +528,8 @@ private static bool HasMultipartBody(CodeMethod m) => AbstractionsPackageName, true, "BackingStore", "BackedModel"), new (static x => x is CodeMethod m && HasMultipartBody(m), AbstractionsPackageName, MultipartBodyClassName, $"serialize{MultipartBodyClassName}"), - new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Custom) && prop.Type.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase), + new (static x => (x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.Custom) && prop.Type.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase)) + || (x is CodeMethod method && (method.Parameters.Any(param => param.Type.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase)) || method.ReturnType.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase))), AbstractionsPackageName, KiotaBuilder.UntypedNodeName, "createUntypedNodeFromDiscriminatorValue"), }; private const string MultipartBodyClassName = "MultipartBody"; diff --git a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs index ede1bb7db7..a8441571fd 100644 --- a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs +++ b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs @@ -48,7 +48,7 @@ public bool ExcludeBackwardCompatible /// /// The OpenAPI validation rules to disable during the generation. /// - public HashSet DisabledValidationRules { get; set; } = new(); + public HashSet DisabledValidationRules { get; set; } = new(StringComparer.OrdinalIgnoreCase); /// /// Initializes a new instance of the class. /// @@ -69,7 +69,7 @@ public ApiClientConfiguration(GenerationConfiguration config) : base(config) ExcludeBackwardCompatible = config.ExcludeBackwardCompatible; IncludeAdditionalData = config.IncludeAdditionalData; StructuredMimeTypes = config.StructuredMimeTypes.ToList(); - DisabledValidationRules = config.DisabledValidationRules; + DisabledValidationRules = config.DisabledValidationRules.ToHashSet(StringComparer.OrdinalIgnoreCase); } /// /// Updates the passed configuration with the values from the config file. @@ -88,7 +88,7 @@ public void UpdateGenerationConfigurationFromApiClientConfiguration(GenerationCo config.ExcludeBackwardCompatible = ExcludeBackwardCompatible; config.IncludeAdditionalData = IncludeAdditionalData; config.StructuredMimeTypes = new(StructuredMimeTypes); - config.DisabledValidationRules = DisabledValidationRules; + config.DisabledValidationRules = DisabledValidationRules.ToHashSet(StringComparer.OrdinalIgnoreCase); UpdateGenerationConfigurationFromBase(config, clientName, requests); } diff --git a/src/Kiota.Builder/WorkspaceManagement/ApiPluginConfiguration.cs b/src/Kiota.Builder/WorkspaceManagement/ApiPluginConfiguration.cs index 5e690e8f64..2999501447 100644 --- a/src/Kiota.Builder/WorkspaceManagement/ApiPluginConfiguration.cs +++ b/src/Kiota.Builder/WorkspaceManagement/ApiPluginConfiguration.cs @@ -23,7 +23,7 @@ public ApiPluginConfiguration() : base() public ApiPluginConfiguration(GenerationConfiguration config) : base(config) { ArgumentNullException.ThrowIfNull(config); - Types = config.PluginTypes.Select(x => x.ToString()).ToHashSet(); + Types = config.PluginTypes.Select(x => x.ToString()).ToHashSet(StringComparer.OrdinalIgnoreCase); } public HashSet Types { get; set; } = new(StringComparer.OrdinalIgnoreCase); public object Clone() @@ -45,7 +45,7 @@ public void UpdateGenerationConfigurationFromApiPluginConfiguration(GenerationCo { ArgumentNullException.ThrowIfNull(config); ArgumentException.ThrowIfNullOrEmpty(pluginName); - config.PluginTypes = Types.Select(x => Enum.TryParse(x, out var result) ? result : (PluginType?)null).OfType().ToHashSet(); + config.PluginTypes = Types.Select(x => Enum.TryParse(x, true, out var result) ? result : (PluginType?)null).OfType().ToHashSet(); UpdateGenerationConfigurationFromBase(config, pluginName, requests); } } diff --git a/src/Kiota.Builder/WorkspaceManagement/BaseApiConsumerConfiguration.cs b/src/Kiota.Builder/WorkspaceManagement/BaseApiConsumerConfiguration.cs index fa0e320a9c..823b95cea8 100644 --- a/src/Kiota.Builder/WorkspaceManagement/BaseApiConsumerConfiguration.cs +++ b/src/Kiota.Builder/WorkspaceManagement/BaseApiConsumerConfiguration.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using Kiota.Builder.Configuration; +using Kiota.Builder.Extensions; using Microsoft.OpenApi.ApiManifest; namespace Kiota.Builder.WorkspaceManagement; @@ -18,8 +19,8 @@ private protected BaseApiConsumerConfiguration(GenerationConfiguration config) { ArgumentNullException.ThrowIfNull(config); DescriptionLocation = config.OpenAPIFilePath; - IncludePatterns = new HashSet(config.IncludePatterns); - ExcludePatterns = new HashSet(config.ExcludePatterns); + IncludePatterns = new HashSet(config.IncludePatterns, StringComparer.OrdinalIgnoreCase); + ExcludePatterns = new HashSet(config.ExcludePatterns, StringComparer.OrdinalIgnoreCase); OutputPath = config.OutputPath; } /// @@ -41,12 +42,12 @@ private protected BaseApiConsumerConfiguration(GenerationConfiguration config) public void NormalizeOutputPath(string targetDirectory) { if (Path.IsPathRooted(OutputPath)) - OutputPath = "./" + Path.GetRelativePath(targetDirectory, OutputPath); + OutputPath = "./" + Path.GetRelativePath(targetDirectory, OutputPath).NormalizePathSeparators(); } public void NormalizeDescriptionLocation(string targetDirectory) { if (Path.IsPathRooted(DescriptionLocation) && Path.GetFullPath(DescriptionLocation).StartsWith(Path.GetFullPath(targetDirectory), StringComparison.Ordinal) && !DescriptionLocation.StartsWith("http", StringComparison.OrdinalIgnoreCase)) - DescriptionLocation = "./" + Path.GetRelativePath(targetDirectory, DescriptionLocation); + DescriptionLocation = "./" + Path.GetRelativePath(targetDirectory, DescriptionLocation).NormalizePathSeparators(); } protected void CloneBase(BaseApiConsumerConfiguration target) { @@ -60,8 +61,8 @@ protected void UpdateGenerationConfigurationFromBase(GenerationConfiguration con { ArgumentNullException.ThrowIfNull(config); ArgumentException.ThrowIfNullOrEmpty(clientName); - config.IncludePatterns = IncludePatterns; - config.ExcludePatterns = ExcludePatterns; + config.IncludePatterns = IncludePatterns.ToHashSet(StringComparer.OrdinalIgnoreCase); + config.ExcludePatterns = ExcludePatterns.ToHashSet(StringComparer.OrdinalIgnoreCase); config.OpenAPIFilePath = DescriptionLocation; config.OutputPath = OutputPath; config.ClientClassName = clientName; diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index d98f548cc8..dd5ac7e8d5 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -331,7 +331,7 @@ public async Task> MigrateFromLockFileAsync(string clientNam } var generationConfiguration = new GenerationConfiguration(); lockInfo.UpdateGenerationConfigurationFromLock(generationConfiguration); - generationConfiguration.OutputPath = "./" + Path.GetRelativePath(WorkingDirectory, lockFileDirectory); + generationConfiguration.OutputPath = "./" + Path.GetRelativePath(WorkingDirectory, lockFileDirectory).NormalizePathSeparators(); if (!string.IsNullOrEmpty(clientName)) { generationConfiguration.ClientClassName = clientName; diff --git a/src/Kiota.Builder/Writers/CSharp/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeClassDeclarationWriter.cs index 040381a0fb..e02a5a5f52 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeClassDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeClassDeclarationWriter.cs @@ -7,6 +7,7 @@ namespace Kiota.Builder.Writers.CSharp; public class CodeClassDeclarationWriter : BaseElementWriter { public static string AutoGenerationHeader => "// "; + public static string GeneratedCodeAttribute { get; } = $"[global::System.CodeDom.Compiler.GeneratedCode(\"Kiota\", \"{Kiota.Generated.KiotaVersion.Current()}\")]"; public CodeClassDeclarationWriter(CSharpConventionService conventionService) : base(conventionService) { } public override void WriteCodeElement(ClassDeclaration codeElement, LanguageWriter writer) { @@ -37,6 +38,7 @@ public override void WriteCodeElement(ClassDeclaration codeElement, LanguageWrit var derivation = derivedTypes.Length != 0 ? ": " + derivedTypes.Aggregate(static (x, y) => $"{x}, {y}") : string.Empty; bool hasDescription = conventions.WriteLongDescription(parentClass, writer); conventions.WriteDeprecationAttribute(parentClass, writer); + writer.WriteLine(GeneratedCodeAttribute); if (!hasDescription) writer.WriteLine("#pragma warning disable CS1591"); writer.WriteLine($"public partial class {codeElement.Name.ToFirstCharacterUpperCase()} {derivation}"); if (!hasDescription) writer.WriteLine("#pragma warning restore CS1591"); diff --git a/src/Kiota.Builder/Writers/CSharp/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeEnumWriter.cs index 33a82562ad..467299f8a3 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeEnumWriter.cs @@ -9,6 +9,7 @@ namespace Kiota.Builder.Writers.CSharp; public class CodeEnumWriter : BaseElementWriter { public static string AutoGenerationHeader => "// "; + public static string GeneratedCodeAttribute { get; } = $"[global::System.CodeDom.Compiler.GeneratedCode(\"Kiota\", \"{Kiota.Generated.KiotaVersion.Current()}\")]"; public CodeEnumWriter(CSharpConventionService conventionService) : base(conventionService) { } public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter writer) { @@ -30,6 +31,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write writer.WriteLine($"namespace {codeNamespace.Name}"); writer.StartBlock(); } + writer.WriteLine(GeneratedCodeAttribute); bool hasDescription = conventions.WriteShortDescription(codeElement, writer); if (codeElement.Flags) writer.WriteLine("[Flags]"); diff --git a/src/kiota/Handlers/BaseKiotaCommandHandler.cs b/src/kiota/Handlers/BaseKiotaCommandHandler.cs index 5cf3f62755..e6649c01c9 100644 --- a/src/kiota/Handlers/BaseKiotaCommandHandler.cs +++ b/src/kiota/Handlers/BaseKiotaCommandHandler.cs @@ -310,8 +310,8 @@ private static string GetSourceArg(string path, string manifest) } protected void DisplayUrlInformation(string? apiRootUrl, bool isPlugin = false) { - if (!string.IsNullOrEmpty(apiRootUrl)) - DisplayInfo($"{(isPlugin ? "Plugin" : "Client")} base url set to {apiRootUrl}"); + if (!string.IsNullOrEmpty(apiRootUrl) && !isPlugin) + DisplayInfo($"Client base url set to {apiRootUrl}"); } protected void DisplayGenerateCommandHint() { diff --git a/src/kiota/Handlers/Plugin/AddHandler.cs b/src/kiota/Handlers/Plugin/AddHandler.cs index bb31d1a269..e6bfc11e91 100644 --- a/src/kiota/Handlers/Plugin/AddHandler.cs +++ b/src/kiota/Handlers/Plugin/AddHandler.cs @@ -75,7 +75,7 @@ public override async Task InvokeAsync(InvocationContext context) if (result) { DisplaySuccess("Generation completed successfully"); - DisplayUrlInformation(Configuration.Generation.ApiRootUrl); + DisplayUrlInformation(Configuration.Generation.ApiRootUrl, true); } else if (skipGeneration) { diff --git a/src/kiota/Handlers/Plugin/EditHandler.cs b/src/kiota/Handlers/Plugin/EditHandler.cs index a005fed5d1..895c48504d 100644 --- a/src/kiota/Handlers/Plugin/EditHandler.cs +++ b/src/kiota/Handlers/Plugin/EditHandler.cs @@ -92,7 +92,7 @@ public override async Task InvokeAsync(InvocationContext context) if (result) { DisplaySuccess("Generation completed successfully"); - DisplayUrlInformation(Configuration.Generation.ApiRootUrl); + DisplayUrlInformation(Configuration.Generation.ApiRootUrl, true); } else if (skipGeneration) { diff --git a/src/kiota/Rpc/Server.cs b/src/kiota/Rpc/Server.cs index dbdb285175..f9e77d04d6 100644 --- a/src/kiota/Rpc/Server.cs +++ b/src/kiota/Rpc/Server.cs @@ -257,7 +257,10 @@ private static PathItem ConvertOpenApiUrlTreeNodeToPathItem(OpenApiUrlTreeNode n .OrderByDescending(static x => x.isOperation) .ThenBy(static x => x.segment, StringComparer.OrdinalIgnoreCase) .ToArray(); - return new PathItem(node.Path, node.DeduplicatedSegment(), children, filteredPaths.Count == 0 || Array.Exists(children, static x => x.isOperation) && children.Where(static x => x.isOperation).All(static x => x.selected)); + bool isSelected = filteredPaths.Count == 0 || // There are no filtered paths + Array.Exists(children, static x => x.isOperation) && children.Where(static x => x.isOperation).All(static x => x.selected) || // All operations have been selected + !Array.Exists(children, static x => x.isOperation) && Array.TrueForAll(children, static x => x.selected); // All paths selected but no operations present + return new PathItem(node.Path, node.DeduplicatedSegment(), children, isSelected); } private static string GetAbsolutePath(string source) { diff --git a/src/kiota/kiota.csproj b/src/kiota/kiota.csproj index 789f7b0c0a..77fad6f1ba 100644 --- a/src/kiota/kiota.csproj +++ b/src/kiota/kiota.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Kiota Microsoft.OpenApi.Kiota ./nupkg - 1.16.0 + 1.17.0 $(VersionSuffix) https://github.com/microsoft/kiota/releases diff --git a/tests/Kiota.Builder.Tests/Lock/LockManagementServiceTests.cs b/tests/Kiota.Builder.Tests/Lock/LockManagementServiceTests.cs index a00aafe3ff..f88c264885 100644 --- a/tests/Kiota.Builder.Tests/Lock/LockManagementServiceTests.cs +++ b/tests/Kiota.Builder.Tests/Lock/LockManagementServiceTests.cs @@ -50,7 +50,7 @@ public async Task UsesRelativePaths() var outputDirectory = Path.Combine(tmpPath, "output"); Directory.CreateDirectory(outputDirectory); await lockManagementService.WriteLockFileAsync(outputDirectory, lockFile); - Assert.Equal($"..{Path.DirectorySeparatorChar}information{Path.DirectorySeparatorChar}description.yml", lockFile.DescriptionLocation, StringComparer.OrdinalIgnoreCase); + Assert.Equal("../information/description.yml", lockFile.DescriptionLocation, StringComparer.OrdinalIgnoreCase); } [Fact] public async Task DeletesALock() diff --git a/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs b/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs index 509004f814..3390e7d49e 100644 --- a/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs +++ b/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Kiota.Builder.Configuration; using Kiota.Builder.Plugins; +using Kiota.Builder.Plugins.Models; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Readers; @@ -90,6 +91,7 @@ public async Task GeneratesManifest() Assert.True(File.Exists(Path.Combine(outputDirectory, "client-apimanifest.json"))); Assert.True(File.Exists(Path.Combine(outputDirectory, OpenAIPluginFileName))); Assert.True(File.Exists(Path.Combine(outputDirectory, OpenApiFileName))); + Assert.True(File.Exists(Path.Combine(outputDirectory, AppManifestFileName))); // Validate the v2 plugin var manifestContent = await File.ReadAllTextAsync(Path.Combine(outputDirectory, ManifestFileName)); @@ -107,11 +109,538 @@ public async Task GeneratesManifest() Assert.NotNull(resultingManifest.Document); Assert.Equal(OpenApiFileName, v1Manifest.Document.Api.URL); Assert.Empty(v1Manifest.Problems); + + // Validate the manifest file + var appManifestFile = await File.ReadAllTextAsync(Path.Combine(outputDirectory, AppManifestFileName)); + var appManifestModelObject = JsonSerializer.Deserialize(appManifestFile, PluginsGenerationService.AppManifestModelGenerationContext.AppManifestModel); + Assert.Equal("com.microsoft.kiota.plugin.client", appManifestModelObject.PackageName); + Assert.Equal("client", appManifestModelObject.Name.ShortName); + Assert.Equal("Microsoft Kiota.", appManifestModelObject.Developer.Name); + Assert.Equal("color.png", appManifestModelObject.Icons.Color); + Assert.Equal("client", appManifestModelObject.CopilotExtensions.Plugins[0].Id); + Assert.Equal(ManifestFileName, appManifestModelObject.CopilotExtensions.Plugins[0].File); } private const string ManifestFileName = "client-apiplugin.json"; private const string OpenAIPluginFileName = "openai-plugins.json"; private const string OpenApiFileName = "client-openapi.yml"; + private const string AppManifestFileName = "manifest.json"; + + [Fact] + public async Task GeneratesManifestAndUpdatesExistingAppManifest() + { + var simpleDescriptionContent = @"openapi: 3.0.0 +info: + title: test + version: 1.0 + description: A sample test api +servers: + - url: http://localhost/ + description: There's no place like home +paths: + /test/{id}: + get: + description: description for test path with id + operationId: test.WithId + parameters: + - name: id + in: path + required: true + description: The id of the test + schema: + type: integer + format: int32 + responses: + '200': + description: test"; + var workingDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + var simpleDescriptionPath = Path.Combine(workingDirectory) + "description.yaml"; + await File.WriteAllTextAsync(simpleDescriptionPath, simpleDescriptionContent); + var mockLogger = new Mock>(); + var openAPIDocumentDS = new OpenApiDocumentDownloadService(_httpClient, mockLogger.Object); + var outputDirectory = Path.Combine(workingDirectory, "output"); + Directory.CreateDirectory(outputDirectory); + var preExistingManifestContents = @"{ + ""$schema"": ""https://developer.microsoft.com/json-schemas/teams/v1.17/MicrosoftTeams.schema.json"", + ""manifestVersion"": ""1.17"", + ""version"": ""1.0.0"", + ""id"": ""%MICROSOFT-APP-ID%"", + ""localizationInfo"": { + ""defaultLanguageTag"": ""en-us"", + ""additionalLanguages"": [ + { + ""languageTag"": ""es-es"", + ""file"": ""en-us.json"" + } + ] + }, + ""developer"": { + ""name"": ""Publisher Name"", + ""websiteUrl"": ""https://example.com/"", + ""privacyUrl"": ""https://example.com/privacy"", + ""termsOfUseUrl"": ""https://example.com/app-tos"", + ""mpnId"": ""1234567890"" + }, + ""name"": { + ""short"": ""Name of your app"", + ""full"": ""Full name of app, if longer than 30 characters"" + }, + ""description"": { + ""short"": ""Short description of your app (<= 80 chars)"", + ""full"": ""Full description of your app (<= 4000 chars)"" + }, + ""icons"": { + ""outline"": ""A relative path to a transparent .png icon — 32px X 32px"", + ""color"": ""A relative path to a full color .png icon — 192px X 192px"" + }, + ""accentColor"": ""A valid HTML color code."", + ""configurableTabs"": [ + { + ""configurationUrl"": ""https://contoso.com/teamstab/configure"", + ""scopes"": [ + ""team"", + ""groupChat"" + ], + ""canUpdateConfiguration"": true, + ""context"": [ + ""channelTab"", + ""privateChatTab"", + ""meetingChatTab"", + ""meetingDetailsTab"", + ""meetingSidePanel"", + ""meetingStage"" + ], + ""sharePointPreviewImage"": ""Relative path to a tab preview image for use in SharePoint — 1024px X 768"", + ""supportedSharePointHosts"": [ + ""sharePointFullPage"", + ""sharePointWebPart"" + ] + } + ], + ""staticTabs"": [ + { + ""entityId"": ""unique Id for the page entity"", + ""scopes"": [ + ""personal"" + ], + ""context"": [ + ""personalTab"", + ""channelTab"" + ], + ""name"": ""Display name of tab"", + ""contentUrl"": ""https://contoso.com/content (displayed in Teams canvas)"", + ""websiteUrl"": ""https://contoso.com/content (displayed in web browser)"", + ""searchUrl"": ""https://contoso.com/content (displayed in web browser)"" + } + ], + ""supportedChannelTypes"": [ + ""sharedChannels"", + ""privateChannels"" + ], + ""bots"": [ + { + ""botId"": ""%MICROSOFT-APP-ID-REGISTERED-WITH-BOT-FRAMEWORK%"", + ""scopes"": [ + ""team"", + ""personal"", + ""groupChat"" + ], + ""needsChannelSelector"": false, + ""isNotificationOnly"": false, + ""supportsFiles"": true, + ""supportsCalling"": false, + ""supportsVideo"": true, + ""commandLists"": [ + { + ""scopes"": [ + ""team"", + ""groupChat"" + ], + ""commands"": [ + { + ""title"": ""Command 1"", + ""description"": ""Description of Command 1"" + }, + { + ""title"": ""Command 2"", + ""description"": ""Description of Command 2"" + } + ] + }, + { + ""scopes"": [ + ""personal"", + ""groupChat"" + ], + ""commands"": [ + { + ""title"": ""Personal command 1"", + ""description"": ""Description of Personal command 1"" + }, + { + ""title"": ""Personal command N"", + ""description"": ""Description of Personal command N"" + } + ] + } + ] + } + ], + ""connectors"": [ + { + ""connectorId"": ""GUID-FROM-CONNECTOR-DEV-PORTAL%"", + ""scopes"": [ + ""team"" + ], + ""configurationUrl"": ""https://contoso.com/teamsconnector/configure"" + } + ], + ""composeExtensions"": [ + { + ""canUpdateConfiguration"": true, + ""botId"": ""%MICROSOFT-APP-ID-REGISTERED-WITH-BOT-FRAMEWORK%"", + ""commands"": [ + { + ""id"": ""exampleCmd1"", + ""title"": ""Example Command"", + ""type"": ""query"", + ""context"": [ + ""compose"", + ""commandBox"" + ], + ""description"": ""Command Description; e.g., Search on the web"", + ""initialRun"": true, + ""fetchTask"": false, + ""parameters"": [ + { + ""name"": ""keyword"", + ""title"": ""Search keywords"", + ""inputType"": ""choiceset"", + ""description"": ""Enter the keywords to search for"", + ""value"": ""Initial value for the parameter"", + ""choices"": [ + { + ""title"": ""Title of the choice"", + ""value"": ""Value of the choice"" + } + ] + } + ] + }, + { + ""id"": ""exampleCmd2"", + ""title"": ""Example Command 2"", + ""type"": ""action"", + ""context"": [ + ""message"" + ], + ""description"": ""Command Description; e.g., Add a customer"", + ""initialRun"": true, + ""fetchTask"": false , + ""parameters"": [ + { + ""name"": ""custinfo"", + ""title"": ""Customer name"", + ""description"": ""Enter a customer name"", + ""inputType"": ""text"" + } + ] + }, + { + ""id"": ""exampleCmd3"", + ""title"": ""Example Command 3"", + ""type"": ""action"", + ""context"": [ + ""compose"", + ""commandBox"", + ""message"" + ], + ""description"": ""Command Description; e.g., Add a customer"", + ""fetchTask"": false, + ""taskInfo"": { + ""title"": ""Initial dialog title"", + ""width"": ""Dialog width"", + ""height"": ""Dialog height"", + ""url"": ""Initial webview URL"" + } + } + ], + ""messageHandlers"": [ + { + ""type"": ""link"", + ""value"": { + ""domains"": [ + ""mysite.someplace.com"", + ""othersite.someplace.com"" + ], + ""supportsAnonymizedPayloads"": false + } + } + ] + } + ], + ""permissions"": [ + ""identity"", + ""messageTeamMembers"" + ], + ""devicePermissions"": [ + ""geolocation"", + ""media"", + ""notifications"", + ""midi"", + ""openExternal"" + ], + ""validDomains"": [ + ""contoso.com"", + ""mysite.someplace.com"", + ""othersite.someplace.com"" + ], + ""webApplicationInfo"": { + ""id"": ""AAD App ID"", + ""resource"": ""Resource URL for acquiring auth token for SSO"" + }, + ""authorization"": { + ""permissions"": { + ""resourceSpecific"": [ + { + ""type"": ""Application"", + ""name"": ""ChannelSettings.Read.Group"" + }, + { + ""type"": ""Delegated"", + ""name"": ""ChannelMeetingParticipant.Read.Group"" + } + ] + } + }, + ""showLoadingIndicator"": false, + ""isFullScreen"": false, + ""activities"": { + ""activityTypes"": [ + { + ""type"": ""taskCreated"", + ""description"": ""Task created activity"", + ""templateText"": "" created task for you"" + }, + { + ""type"": ""userMention"", + ""description"": ""Personal mention activity"", + ""templateText"": "" mentioned you"" + } + ] + }, + ""defaultBlockUntilAdminAction"": true, + ""publisherDocsUrl"": ""https://example.com/app-info"", + ""defaultInstallScope"": ""meetings"", + ""defaultGroupCapability"": { + ""meetings"": ""tab"", + ""team"": ""bot"", + ""groupChat"": ""bot"" + }, + ""configurableProperties"": [ + ""name"", + ""shortDescription"", + ""longDescription"", + ""smallImageUrl"", + ""largeImageUrl"", + ""accentColor"", + ""developerUrl"", + ""privacyUrl"", + ""termsOfUseUrl"" + ], + ""subscriptionOffer"": { + ""offerId"": ""publisherId.offerId"" + }, + ""meetingExtensionDefinition"": { + ""scenes"": [ + { + ""id"": ""9082c811-7e6a-4174-8173-6ccd57d377e6"", + ""name"": ""Getting started sample"", + ""file"": ""scenes/sceneMetadata.json"", + ""preview"": ""scenes/scenePreview.png"", + ""maxAudience"": 15, + ""seatsReservedForOrganizersOrPresenters"": 0 + }, + { + ""id"": ""afeaed22-f89b-48e1-98b4-46a514344e4a"", + ""name"": ""Sample-1"", + ""file"": ""scenes/sceneMetadata.json"", + ""preview"": ""scenes/scenePreview.png"", + ""maxAudience"": 15, + ""seatsReservedForOrganizersOrPresenters"": 3 + } + ] + } +}"; + var preExistingManifestPath = Path.Combine(outputDirectory, "manifest.json"); + await File.WriteAllTextAsync(preExistingManifestPath, preExistingManifestContents); + var generationConfiguration = new GenerationConfiguration + { + OutputPath = outputDirectory, + OpenAPIFilePath = "openapiPath", + PluginTypes = [PluginType.APIPlugin], + ClientClassName = "client", + ApiRootUrl = "http://localhost/", //Kiota builder would set this for us + }; + var (openAPIDocumentStream, _) = await openAPIDocumentDS.LoadStreamAsync(simpleDescriptionPath, generationConfiguration, null, false); + var openApiDocument = await openAPIDocumentDS.GetDocumentFromStreamAsync(openAPIDocumentStream, generationConfiguration); + KiotaBuilder.CleanupOperationIdForPlugins(openApiDocument); + var urlTreeNode = OpenApiUrlTreeNode.Create(openApiDocument, Constants.DefaultOpenApiLabel); + + // Assert manifest exists before generation and is parsable + Assert.True(File.Exists(Path.Combine(outputDirectory, "manifest.json"))); + var originalManifestFile = await File.ReadAllTextAsync(Path.Combine(outputDirectory, AppManifestFileName)); + var originalAppManifestModelObject = JsonSerializer.Deserialize(originalManifestFile, PluginsGenerationService.AppManifestModelGenerationContext.AppManifestModel); + Assert.Null(originalAppManifestModelObject.PackageName);// package wasn't present + Assert.Equal("Name of your app", originalAppManifestModelObject.Name.ShortName); // app name is same + Assert.Equal("Publisher Name", originalAppManifestModelObject.Developer.Name); // app name is same + Assert.Null(originalAppManifestModelObject.CopilotExtensions?.Plugins); // no plugins present + + // Run the plugin generation + var pluginsGenerationService = new PluginsGenerationService(openApiDocument, urlTreeNode, generationConfiguration, workingDirectory); + await pluginsGenerationService.GenerateManifestAsync(); + + Assert.True(File.Exists(Path.Combine(outputDirectory, ManifestFileName))); + Assert.True(File.Exists(Path.Combine(outputDirectory, OpenApiFileName))); + Assert.True(File.Exists(Path.Combine(outputDirectory, "manifest.json")));// Assert manifest exists after generation + + // Validate the manifest file + var appManifestFile = await File.ReadAllTextAsync(Path.Combine(outputDirectory, AppManifestFileName)); + var appManifestModelObject = JsonSerializer.Deserialize(appManifestFile, PluginsGenerationService.AppManifestModelGenerationContext.AppManifestModel); + Assert.Null(appManifestModelObject.PackageName);// package wasn't present + Assert.Equal("Name of your app", appManifestModelObject.Name.ShortName); // app name is same + Assert.Equal("Publisher Name", originalAppManifestModelObject.Developer.Name); // developer name is same + Assert.Equal("client", appManifestModelObject.CopilotExtensions.Plugins[0].Id); + Assert.Equal(ManifestFileName, appManifestModelObject.CopilotExtensions.Plugins[0].File); + var rootJsonElement = JsonDocument.Parse(appManifestFile).RootElement; + Assert.True(rootJsonElement.TryGetProperty("subscriptionOffer", out _));// no loss of information + Assert.True(rootJsonElement.TryGetProperty("meetingExtensionDefinition", out _));// no loss of information + Assert.True(rootJsonElement.TryGetProperty("activities", out _));// no loss of information + Assert.True(rootJsonElement.TryGetProperty("devicePermissions", out _));// no loss of information + Assert.True(rootJsonElement.TryGetProperty("composeExtensions", out _));// no loss of information + } + + [Fact] + public async Task GeneratesManifestAndUpdatesExistingAppManifestWithExistingPlugins() + { + var simpleDescriptionContent = @"openapi: 3.0.0 +info: + termsOfService: http://example.com/terms/ + contact: + name: API Support + email: support@example.com + url: http://example.com/support +servers: + - url: http://localhost/ + description: There's no place like home +paths: + /test/{id}: + get: + description: description for test path with id + operationId: test.WithId + parameters: + - name: id + in: path + required: true + description: The id of the test + schema: + type: integer + format: int32 + responses: + '200': + description: test"; + var workingDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + var simpleDescriptionPath = Path.Combine(workingDirectory) + "description.yaml"; + await File.WriteAllTextAsync(simpleDescriptionPath, simpleDescriptionContent); + var mockLogger = new Mock>(); + var openAPIDocumentDS = new OpenApiDocumentDownloadService(_httpClient, mockLogger.Object); + var outputDirectory = Path.Combine(workingDirectory, "output"); + Directory.CreateDirectory(outputDirectory); + var preExistingManifestContents = @"{ + ""$schema"": ""https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json"", + ""manifestVersion"": ""devPreview"", + ""version"": ""1.0.0"", + ""id"": """", + ""developer"": { + ""name"": ""Test Name"", + ""websiteUrl"": """", + ""privacyUrl"": """", + ""termsOfUseUrl"": """" + }, + ""packageName"": ""com.microsoft.kiota.plugin.client"", + ""name"": { + ""short"": ""client"", + ""full"": ""API Plugin for "" + }, + ""description"": { + ""short"": ""API Plugin for . If the description is not available, it defaults to `API Plugin for `"", + ""full"": ""API Plugin for . If the description is not available, it defaults to `API Plugin for `"" + }, + ""icons"": { + ""color"": ""color.png"", + ""outline"": ""outline.png"" + }, + ""accentColor"": ""#FFFFFF"", + ""copilotExtensions"": { + ""plugins"": [ + { + ""id"": ""client"", + ""file"": ""dummyFile.json"" + } + ], + ""declarativeCopilots"": [ + { + ""id"": ""client"", + ""file"": ""dummyFile.json"" + } + ] + } +}"; + var preExistingManifestPath = Path.Combine(outputDirectory, "manifest.json"); + await File.WriteAllTextAsync(preExistingManifestPath, preExistingManifestContents); + var generationConfiguration = new GenerationConfiguration + { + OutputPath = outputDirectory, + OpenAPIFilePath = "openapiPath", + PluginTypes = [PluginType.APIPlugin], + ClientClassName = "client", + ApiRootUrl = "http://localhost/", //Kiota builder would set this for us + }; + var (openAPIDocumentStream, _) = await openAPIDocumentDS.LoadStreamAsync(simpleDescriptionPath, generationConfiguration, null, false); + var openApiDocument = await openAPIDocumentDS.GetDocumentFromStreamAsync(openAPIDocumentStream, generationConfiguration); + KiotaBuilder.CleanupOperationIdForPlugins(openApiDocument); + var urlTreeNode = OpenApiUrlTreeNode.Create(openApiDocument, Constants.DefaultOpenApiLabel); + + // Assert manifest exists before generation and is parsable + Assert.True(File.Exists(Path.Combine(outputDirectory, "manifest.json"))); + var originalManifestFile = await File.ReadAllTextAsync(Path.Combine(outputDirectory, AppManifestFileName)); + var originalAppManifestModelObject = JsonSerializer.Deserialize(originalManifestFile, PluginsGenerationService.AppManifestModelGenerationContext.AppManifestModel); + Assert.Equal("com.microsoft.kiota.plugin.client", originalAppManifestModelObject.PackageName);// package was present + Assert.NotNull(originalAppManifestModelObject.CopilotExtensions); + Assert.Single(originalAppManifestModelObject.CopilotExtensions.Plugins);//one plugin present + Assert.Equal("dummyFile.json", originalAppManifestModelObject.CopilotExtensions.Plugins[0].File); // no plugins present + Assert.Single(originalAppManifestModelObject.CopilotExtensions.DeclarativeCopilots);// one declarative copilot present + Assert.Equal("dummyFile.json", originalAppManifestModelObject.CopilotExtensions.DeclarativeCopilots[0].File); // no plugins present + + // Run the plugin generation + var pluginsGenerationService = new PluginsGenerationService(openApiDocument, urlTreeNode, generationConfiguration, workingDirectory); + await pluginsGenerationService.GenerateManifestAsync(); + + Assert.True(File.Exists(Path.Combine(outputDirectory, ManifestFileName))); + Assert.True(File.Exists(Path.Combine(outputDirectory, OpenApiFileName))); + Assert.True(File.Exists(Path.Combine(outputDirectory, "manifest.json")));// Assert manifest exists after generation + + // Validate the manifest file + var appManifestFile = await File.ReadAllTextAsync(Path.Combine(outputDirectory, AppManifestFileName)); + var appManifestModelObject = JsonSerializer.Deserialize(appManifestFile, PluginsGenerationService.AppManifestModelGenerationContext.AppManifestModel); + Assert.Equal("com.microsoft.kiota.plugin.client", originalAppManifestModelObject.PackageName);// package was present + Assert.Equal("client", appManifestModelObject.Name.ShortName); // app name is same + Assert.Equal("Test Name", originalAppManifestModelObject.Developer.Name); // developer name is same + Assert.Equal("client", appManifestModelObject.CopilotExtensions.Plugins[0].Id); + Assert.Equal(ManifestFileName, appManifestModelObject.CopilotExtensions.Plugins[0].File);// file name is updated + Assert.Single(appManifestModelObject.CopilotExtensions.DeclarativeCopilots);// we didn't erase the existing declarative copilots + Assert.Equal("dummyFile.json", appManifestModelObject.CopilotExtensions.DeclarativeCopilots[0].File); // no plugins present + } [Fact] public async Task GeneratesManifestAndCleansUpInputDescription() { diff --git a/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs index 27b5091fd4..cb85b7cb0a 100644 --- a/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs @@ -446,6 +446,27 @@ public async Task KeepsCancellationParametersInRequestExecutors() } [Fact] public async Task ReplacesExceptionPropertiesNames() + { + var exception = root.AddClass(new CodeClass + { + Name = "error403", + Kind = CodeClassKind.Model, + IsErrorDefinition = true, + }).First(); + var propToAdd = exception.AddProperty(new CodeProperty + { + Name = "stacktrace", + Type = new CodeType + { + Name = "string" + } + }).First(); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.CSharp }, root); + Assert.Equal("stacktraceEscaped", propToAdd.Name, StringComparer.OrdinalIgnoreCase); + Assert.Equal("stacktrace", propToAdd.SerializationName, StringComparer.OrdinalIgnoreCase); + } + [Fact] + public async Task DoesNotRenamePrimaryErrorMessageIfMatchAlreadyExists() { var exception = root.AddClass(new CodeClass { @@ -461,9 +482,59 @@ public async Task ReplacesExceptionPropertiesNames() Name = "string" } }).First(); + Assert.False(exception.Properties.First().IsOfKind(CodePropertyKind.ErrorMessageOverride));// property is NOT message override await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.CSharp }, root); - Assert.Equal("messageEscaped", propToAdd.Name, StringComparer.OrdinalIgnoreCase); - Assert.Equal("message", propToAdd.SerializationName, StringComparer.OrdinalIgnoreCase); + Assert.Equal("message", propToAdd.Name, StringComparer.OrdinalIgnoreCase);// property remains + Assert.Single(exception.Properties); // no new properties added + Assert.True(exception.Properties.First().IsOfKind(CodePropertyKind.ErrorMessageOverride));// property is now message override + Assert.Equal("message", exception.Properties.First().Name, StringComparer.OrdinalIgnoreCase); // name is expected. + } + [Fact] + public async Task RenamesExceptionClassWithReservedPropertyName() + { + var exception = root.AddClass(new CodeClass + { + Name = "message", + Kind = CodeClassKind.Model, + IsErrorDefinition = true, + }).First(); + var propToAdd = exception.AddProperty(new CodeProperty + { + Name = "message", + Type = new CodeType + { + Name = "string" + } + }).First(); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.CSharp }, root); + Assert.Equal("messageEscaped", exception.Name, StringComparer.OrdinalIgnoreCase);// class is renamed to avoid removing special overidden property + Assert.Equal("message", propToAdd.Name, StringComparer.OrdinalIgnoreCase); // property is unchanged + Assert.Single(exception.Properties); // no new properties added + Assert.Equal("message", exception.Properties.First().Name, StringComparer.OrdinalIgnoreCase); + } + [Fact] + public async Task RenamesExceptionClassWithReservedPropertyNameWhenPropertyIsInitiallyAbsent() + { + var exception = root.AddClass(new CodeClass + { + Name = "message", + Kind = CodeClassKind.Model, + IsErrorDefinition = true, + }).First(); + var propToAdd = exception.AddProperty(new CodeProperty + { + Name = "something", + Type = new CodeType + { + Name = "string" + } + }).First(); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.CSharp }, root); + Assert.Equal("messageEscaped", exception.Name, StringComparer.OrdinalIgnoreCase);// class is renamed to avoid removing special overidden property + Assert.Equal("something", propToAdd.Name, StringComparer.OrdinalIgnoreCase); // existing property remains + Assert.Equal(2, exception.Properties.Count()); // initial property plus primary message + Assert.Equal("message", exception.Properties.ToArray()[0].Name, StringComparer.OrdinalIgnoreCase); // primary error message is present + Assert.Equal("something", exception.Properties.ToArray()[1].Name, StringComparer.OrdinalIgnoreCase);// existing property remains } [Fact] public async Task DoesNotReplaceNonExceptionPropertiesNames() diff --git a/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs index 59f73cde09..4d2e36bdae 100644 --- a/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs @@ -1189,9 +1189,12 @@ public async Task NormalizeNamespaceName() root.Name = "github.com/OrgName/RepoName"; var models = root.AddNamespace("ApiSdk.models"); var submodels = models.AddNamespace("ApiSdk.models.submodels"); + var camelCaseModel = submodels.AddNamespace("ApiSdk.models.submodels.camelCase"); await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Go, ClientNamespaceName = "github.com/OrgName/RepoName" }, root); Assert.Equal("github.com/OrgName/RepoName.apisdk.models.submodels", submodels.Name); Assert.Equal("github.com/OrgName/RepoName.apisdk.models", models.Name); + Assert.Equal("github.com/OrgName/RepoName.apisdk.models.submodels.camelcase", camelCaseModel.Name); } + #endregion } diff --git a/tests/Kiota.Builder.Tests/Refiners/TypeScriptLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/TypeScriptLanguageRefinerTests.cs index 0c7178dd7d..8da35ab461 100644 --- a/tests/Kiota.Builder.Tests/Refiners/TypeScriptLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/TypeScriptLanguageRefinerTests.cs @@ -840,5 +840,55 @@ public async Task AddsUsingForUntypedNode() Assert.Single(nodeUsing); Assert.Equal("@microsoft/kiota-abstractions", nodeUsing[0].Declaration.Name); } + [Fact] + public async Task AddsUsingForUntypedNodeInReturnType() + { + var requestBuilderClass = root.AddClass(new CodeClass() { Name = "NodeRequestBuilder" }).First(); + var model = new CodeMethod + { + Name = "getAsync", + ReturnType = new CodeType + { + Name = KiotaBuilder.UntypedNodeName + } + }; + requestBuilderClass.AddMethod(model); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.TypeScript }, root); + Assert.Equal(KiotaBuilder.UntypedNodeName, model.ReturnType.Name);// type is renamed + Assert.NotEmpty(requestBuilderClass.StartBlock.Usings); + var nodeUsing = requestBuilderClass.StartBlock.Usings.Where(static declaredUsing => declaredUsing.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase)).ToArray(); + Assert.Single(nodeUsing); + Assert.Equal("@microsoft/kiota-abstractions", nodeUsing[0].Declaration.Name); + } + [Fact] + public async Task AddsUsingForUntypedNodeInMethodParameter() + { + var requestBuilderClass = root.AddClass(new CodeClass() { Name = "NodeRequestBuilder" }).First(); + var method = new CodeMethod + { + Name = "getAsync", + ReturnType = new CodeType + { + Name = "string", + IsExternal = true + } + }; + method.AddParameter(new CodeParameter() + { + Name = "jsonData", + Type = new CodeType() + { + Name = KiotaBuilder.UntypedNodeName, + IsExternal = true + } + }); + requestBuilderClass.AddMethod(method); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.TypeScript }, root); + Assert.Equal(KiotaBuilder.UntypedNodeName, method.Parameters.First().Type.Name);// type is renamed + Assert.NotEmpty(requestBuilderClass.StartBlock.Usings); + var nodeUsing = requestBuilderClass.StartBlock.Usings.Where(static declaredUsing => declaredUsing.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase)).ToArray(); + Assert.Single(nodeUsing); + Assert.Equal("@microsoft/kiota-abstractions", nodeUsing[0].Declaration.Name); + } #endregion } diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeClassDeclarationWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeClassDeclarationWriterTests.cs index d9100b9886..d59f8e58d5 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeClassDeclarationWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeClassDeclarationWriterTests.cs @@ -107,4 +107,12 @@ public void WritesImports() Assert.Contains("Project.Graph", result); Assert.Contains("System.Util", result); } + + [Fact] + public void WritesGeneratedCodeAttribute() + { + codeElementWriter.WriteCodeElement(parentClass.StartBlock, writer); + var result = tw.ToString(); + Assert.Matches(CodeEnumWriterTests.GeneratedCodePattern, result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeEnumWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeEnumWriterTests.cs index e5e6590f4f..bbbd6fd2f5 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeEnumWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeEnumWriterTests.cs @@ -110,6 +110,7 @@ public void WritesFlagsEnum() Assert.Contains("= 1", result); Assert.Contains("= 2", result); } + [Fact] public void WritesEnumOptionDescription() { @@ -120,6 +121,7 @@ public void WritesEnumOptionDescription() Assert.Contains($"{Option.Documentation.DescriptionTemplate}", result); AssertExtensions.CurlyBracesAreClosed(result, 1); } + [Fact] public void DoesntWriteAnythingOnNoOption() { @@ -127,4 +129,14 @@ public void DoesntWriteAnythingOnNoOption() var result = tw.ToString(); Assert.Empty(result); } + + internal const string GeneratedCodePattern = @"\s+\[global::System\.CodeDom\.Compiler\.GeneratedCode\(""Kiota"", ""[0-9]+\.[0-9]+\.[0-9]+(?:-preview\.\d+)?""\)\]"; + [Fact] + public void WritesGeneratedCodeAttribute() + { + currentEnum.AddOption(new CodeEnumOption { Name = "option2" }); + writer.Write(currentEnum); + var result = tw.ToString(); + Assert.Matches(GeneratedCodePattern, result); + } } diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 533695e3f5..b1489ca467 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -1,12 +1,12 @@ { "name": "kiota", - "version": "1.15.100000001", + "version": "1.16.100000001", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "kiota", - "version": "1.15.100000001", + "version": "1.16.100000001", "dependencies": { "@vscode/extension-telemetry": "^0.9.6", "@vscode/l10n": "^0.0.18", @@ -19,20 +19,20 @@ "@types/adm-zip": "^0.5.5", "@types/mocha": "^10.0.7", "@types/node": "20.x", - "@types/vscode": "^1.90.0", + "@types/vscode": "^1.91.0", "@typescript-eslint/eslint-plugin": "^7.5.0", "@typescript-eslint/parser": "^7.5.0", - "@vscode/test-electron": "^2.4.0", + "@vscode/test-electron": "^2.4.1", "eslint": "^8.57.0", - "glob": "^10.4.2", - "mocha": "^10.5.2", + "glob": "^11.0.0", + "mocha": "^10.6.0", "ts-loader": "^9.5.1", - "typescript": "^5.5.2", + "typescript": "^5.5.3", "webpack": "^5.92.1", "webpack-cli": "^5.1.4" }, "engines": { - "vscode": "^1.90.0" + "vscode": "^1.91.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -483,9 +483,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.14.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", - "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", + "version": "20.14.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.10.tgz", + "integrity": "sha512-MdiXf+nDuMvY0gJKxyfZ7/6UFsETO7mGKF54MVD/ekJS6HdFtpZFBgrh6Pseu64XTb2MLyFPlbW6hj8HYRQNOQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -498,9 +498,9 @@ "dev": true }, "node_modules/@types/vscode": { - "version": "1.90.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.90.0.tgz", - "integrity": "sha512-oT+ZJL7qHS9Z8bs0+WKf/kQ27qWYR3trsXpq46YDjFqBsMLG4ygGGjPaJ2tyrH0wJzjOEmDyg9PDJBBhWg9pkQ==", + "version": "1.91.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.91.0.tgz", + "integrity": "sha512-PgPr+bUODjG3y+ozWUCyzttqR9EHny9sPAfJagddQjDwdtf66y2sDKJMnFZRuzBA2YtBGASqJGPil8VDUPvO6A==", "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { @@ -742,13 +742,13 @@ "integrity": "sha512-KYSIHVmslkaCDyw013pphY+d7x1qV8IZupYfeIfzNA+nsaWHbn5uPuQRvdRFsa9zFzGeudPuoGoZ1Op4jrJXIQ==" }, "node_modules/@vscode/test-electron": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.4.0.tgz", - "integrity": "sha512-yojuDFEjohx6Jb+x949JRNtSn6Wk2FAh4MldLE3ck9cfvCqzwxF32QsNy1T9Oe4oT+ZfFcg0uPUCajJzOmPlTA==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.4.1.tgz", + "integrity": "sha512-Gc6EdaLANdktQ1t+zozoBVRynfIsMKMc94Svu1QreOBC8y76x4tvaK32TljrLi1LI2+PK58sDVbL7ALdqf3VRQ==", "dev": true, "dependencies": { "http-proxy-agent": "^7.0.2", - "https-proxy-agent": "^7.0.4", + "https-proxy-agent": "^7.0.5", "jszip": "^3.10.1", "ora": "^7.0.1", "semver": "^7.6.2" @@ -1050,9 +1050,9 @@ } }, "node_modules/ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", "dev": true, "engines": { "node": ">=6" @@ -1561,9 +1561,9 @@ } }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -1629,9 +1629,9 @@ } }, "node_modules/diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", "dev": true, "engines": { "node": ">=0.3.1" @@ -2147,23 +2147,23 @@ } }, "node_modules/glob": { - "version": "10.4.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", - "integrity": "sha512-GwMlUF6PkPo3Gk21UxkCohOv0PLcIXVtKyLlpEI28R/cO/4eNOdmLk3CMW1wROV/WR/EsZOWAfBbBOqYvs88/w==", + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.0.tgz", + "integrity": "sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", + "jackspeak": "^4.0.1", + "minimatch": "^10.0.0", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" + "path-scurry": "^2.0.0" }, "bin": { "glob": "dist/esm/bin.mjs" }, "engines": { - "node": ">=16 || 14 >=14.18" + "node": "20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -2197,15 +2197,15 @@ } }, "node_modules/glob/node_modules/minimatch": { - "version": "9.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", - "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", + "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": "20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -2343,9 +2343,9 @@ } }, "node_modules/https-proxy-agent": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", - "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", + "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", "dev": true, "dependencies": { "agent-base": "^7.0.2", @@ -2645,15 +2645,15 @@ } }, "node_modules/jackspeak": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.1.2.tgz", - "integrity": "sha512-kWmLKn2tRtfYMF/BakihVVRzBKOxz4gJMiL2Rj91WnAB5TPZumSH99R/Yf1qE1u4uRimvCSJfm6hnxohXeEXjQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.1.tgz", + "integrity": "sha512-cub8rahkh0Q/bw1+GxP7aeSe29hHHn2V4m29nnDlvCdlgU+3UGxkZp7Z53jLUdpX3jdTO0nJZUDl3xvbWc2Xog==", "dev": true, "dependencies": { "@isaacs/cliui": "^8.0.2" }, "engines": { - "node": ">=14" + "node": "20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -2835,12 +2835,12 @@ } }, "node_modules/lru-cache": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", - "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.0.tgz", + "integrity": "sha512-Qv32eSV1RSCfhY3fpPE2GNZ8jgM9X7rdAfemLWqTUxwiyIC4jJ6Sy0fZ8H+oLWevO6i4/bizg7c8d8i6bxrzbA==", "dev": true, "engines": { - "node": "14 || >=16.14" + "node": "20 || >=22" } }, "node_modules/merge-stream": { @@ -2934,31 +2934,31 @@ } }, "node_modules/mocha": { - "version": "10.5.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.5.2.tgz", - "integrity": "sha512-9btlN3JKCefPf+vKd/kcKz2SXxi12z6JswkGfaAF0saQvnsqLJk504ZmbxhSoENge08E9dsymozKgFMTl5PQsA==", + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.6.0.tgz", + "integrity": "sha512-hxjt4+EEB0SA0ZDygSS015t65lJw/I2yRCS3Ae+SJ5FrbzrXgfYwJr96f0OvIXdj7h4lv/vLCrH3rkiuizFSvw==", "dev": true, "dependencies": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", + "ansi-colors": "^4.1.3", + "browser-stdout": "^1.3.1", "chokidar": "^3.5.3", - "debug": "4.3.4", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "8.1.0", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "5.0.1", - "ms": "2.1.3", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "workerpool": "6.2.1", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" + "debug": "^4.3.5", + "diff": "^5.2.0", + "escape-string-regexp": "^4.0.0", + "find-up": "^5.0.0", + "glob": "^8.1.0", + "he": "^1.2.0", + "js-yaml": "^4.1.0", + "log-symbols": "^4.1.0", + "minimatch": "^5.1.6", + "ms": "^2.1.3", + "serialize-javascript": "^6.0.2", + "strip-json-comments": "^3.1.1", + "supports-color": "^8.1.1", + "workerpool": "^6.5.1", + "yargs": "^16.2.0", + "yargs-parser": "^20.2.9", + "yargs-unparser": "^2.0.0" }, "bin": { "_mocha": "bin/_mocha", @@ -2988,9 +2988,9 @@ } }, "node_modules/mocha/node_modules/minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" @@ -3378,16 +3378,16 @@ "dev": true }, "node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", + "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", "dev": true, "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" }, "engines": { - "node": ">=16 || 14 >=14.18" + "node": "20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -3805,9 +3805,9 @@ } }, "node_modules/serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, "dependencies": { "randombytes": "^2.1.0" @@ -4103,15 +4103,6 @@ } } }, - "node_modules/terser-webpack-plugin/node_modules/serialize-javascript": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", - "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", - "dev": true, - "dependencies": { - "randombytes": "^2.1.0" - } - }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -4202,9 +4193,9 @@ } }, "node_modules/typescript": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz", - "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==", + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", + "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -4431,9 +4422,9 @@ "dev": true }, "node_modules/workerpool": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", - "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", + "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==", "dev": true }, "node_modules/wrap-ansi": { @@ -4564,9 +4555,9 @@ } }, "node_modules/yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dev": true, "engines": { "node": ">=10" diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index e12b70b960..d07e4aaecf 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -3,12 +3,12 @@ "displayName": "Microsoft Kiota", "publisher": "ms-graph", "description": "Client generator for HTTP REST APIs described by OpenAPI which helps eliminate the need to take a dependency on a different API client for every API that you need to call, as well as limiting the generation to the exact API surface area you're interested in, thanks to a filtering capability.", - "version": "1.15.100000001", - "kiotaVersion": "1.15.0", + "version": "1.16.100000001", + "kiotaVersion": "1.16.0", "telemetryInstrumentationKey": "4c6357e0-daf9-42b5-bdfb-67878f8957b5", "icon": "images/logo.png", "engines": { - "vscode": "^1.90.0" + "vscode": "^1.91.0" }, "categories": [ "Other" @@ -441,15 +441,15 @@ "@types/adm-zip": "^0.5.5", "@types/mocha": "^10.0.7", "@types/node": "20.x", - "@types/vscode": "^1.90.0", + "@types/vscode": "^1.91.0", "@typescript-eslint/eslint-plugin": "^7.5.0", "@typescript-eslint/parser": "^7.5.0", - "@vscode/test-electron": "^2.4.0", + "@vscode/test-electron": "^2.4.1", "eslint": "^8.57.0", - "glob": "^10.4.2", - "mocha": "^10.5.2", + "glob": "^11.0.0", + "mocha": "^10.6.0", "ts-loader": "^9.5.1", - "typescript": "^5.5.2", + "typescript": "^5.5.3", "webpack": "^5.92.1", "webpack-cli": "^5.1.4" }, @@ -465,23 +465,23 @@ "runtimeDependencies": [ { "platformId": "win-x64", - "sha256": "A34EF636542E6AAF32FDA9D730534A9410B2E2D1F15DC8344C45D8CC694EE037" + "sha256": "4E1FE93EF66722266D99978DB4B96FA49EACBC7FB8DDC2330384C276EEED8A4F" }, { "platformId": "win-x86", - "sha256": "314106D1E6D446BF259F47FF3D112CD099E77B9E87CD5AD1EC8007106A281C8F" + "sha256": "200FE8C8A868AA7C1826923DE62DCD4E1261FEE32D5E02AD86BBB74031C62DB6" }, { "platformId": "linux-x64", - "sha256": "C56146FBBF0381B3419098B64EEB1BAA06473C4A085B3D18659B9CFB64E34B65" + "sha256": "C4CD448622E7EC35CDB66C68A9B01F7726246A3AE07B872ECD1B4980A6D06971" }, { "platformId": "osx-x64", - "sha256": "53BDDE6E0042E16392C9B123B0DDDBED1935C5831D6837D6B673942B012FFD73" + "sha256": "993AFDA8F91B4240D314540DE7B0CEDFF0CACB70DACF17B49A6460A6EA1CFB4E" }, { "platformId": "osx-arm64", - "sha256": "31215E1EE60A1E558FC5A190268E4D3016BFD5908445C45E90E63F22F91C54E8" + "sha256": "1D53A307228F3572BBA7B9A76B2575EE9E057FBCA3C8C1EBC188E4EDFB8DA2B2" } ] } diff --git a/vscode/microsoft-kiota/src/constants.ts b/vscode/microsoft-kiota/src/constants.ts index 6b601563b9..4ed39fc9f9 100644 --- a/vscode/microsoft-kiota/src/constants.ts +++ b/vscode/microsoft-kiota/src/constants.ts @@ -8,4 +8,6 @@ export const KIOTA_WORKSPACE_FILE = "workspace.json"; export const KIOTA_DIRECTORY = '.kiota'; export const CLIENTS = "clients"; export const PLUGINS = "plugins"; +export const CLIENT = "client"; +export const PLUGIN = "plugin"; diff --git a/vscode/microsoft-kiota/src/extension.ts b/vscode/microsoft-kiota/src/extension.ts index be0565f46b..c813838454 100644 --- a/vscode/microsoft-kiota/src/extension.ts +++ b/vscode/microsoft-kiota/src/extension.ts @@ -29,18 +29,17 @@ import { ExtensionSettings, getExtensionSettings } from "./extensionSettings"; import { KiotaWorkspace } from "./workspaceTreeProvider"; import { generatePlugin } from "./generatePlugin"; import { CodeLensProvider } from "./codelensProvider"; -import { CLIENTS, KIOTA_DIRECTORY, KIOTA_WORKSPACE_FILE, PLUGINS, dependenciesInfo, extensionId, statusBarCommandId, treeViewFocusCommand, treeViewId } from "./constants"; +import { CLIENT, CLIENTS, KIOTA_DIRECTORY, KIOTA_WORKSPACE_FILE, PLUGIN, PLUGINS, dependenciesInfo, extensionId, statusBarCommandId, treeViewFocusCommand, treeViewId } from "./constants"; import { updateTreeViewIcons } from "./util"; let kiotaStatusBarItem: vscode.StatusBarItem; let kiotaOutputChannel: vscode.LogOutputChannel; let clientOrPluginKey: string; -let clientOrPluginObject: ClientOrPluginProperties; let workspaceGenerationType: string; +let config: Partial; interface GeneratedOutputState { outputPath: string; - config: Partial; clientClassName: string; } @@ -134,7 +133,7 @@ export async function activate( } let languagesInformation = await getLanguageInformation(context); - const config = await generateSteps( + config = await generateSteps( { clientClassName: openApiTreeProvider.clientClassName, clientNamespaceName: openApiTreeProvider.clientNamespaceName, @@ -192,7 +191,7 @@ export async function activate( vscode.workspace.onDidChangeWorkspaceFolders(async () => { const generatedOutput = context.workspaceState.get('generatedOutput'); if (generatedOutput) { - const { outputPath, config } = generatedOutput; + const { outputPath} = generatedOutput; await displayGenerationResults(context, openApiTreeProvider, config, outputPath); // Clear the state void context.workspaceState.update('generatedOutput', undefined); @@ -247,12 +246,12 @@ export async function activate( ), registerCommandWithTelemetry(reporter, `${extensionId}.editPaths`, async (clientKey: string, clientObject: ClientOrPluginProperties, generationType: string) => { clientOrPluginKey = clientKey; - clientOrPluginObject = clientObject; workspaceGenerationType = generationType; await loadEditPaths(clientOrPluginKey, clientObject, openApiTreeProvider); await updateTreeViewIcons(treeViewId, false, true); }), registerCommandWithTelemetry(reporter,`${treeViewId}.regenerateButton`, async () => { + clientOrPluginKey = config.clientClassName ? config.clientClassName! : config.pluginName!; const settings = getExtensionSettings(extensionId); const selectedPaths = openApiTreeProvider.getSelectedPaths(); if (selectedPaths.length === 0) { @@ -261,11 +260,11 @@ export async function activate( ); return; } - if(workspaceGenerationType === CLIENTS) { - await regenerateClient(clientOrPluginKey, clientOrPluginObject, settings, selectedPaths); + if(workspaceGenerationType === CLIENT) { + await regenerateClient(clientOrPluginKey, config, settings, selectedPaths); } - else if (workspaceGenerationType === PLUGINS) { - await regeneratePlugin(clientOrPluginKey, clientOrPluginObject, settings, selectedPaths); + else if (workspaceGenerationType === PLUGIN) { + await regeneratePlugin(clientOrPluginKey, config, settings, selectedPaths); } }), registerCommandWithTelemetry(reporter, `${extensionId}.regenerate`, async (clientKey: string, clientObject: ClientOrPluginProperties, generationType: string) => { @@ -327,7 +326,7 @@ export async function activate( return result; } async function generatePluginAndRefreshUI(config: Partial, settings: ExtensionSettings, outputPath: string, selectedPaths: string[]):Promise { - const pluginTypes = typeof config.pluginTypes === 'string' ? parsePluginType(config.pluginTypes) : KiotaPluginType.ApiPlugin; + const pluginTypes = Array.isArray(config.pluginTypes) ? parsePluginType(config.pluginTypes) : [KiotaPluginType.ApiPlugin]; const result = await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, cancellable: false, @@ -338,7 +337,7 @@ export async function activate( context, openApiTreeProvider.descriptionUrl, outputPath, - [pluginTypes], + pluginTypes, selectedPaths, [], typeof config.pluginName === "string" @@ -447,22 +446,22 @@ export async function activate( }, async (progress, _) => { const result = await generateClient( context, - clientObject.descriptionLocation, + clientObject.descriptionLocation ? clientObject.descriptionLocation: openApiTreeProvider.descriptionUrl, clientObject.outputPath, language, selectedPaths ? selectedPaths : clientObject.includePatterns, - clientObject.excludePatterns, + clientObject.excludePatterns ? clientObject.excludePatterns : [], clientKey, clientObject.clientNamespaceName, - clientObject.usesBackingStore, + clientObject.usesBackingStore ? clientObject.usesBackingStore : settings.backingStore, true, // clearCache true, // cleanOutput - clientObject.excludeBackwardCompatible, - clientObject.disabledValidationRules, + clientObject.excludeBackwardCompatible ? clientObject.excludeBackwardCompatible : settings.excludeBackwardCompatible , + clientObject.disabledValidationRules ? clientObject.disabledValidationRules : settings.disableValidationRules, settings.languagesSerializationConfiguration[language].serializers, settings.languagesSerializationConfiguration[language].deserializers, - clientObject.structuredMimeTypes, - clientObject.includeAdditionalData, + clientObject.structuredMimeTypes ? clientObject.structuredMimeTypes : settings.structuredMimeTypes, + clientObject.includeAdditionalData ? clientObject.includeAdditionalData : settings.includeAdditionalData, ConsumerOperation.Edit ); return result; @@ -471,7 +470,7 @@ export async function activate( openApiTreeProvider.setSelectionChanged(false); } async function regeneratePlugin(clientKey: string, clientObject:any, settings: ExtensionSettings, selectedPaths?: string[]) { - const pluginTypes = typeof clientObject.pluginTypes === 'string' ? parsePluginType(clientObject.pluginTypes) : KiotaPluginType.ApiPlugin; + const pluginTypes = Array.isArray(clientObject.types) ? parsePluginType(clientObject.types) : [KiotaPluginType.ApiPlugin]; await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, cancellable: false, @@ -480,9 +479,9 @@ export async function activate( const start = performance.now(); const result = await generatePlugin( context, - clientObject.descriptionLocation, + clientObject.descriptionLocation ? clientObject.descriptionLocation: openApiTreeProvider.descriptionUrl, clientObject.outputPath, - [pluginTypes], + pluginTypes, selectedPaths ? selectedPaths : clientObject.includePatterns, [], clientKey, diff --git a/vscode/microsoft-kiota/src/kiotaInterop.ts b/vscode/microsoft-kiota/src/kiotaInterop.ts index 055cde439b..7cb58467b5 100644 --- a/vscode/microsoft-kiota/src/kiotaInterop.ts +++ b/vscode/microsoft-kiota/src/kiotaInterop.ts @@ -126,18 +126,21 @@ export enum ConsumerOperation { // eslint-disable-next-line @typescript-eslint/naming-convention Generate } -export function parsePluginType(value: string): KiotaPluginType { - switch (value) { - case "OpenAI": - return KiotaPluginType.OpenAI; - case "ApiManifest": - return KiotaPluginType.ApiManifest; - case "ApiPlugin": - return KiotaPluginType.ApiPlugin; - default: - throw new Error("unknown plugin type"); - } +export function parsePluginType(values: string[]): KiotaPluginType[] { + return values.map(value => { + switch (value.toLowerCase()) { + case "openai": + return KiotaPluginType.OpenAI; + case "apimanifest": + return KiotaPluginType.ApiManifest; + case "apiplugin": + return KiotaPluginType.ApiPlugin; + default: + throw new Error(`unknown plugin type: ${value}`); + } + }); } + export function generationLanguageToString(language: KiotaGenerationLanguage): string { switch (language) { case KiotaGenerationLanguage.CSharp: