diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 201c89e305..226ba6eee7 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -22,7 +22,7 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4
- name: Login to GitHub package feed
- uses: docker/login-action@v3.1.0
+ uses: docker/login-action@v3.2.0
with:
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj
index 2091a26bad..92cd67ba5e 100644
--- a/it/csharp/dotnet.csproj
+++ b/it/csharp/dotnet.csproj
@@ -10,13 +10,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt
index 8c427b31f3..1279fe8035 100644
--- a/it/python/requirements-dev.txt
+++ b/it/python/requirements-dev.txt
@@ -64,13 +64,13 @@ wrapt==1.15.0 ; python_version < '3.11'
yapf==0.40.2
-zipp==3.18.2 ; python_version >= '3.7'
+zipp==3.19.0 ; python_version >= '3.7'
aiohttp==3.9.5 ; python_version >= '3.6'
aiosignal==1.3.1 ; python_version >= '3.7'
-anyio==4.3.0 ; python_version >= '3.7'
+anyio==4.4.0 ; python_version >= '3.7'
async-timeout==4.0.3 ; python_version >= '3.6'
diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json
index 3c940410fa..c0a08d4dc3 100644
--- a/it/typescript/package-lock.json
+++ b/it/typescript/package-lock.json
@@ -25,7 +25,7 @@
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.8.0",
- "esbuild": "^0.21.3",
+ "esbuild": "^0.21.4",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"minimist": "^1.2.8",
@@ -221,9 +221,9 @@
}
},
"node_modules/@esbuild/aix-ppc64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.3.tgz",
- "integrity": "sha512-yTgnwQpFVYfvvo4SvRFB0SwrW8YjOxEoT7wfMT7Ol5v7v5LDNvSGo67aExmxOb87nQNeWPVvaGBNfQ7BXcrZ9w==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.4.tgz",
+ "integrity": "sha512-Zrm+B33R4LWPLjDEVnEqt2+SLTATlru1q/xYKVn8oVTbiRBGmK2VIMoIYGJDGyftnGaC788IuzGFAlb7IQ0Y8A==",
"cpu": [
"ppc64"
],
@@ -237,9 +237,9 @@
}
},
"node_modules/@esbuild/android-arm": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.3.tgz",
- "integrity": "sha512-bviJOLMgurLJtF1/mAoJLxDZDL6oU5/ztMHnJQRejbJrSc9FFu0QoUoFhvi6qSKJEw9y5oGyvr9fuDtzJ30rNQ==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.4.tgz",
+ "integrity": "sha512-E7H/yTd8kGQfY4z9t3nRPk/hrhaCajfA3YSQSBrst8B+3uTcgsi8N+ZWYCaeIDsiVs6m65JPCaQN/DxBRclF3A==",
"cpu": [
"arm"
],
@@ -253,9 +253,9 @@
}
},
"node_modules/@esbuild/android-arm64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.3.tgz",
- "integrity": "sha512-c+ty9necz3zB1Y+d/N+mC6KVVkGUUOcm4ZmT5i/Fk5arOaY3i6CA3P5wo/7+XzV8cb4GrI/Zjp8NuOQ9Lfsosw==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.4.tgz",
+ "integrity": "sha512-fYFnz+ObClJ3dNiITySBUx+oNalYUT18/AryMxfovLkYWbutXsct3Wz2ZWAcGGppp+RVVX5FiXeLYGi97umisA==",
"cpu": [
"arm64"
],
@@ -269,9 +269,9 @@
}
},
"node_modules/@esbuild/android-x64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.3.tgz",
- "integrity": "sha512-JReHfYCRK3FVX4Ra+y5EBH1b9e16TV2OxrPAvzMsGeES0X2Ndm9ImQRI4Ket757vhc5XBOuGperw63upesclRw==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.4.tgz",
+ "integrity": "sha512-mDqmlge3hFbEPbCWxp4fM6hqq7aZfLEHZAKGP9viq9wMUBVQx202aDIfc3l+d2cKhUJM741VrCXEzRFhPDKH3Q==",
"cpu": [
"x64"
],
@@ -285,9 +285,9 @@
}
},
"node_modules/@esbuild/darwin-arm64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.3.tgz",
- "integrity": "sha512-U3fuQ0xNiAkXOmQ6w5dKpEvXQRSpHOnbw7gEfHCRXPeTKW9sBzVck6C5Yneb8LfJm0l6le4NQfkNPnWMSlTFUQ==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.4.tgz",
+ "integrity": "sha512-72eaIrDZDSiWqpmCzVaBD58c8ea8cw/U0fq/PPOTqE3c53D0xVMRt2ooIABZ6/wj99Y+h4ksT/+I+srCDLU9TA==",
"cpu": [
"arm64"
],
@@ -301,9 +301,9 @@
}
},
"node_modules/@esbuild/darwin-x64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.3.tgz",
- "integrity": "sha512-3m1CEB7F07s19wmaMNI2KANLcnaqryJxO1fXHUV5j1rWn+wMxdUYoPyO2TnAbfRZdi7ADRwJClmOwgT13qlP3Q==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.4.tgz",
+ "integrity": "sha512-uBsuwRMehGmw1JC7Vecu/upOjTsMhgahmDkWhGLWxIgUn2x/Y4tIwUZngsmVb6XyPSTXJYS4YiASKPcm9Zitag==",
"cpu": [
"x64"
],
@@ -317,9 +317,9 @@
}
},
"node_modules/@esbuild/freebsd-arm64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.3.tgz",
- "integrity": "sha512-fsNAAl5pU6wmKHq91cHWQT0Fz0vtyE1JauMzKotrwqIKAswwP5cpHUCxZNSTuA/JlqtScq20/5KZ+TxQdovU/g==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.4.tgz",
+ "integrity": "sha512-8JfuSC6YMSAEIZIWNL3GtdUT5NhUA/CMUCpZdDRolUXNAXEE/Vbpe6qlGLpfThtY5NwXq8Hi4nJy4YfPh+TwAg==",
"cpu": [
"arm64"
],
@@ -333,9 +333,9 @@
}
},
"node_modules/@esbuild/freebsd-x64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.3.tgz",
- "integrity": "sha512-tci+UJ4zP5EGF4rp8XlZIdq1q1a/1h9XuronfxTMCNBslpCtmk97Q/5qqy1Mu4zIc0yswN/yP/BLX+NTUC1bXA==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.4.tgz",
+ "integrity": "sha512-8d9y9eQhxv4ef7JmXny7591P/PYsDFc4+STaxC1GBv0tMyCdyWfXu2jBuqRsyhY8uL2HU8uPyscgE2KxCY9imQ==",
"cpu": [
"x64"
],
@@ -349,9 +349,9 @@
}
},
"node_modules/@esbuild/linux-arm": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.3.tgz",
- "integrity": "sha512-f6kz2QpSuyHHg01cDawj0vkyMwuIvN62UAguQfnNVzbge2uWLhA7TCXOn83DT0ZvyJmBI943MItgTovUob36SQ==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.4.tgz",
+ "integrity": "sha512-2rqFFefpYmpMs+FWjkzSgXg5vViocqpq5a1PSRgT0AvSgxoXmGF17qfGAzKedg6wAwyM7UltrKVo9kxaJLMF/g==",
"cpu": [
"arm"
],
@@ -365,9 +365,9 @@
}
},
"node_modules/@esbuild/linux-arm64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.3.tgz",
- "integrity": "sha512-vvG6R5g5ieB4eCJBQevyDMb31LMHthLpXTc2IGkFnPWS/GzIFDnaYFp558O+XybTmYrVjxnryru7QRleJvmZ6Q==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.4.tgz",
+ "integrity": "sha512-/GLD2orjNU50v9PcxNpYZi+y8dJ7e7/LhQukN3S4jNDXCKkyyiyAz9zDw3siZ7Eh1tRcnCHAo/WcqKMzmi4eMQ==",
"cpu": [
"arm64"
],
@@ -381,9 +381,9 @@
}
},
"node_modules/@esbuild/linux-ia32": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.3.tgz",
- "integrity": "sha512-HjCWhH7K96Na+66TacDLJmOI9R8iDWDDiqe17C7znGvvE4sW1ECt9ly0AJ3dJH62jHyVqW9xpxZEU1jKdt+29A==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.4.tgz",
+ "integrity": "sha512-pNftBl7m/tFG3t2m/tSjuYeWIffzwAZT9m08+9DPLizxVOsUl8DdFzn9HvJrTQwe3wvJnwTdl92AonY36w/25g==",
"cpu": [
"ia32"
],
@@ -397,9 +397,9 @@
}
},
"node_modules/@esbuild/linux-loong64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.3.tgz",
- "integrity": "sha512-BGpimEccmHBZRcAhdlRIxMp7x9PyJxUtj7apL2IuoG9VxvU/l/v1z015nFs7Si7tXUwEsvjc1rOJdZCn4QTU+Q==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.4.tgz",
+ "integrity": "sha512-cSD2gzCK5LuVX+hszzXQzlWya6c7hilO71L9h4KHwqI4qeqZ57bAtkgcC2YioXjsbfAv4lPn3qe3b00Zt+jIfQ==",
"cpu": [
"loong64"
],
@@ -413,9 +413,9 @@
}
},
"node_modules/@esbuild/linux-mips64el": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.3.tgz",
- "integrity": "sha512-5rMOWkp7FQGtAH3QJddP4w3s47iT20hwftqdm7b+loe95o8JU8ro3qZbhgMRy0VuFU0DizymF1pBKkn3YHWtsw==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.4.tgz",
+ "integrity": "sha512-qtzAd3BJh7UdbiXCrg6npWLYU0YpufsV9XlufKhMhYMJGJCdfX/G6+PNd0+v877X1JG5VmjBLUiFB0o8EUSicA==",
"cpu": [
"mips64el"
],
@@ -429,9 +429,9 @@
}
},
"node_modules/@esbuild/linux-ppc64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.3.tgz",
- "integrity": "sha512-h0zj1ldel89V5sjPLo5H1SyMzp4VrgN1tPkN29TmjvO1/r0MuMRwJxL8QY05SmfsZRs6TF0c/IDH3u7XYYmbAg==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.4.tgz",
+ "integrity": "sha512-yB8AYzOTaL0D5+2a4xEy7OVvbcypvDR05MsB/VVPVA7nL4hc5w5Dyd/ddnayStDgJE59fAgNEOdLhBxjfx5+dg==",
"cpu": [
"ppc64"
],
@@ -445,9 +445,9 @@
}
},
"node_modules/@esbuild/linux-riscv64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.3.tgz",
- "integrity": "sha512-dkAKcTsTJ+CRX6bnO17qDJbLoW37npd5gSNtSzjYQr0svghLJYGYB0NF1SNcU1vDcjXLYS5pO4qOW4YbFama4A==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.4.tgz",
+ "integrity": "sha512-Y5AgOuVzPjQdgU59ramLoqSSiXddu7F3F+LI5hYy/d1UHN7K5oLzYBDZe23QmQJ9PIVUXwOdKJ/jZahPdxzm9w==",
"cpu": [
"riscv64"
],
@@ -461,9 +461,9 @@
}
},
"node_modules/@esbuild/linux-s390x": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.3.tgz",
- "integrity": "sha512-vnD1YUkovEdnZWEuMmy2X2JmzsHQqPpZElXx6dxENcIwTu+Cu5ERax6+Ke1QsE814Zf3c6rxCfwQdCTQ7tPuXA==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.4.tgz",
+ "integrity": "sha512-Iqc/l/FFwtt8FoTK9riYv9zQNms7B8u+vAI/rxKuN10HgQIXaPzKZc479lZ0x6+vKVQbu55GdpYpeNWzjOhgbA==",
"cpu": [
"s390x"
],
@@ -477,9 +477,9 @@
}
},
"node_modules/@esbuild/linux-x64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.3.tgz",
- "integrity": "sha512-IOXOIm9WaK7plL2gMhsWJd+l2bfrhfilv0uPTptoRoSb2p09RghhQQp9YY6ZJhk/kqmeRt6siRdMSLLwzuT0KQ==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.4.tgz",
+ "integrity": "sha512-Td9jv782UMAFsuLZINfUpoF5mZIbAj+jv1YVtE58rFtfvoKRiKSkRGQfHTgKamLVT/fO7203bHa3wU122V/Bdg==",
"cpu": [
"x64"
],
@@ -493,9 +493,9 @@
}
},
"node_modules/@esbuild/netbsd-x64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.3.tgz",
- "integrity": "sha512-uTgCwsvQ5+vCQnqM//EfDSuomo2LhdWhFPS8VL8xKf+PKTCrcT/2kPPoWMTs22aB63MLdGMJiE3f1PHvCDmUOw==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.4.tgz",
+ "integrity": "sha512-Awn38oSXxsPMQxaV0Ipb7W/gxZtk5Tx3+W+rAPdZkyEhQ6968r9NvtkjhnhbEgWXYbgV+JEONJ6PcdBS+nlcpA==",
"cpu": [
"x64"
],
@@ -509,9 +509,9 @@
}
},
"node_modules/@esbuild/openbsd-x64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.3.tgz",
- "integrity": "sha512-vNAkR17Ub2MgEud2Wag/OE4HTSI6zlb291UYzHez/psiKarp0J8PKGDnAhMBcHFoOHMXHfExzmjMojJNbAStrQ==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.4.tgz",
+ "integrity": "sha512-IsUmQeCY0aU374R82fxIPu6vkOybWIMc3hVGZ3ChRwL9hA1TwY+tS0lgFWV5+F1+1ssuvvXt3HFqe8roCip8Hg==",
"cpu": [
"x64"
],
@@ -525,9 +525,9 @@
}
},
"node_modules/@esbuild/sunos-x64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.3.tgz",
- "integrity": "sha512-W8H9jlGiSBomkgmouaRoTXo49j4w4Kfbl6I1bIdO/vT0+0u4f20ko3ELzV3hPI6XV6JNBVX+8BC+ajHkvffIJA==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.4.tgz",
+ "integrity": "sha512-hsKhgZ4teLUaDA6FG/QIu2q0rI6I36tZVfM4DBZv3BG0mkMIdEnMbhc4xwLvLJSS22uWmaVkFkqWgIS0gPIm+A==",
"cpu": [
"x64"
],
@@ -541,9 +541,9 @@
}
},
"node_modules/@esbuild/win32-arm64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.3.tgz",
- "integrity": "sha512-EjEomwyLSCg8Ag3LDILIqYCZAq/y3diJ04PnqGRgq8/4O3VNlXyMd54j/saShaN4h5o5mivOjAzmU6C3X4v0xw==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.4.tgz",
+ "integrity": "sha512-UUfMgMoXPoA/bvGUNfUBFLCh0gt9dxZYIx9W4rfJr7+hKe5jxxHmfOK8YSH4qsHLLN4Ck8JZ+v7Q5fIm1huErg==",
"cpu": [
"arm64"
],
@@ -557,9 +557,9 @@
}
},
"node_modules/@esbuild/win32-ia32": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.3.tgz",
- "integrity": "sha512-WGiE/GgbsEwR33++5rzjiYsKyHywE8QSZPF7Rfx9EBfK3Qn3xyR6IjyCr5Uk38Kg8fG4/2phN7sXp4NPWd3fcw==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.4.tgz",
+ "integrity": "sha512-yIxbspZb5kGCAHWm8dexALQ9en1IYDfErzjSEq1KzXFniHv019VT3mNtTK7t8qdy4TwT6QYHI9sEZabONHg+aw==",
"cpu": [
"ia32"
],
@@ -573,9 +573,9 @@
}
},
"node_modules/@esbuild/win32-x64": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.3.tgz",
- "integrity": "sha512-xRxC0jaJWDLYvcUvjQmHCJSfMrgmUuvsoXgDeU/wTorQ1ngDdUBuFtgY3W1Pc5sprGAvZBtWdJX7RPg/iZZUqA==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.4.tgz",
+ "integrity": "sha512-sywLRD3UK/qRJt0oBwdpYLBibk7KiRfbswmWRDabuncQYSlf8aLEEUor/oP6KRz8KEG+HoiVLBhPRD5JWjS8Sg==",
"cpu": [
"x64"
],
@@ -1606,9 +1606,9 @@
}
},
"node_modules/esbuild": {
- "version": "0.21.3",
- "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.3.tgz",
- "integrity": "sha512-Kgq0/ZsAPzKrbOjCQcjoSmPoWhlcVnGAUo7jvaLHoxW1Drto0KGkR1xBNg2Cp43b9ImvxmPEJZ9xkfcnqPsfBw==",
+ "version": "0.21.4",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.4.tgz",
+ "integrity": "sha512-sFMcNNrj+Q0ZDolrp5pDhH0nRPN9hLIM3fRPwgbLYJeSHHgnXSnbV3xYgSVuOeLWH9c73VwmEverVzupIv5xuA==",
"dev": true,
"hasInstallScript": true,
"bin": {
@@ -1618,29 +1618,29 @@
"node": ">=12"
},
"optionalDependencies": {
- "@esbuild/aix-ppc64": "0.21.3",
- "@esbuild/android-arm": "0.21.3",
- "@esbuild/android-arm64": "0.21.3",
- "@esbuild/android-x64": "0.21.3",
- "@esbuild/darwin-arm64": "0.21.3",
- "@esbuild/darwin-x64": "0.21.3",
- "@esbuild/freebsd-arm64": "0.21.3",
- "@esbuild/freebsd-x64": "0.21.3",
- "@esbuild/linux-arm": "0.21.3",
- "@esbuild/linux-arm64": "0.21.3",
- "@esbuild/linux-ia32": "0.21.3",
- "@esbuild/linux-loong64": "0.21.3",
- "@esbuild/linux-mips64el": "0.21.3",
- "@esbuild/linux-ppc64": "0.21.3",
- "@esbuild/linux-riscv64": "0.21.3",
- "@esbuild/linux-s390x": "0.21.3",
- "@esbuild/linux-x64": "0.21.3",
- "@esbuild/netbsd-x64": "0.21.3",
- "@esbuild/openbsd-x64": "0.21.3",
- "@esbuild/sunos-x64": "0.21.3",
- "@esbuild/win32-arm64": "0.21.3",
- "@esbuild/win32-ia32": "0.21.3",
- "@esbuild/win32-x64": "0.21.3"
+ "@esbuild/aix-ppc64": "0.21.4",
+ "@esbuild/android-arm": "0.21.4",
+ "@esbuild/android-arm64": "0.21.4",
+ "@esbuild/android-x64": "0.21.4",
+ "@esbuild/darwin-arm64": "0.21.4",
+ "@esbuild/darwin-x64": "0.21.4",
+ "@esbuild/freebsd-arm64": "0.21.4",
+ "@esbuild/freebsd-x64": "0.21.4",
+ "@esbuild/linux-arm": "0.21.4",
+ "@esbuild/linux-arm64": "0.21.4",
+ "@esbuild/linux-ia32": "0.21.4",
+ "@esbuild/linux-loong64": "0.21.4",
+ "@esbuild/linux-mips64el": "0.21.4",
+ "@esbuild/linux-ppc64": "0.21.4",
+ "@esbuild/linux-riscv64": "0.21.4",
+ "@esbuild/linux-s390x": "0.21.4",
+ "@esbuild/linux-x64": "0.21.4",
+ "@esbuild/netbsd-x64": "0.21.4",
+ "@esbuild/openbsd-x64": "0.21.4",
+ "@esbuild/sunos-x64": "0.21.4",
+ "@esbuild/win32-arm64": "0.21.4",
+ "@esbuild/win32-ia32": "0.21.4",
+ "@esbuild/win32-x64": "0.21.4"
}
},
"node_modules/escape-html": {
diff --git a/it/typescript/package.json b/it/typescript/package.json
index 5186673005..e4d85d8a5b 100644
--- a/it/typescript/package.json
+++ b/it/typescript/package.json
@@ -22,7 +22,7 @@
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.8.0",
- "esbuild": "^0.21.3",
+ "esbuild": "^0.21.4",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"minimist": "^1.2.8",
diff --git a/src/Kiota.Builder/CodeDOM/CodeClass.cs b/src/Kiota.Builder/CodeDOM/CodeClass.cs
index 41a41061c2..1e5be4b934 100644
--- a/src/Kiota.Builder/CodeDOM/CodeClass.cs
+++ b/src/Kiota.Builder/CodeDOM/CodeClass.cs
@@ -45,6 +45,14 @@ public CodeComposedTypeBase? OriginalComposedType
{
get; set;
}
+ public string GetComponentSchemaName(CodeNamespace modelsNamespace)
+ {
+ if (Kind is not CodeClassKind.Model ||
+ Parent is not CodeNamespace parentNamespace ||
+ !parentNamespace.IsChildOf(modelsNamespace))
+ return string.Empty;
+ return $"{parentNamespace.Name[(modelsNamespace.Name.Length + 1)..]}.{Name}";
+ }
public CodeIndexer? Indexer => InnerChildElements.Values.OfType().FirstOrDefault(static x => !x.IsLegacyIndexer);
public void AddIndexer(params CodeIndexer[] indexers)
{
diff --git a/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs
index 272c31e57d..375d4f6ae7 100644
--- a/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs
+++ b/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs
@@ -29,7 +29,7 @@ public static IEnumerable GetSchemaNames(this OpenApiSchema schema, bool
internal static IEnumerable FlattenSchemaIfRequired(this IList schemas, Func> subsequentGetter)
{
if (schemas is null) return [];
- return schemas.Count == 1 && !schemas[0].HasAnyProperty() ?
+ return schemas.Count == 1 && !schemas[0].HasAnyProperty() && string.IsNullOrEmpty(schemas[0].Reference?.Id) ?
schemas.FlattenEmptyEntries(subsequentGetter, 1) :
schemas;
}
@@ -84,19 +84,36 @@ public static bool IsInherited(this OpenApiSchema? schema)
isRootSchemaMeaningful);
}
- internal static OpenApiSchema? MergeIntersectionSchemaEntries(this OpenApiSchema? schema, HashSet? schemasToExclude = default)
+ internal static OpenApiSchema? MergeAllOfSchemaEntries(this OpenApiSchema? schema, HashSet? schemasToExclude = default, Func? filter = default)
+ {
+ return schema.MergeIntersectionSchemaEntries(schemasToExclude, true, filter);
+ }
+
+ internal static OpenApiSchema? MergeIntersectionSchemaEntries(this OpenApiSchema? schema, HashSet? schemasToExclude = default, bool overrideIntersection = false, Func? filter = default)
{
if (schema is null) return null;
- if (!schema.IsIntersection()) return schema;
+ if (!schema.IsIntersection() && !overrideIntersection) return schema;
var result = new OpenApiSchema(schema);
result.AllOf.Clear();
var meaningfulSchemas = schema.AllOf
- .Where(static x => x.IsSemanticallyMeaningful() || x.AllOf.Any())
- .Select(x => MergeIntersectionSchemaEntries(x, schemasToExclude))
+ .Where(x => (x.IsSemanticallyMeaningful() || x.AllOf.Any()) && (filter == null || filter(x)))
+ .Select(x => MergeIntersectionSchemaEntries(x, schemasToExclude, overrideIntersection, filter))
.Where(x => x is not null && (schemasToExclude is null || !schemasToExclude.Contains(x)))
.OfType()
.ToArray();
- meaningfulSchemas.FlattenEmptyEntries(static x => x.AllOf).Union(meaningfulSchemas).SelectMany(static x => x.Properties).ToList().ForEach(x => result.Properties.TryAdd(x.Key, x.Value));
+ var entriesToMerge = meaningfulSchemas.FlattenEmptyEntries(static x => x.AllOf).Union(meaningfulSchemas).ToArray();
+ if (entriesToMerge.Select(static x => x.Discriminator).OfType().FirstOrDefault() is OpenApiDiscriminator discriminator)
+ if (result.Discriminator is null)
+ result.Discriminator = discriminator;
+ else if (string.IsNullOrEmpty(result.Discriminator.PropertyName) && !string.IsNullOrEmpty(discriminator.PropertyName))
+ result.Discriminator.PropertyName = discriminator.PropertyName;
+ else if (discriminator.Mapping?.Any() ?? false)
+ result.Discriminator.Mapping = discriminator.Mapping.ToDictionary(static x => x.Key, static x => x.Value);
+
+ foreach (var propertyToMerge in entriesToMerge.SelectMany(static x => x.Properties))
+ {
+ result.Properties.TryAdd(propertyToMerge.Key, propertyToMerge.Value);
+ }
return result;
}
@@ -225,8 +242,8 @@ internal static string GetDiscriminatorPropertyName(this OpenApiSchema schema)
return oneOfDiscriminatorPropertyName;
if (schema.AnyOf.Select(GetDiscriminatorPropertyName).FirstOrDefault(static x => !string.IsNullOrEmpty(x)) is string anyOfDiscriminatorPropertyName)
return anyOfDiscriminatorPropertyName;
- if (schema.AllOf.Any())
- return GetDiscriminatorPropertyName(schema.AllOf[^1]);
+ if (schema.AllOf.Select(GetDiscriminatorPropertyName).FirstOrDefault(static x => !string.IsNullOrEmpty(x)) is string allOfDiscriminatorPropertyName)
+ return allOfDiscriminatorPropertyName;
return string.Empty;
}
@@ -260,7 +277,7 @@ private static IEnumerable GetAllInheritanceSchemaReferences(string curr
ArgumentNullException.ThrowIfNull(inheritanceIndex);
if (inheritanceIndex.TryGetValue(currentReferenceId, out var dependents))
return dependents.Keys.Union(dependents.Keys.SelectMany(x => GetAllInheritanceSchemaReferences(x, inheritanceIndex))).Distinct(StringComparer.OrdinalIgnoreCase);
- return Enumerable.Empty();
+ return [];
}
}
diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs
index bb39714bf3..ef05625247 100644
--- a/src/Kiota.Builder/KiotaBuilder.cs
+++ b/src/Kiota.Builder/KiotaBuilder.cs
@@ -1578,7 +1578,7 @@ private string GetModelsNamespaceNameFromReferenceId(string? referenceId)
private CodeType CreateModelDeclarationAndType(OpenApiUrlTreeNode currentNode, OpenApiSchema schema, OpenApiOperation? operation, CodeNamespace codeNamespace, string classNameSuffix = "", OpenApiResponse? response = default, string typeNameForInlineSchema = "", bool isRequestBody = false)
{
var className = string.IsNullOrEmpty(typeNameForInlineSchema) ? currentNode.GetClassName(config.StructuredMimeTypes, operation: operation, suffix: classNameSuffix, response: response, schema: schema, requestBody: isRequestBody).CleanupSymbolName() : typeNameForInlineSchema;
- var codeDeclaration = AddModelDeclarationIfDoesntExist(currentNode, schema, className, codeNamespace);
+ var codeDeclaration = AddModelDeclarationIfDoesntExist(currentNode, operation, schema, className, codeNamespace);
return new CodeType
{
TypeDefinition = codeDeclaration,
@@ -1600,8 +1600,8 @@ private CodeClass CreateInheritedModelDeclaration(OpenApiUrlTreeNode currentNode
if (rootNamespace is null)
throw new InvalidOperationException("Root namespace is not set");
var shortestNamespace = string.IsNullOrEmpty(referenceId) ? codeNamespaceFromParent : rootNamespace.FindOrAddNamespace(shortestNamespaceName);
- var inlineSchema = Array.Find(flattenedAllOfs, static x => !x.IsReferencedSchema());
- var referencedSchema = Array.Find(flattenedAllOfs, static x => x.IsReferencedSchema());
+ var inlineSchemas = Array.FindAll(flattenedAllOfs, static x => !x.IsReferencedSchema());
+ var referencedSchemas = Array.FindAll(flattenedAllOfs, static x => x.IsReferencedSchema());
var rootSchemaHasProperties = schema.HasAnyProperty();
var className = (schema.GetSchemaName(schema.IsSemanticallyMeaningful()) is string cName && !string.IsNullOrEmpty(cName) ?
cName :
@@ -1609,32 +1609,53 @@ private CodeClass CreateInheritedModelDeclaration(OpenApiUrlTreeNode currentNode
typeNameForInlineSchema :
currentNode.GetClassName(config.StructuredMimeTypes, operation: operation, suffix: classNameSuffix, schema: schema, requestBody: isRequestBody)))
.CleanupSymbolName();
- var codeDeclaration = (rootSchemaHasProperties, inlineSchema, referencedSchema) switch
+ var codeDeclaration = (rootSchemaHasProperties, inlineSchemas, referencedSchemas) switch
{
// greatest parent type
- (true, null, null) => AddModelDeclarationIfDoesntExist(currentNode, schema, className, shortestNamespace),
+ (true, { Length: 0 }, { Length: 0 }) =>
+ AddModelDeclarationIfDoesntExist(currentNode, operation, schema, className, shortestNamespace),
// inline schema + referenced schema
- (false, not null, not null) => AddModelDeclarationIfDoesntExist(currentNode, inlineSchema, className, shortestNamespace, CreateInheritedModelDeclaration(currentNode, referencedSchema, operation, classNameSuffix, codeNamespace, isRequestBody, string.Empty)),
+ (false, { Length: > 0 }, { Length: 1 }) =>
+ AddModelDeclarationIfDoesntExist(currentNode, operation, schema.MergeAllOfSchemaEntries([.. referencedSchemas], static x => x.Reference is null)!, className, shortestNamespace, CreateInheritedModelDeclaration(currentNode, referencedSchemas[0], operation, classNameSuffix, codeNamespace, isRequestBody, string.Empty)),
// properties + referenced schema
- (true, null, not null) => AddModelDeclarationIfDoesntExist(currentNode, schema, className, shortestNamespace, CreateInheritedModelDeclaration(currentNode, referencedSchema, operation, classNameSuffix, codeNamespace, isRequestBody, string.Empty)),
+ (true, { Length: 0 }, { Length: 1 }) =>
+ AddModelDeclarationIfDoesntExist(currentNode, operation, schema, className, shortestNamespace, CreateInheritedModelDeclaration(currentNode, referencedSchemas[0], operation, classNameSuffix, codeNamespace, isRequestBody, string.Empty)),
// properties + inline schema
- (true, not null, null) => AddModelDeclarationIfDoesntExist(currentNode, schema, className, shortestNamespace, CreateInheritedModelDeclaration(currentNode, inlineSchema, operation, classNameSuffix, codeNamespace, isRequestBody, typeNameForInlineSchema)),
+ (true, { Length: 1 }, { Length: 0 }) =>
+ AddModelDeclarationIfDoesntExist(currentNode, operation, schema, className, shortestNamespace, CreateInheritedModelDeclaration(currentNode, inlineSchemas[0], operation, classNameSuffix, codeNamespace, isRequestBody, typeNameForInlineSchema)),
// empty schema + referenced schema
- (false, null, not null) => AddModelDeclarationIfDoesntExist(currentNode, referencedSchema, className, shortestNamespace),
+ (false, { Length: 0 }, { Length: 1 }) =>
+ AddModelDeclarationIfDoesntExist(currentNode, operation, referencedSchemas[0], className, shortestNamespace),
// empty schema + inline schema
- (false, not null, null) => AddModelDeclarationIfDoesntExist(currentNode, inlineSchema, className, shortestNamespace),
+ (false, { Length: 1 }, { Length: 0 }) =>
+ AddModelDeclarationIfDoesntExist(currentNode, operation, inlineSchemas[0], className, shortestNamespace),
// too much information but we can make a choice -> maps to properties + inline schema
- (true, not null, not null) when inlineSchema.HasAnyProperty() => AddModelDeclarationIfDoesntExist(currentNode, schema, className, shortestNamespace, CreateInheritedModelDeclaration(currentNode, inlineSchema, operation, classNameSuffix, codeNamespace, isRequestBody, typeNameForInlineSchema)),
+ (true, { Length: 1 }, { Length: 1 }) when inlineSchemas[0].HasAnyProperty() && !referencedSchemas[0].HasAnyProperty() =>
+ AddModelDeclarationIfDoesntExist(currentNode, operation, schema, className, shortestNamespace, CreateInheritedModelDeclaration(currentNode, inlineSchemas[0], operation, classNameSuffix, codeNamespace, isRequestBody, typeNameForInlineSchema)),
// too much information but we can make a choice -> maps to properties + referenced schema
- (true, not null, not null) when referencedSchema.HasAnyProperty() => AddModelDeclarationIfDoesntExist(currentNode, schema, className, shortestNamespace, CreateInheritedModelDeclaration(currentNode, referencedSchema, operation, classNameSuffix, codeNamespace, isRequestBody, string.Empty)),
+ (true, { Length: 1 }, { Length: 1 }) when referencedSchemas[0].HasAnyProperty() && !inlineSchemas[0].HasAnyProperty() =>
+ AddModelDeclarationIfDoesntExist(currentNode, operation, schema, className, shortestNamespace, CreateInheritedModelDeclaration(currentNode, referencedSchemas[0], operation, classNameSuffix, codeNamespace, isRequestBody, string.Empty)),
+ // too much information but we can merge root + inline schema
+ (true, { Length: 1 }, { Length: 1 }) when referencedSchemas[0].HasAnyProperty() && inlineSchemas[0].HasAnyProperty() && schema.MergeAllOfSchemaEntries([.. referencedSchemas]) is { } mergedSchema =>
+ AddModelDeclarationIfDoesntExist(currentNode, operation, mergedSchema, className, shortestNamespace, CreateInheritedModelDeclaration(currentNode, referencedSchemas[0], operation, classNameSuffix, codeNamespace, isRequestBody, string.Empty)),
+ // none of the allOf entries have properties, it's a grandparent schema
+ (true, { Length: 1 }, { Length: 1 }) =>
+ AddModelDeclarationIfDoesntExist(currentNode, operation, schema, className, shortestNamespace),
+ // too many entries, we mush everything together
+ (_, { Length: > 1 }, { Length: > 1 }) or (_, { Length: 0 or 1 }, { Length: > 1 }) or (_, { Length: > 1 }, { Length: 0 or 1 }) =>
+ AddModelDeclarationIfDoesntExist(currentNode, operation, schema.MergeAllOfSchemaEntries()!, className, shortestNamespace),
// meaningless scenario
- (false, null, null) or (true, not null, not null) => throw new InvalidOperationException("invalid inheritance case"),
+ (false, { Length: 0 }, { Length: 0 }) =>
+ throw new InvalidOperationException("the type does not contain any information"),
};
if (codeDeclaration is not CodeClass currentClass) throw new InvalidOperationException("Inheritance is only supported for classes");
if (!currentClass.Documentation.DescriptionAvailable &&
- string.IsNullOrEmpty(schema.AllOf.LastOrDefault()?.Description) &&
- !string.IsNullOrEmpty(schema.Description))
- currentClass.Documentation.DescriptionTemplate = schema.Description.CleanupDescription(); // the last allof entry often is not a reference and doesn't have a description.
+ new string[] { schema.Description }
+ .Union(schema.AllOf
+ .Where(static x => x.Reference is null)
+ .Select(static x => x.Description))
+ .FirstOrDefault(static x => !string.IsNullOrEmpty(x)) is string description)
+ currentClass.Documentation.DescriptionTemplate = description.CleanupDescription(); // the last allof entry often is not a reference and doesn't have a description.
return currentClass;
}
@@ -1660,7 +1681,7 @@ private CodeTypeBase CreateComposedModelDeclaration(OpenApiUrlTreeNode currentNo
var shortestNamespace = GetShortestNamespace(codeNamespace, targetSchema);
return new CodeType
{
- TypeDefinition = AddModelDeclarationIfDoesntExist(currentNode, targetSchema, className, shortestNamespace),
+ TypeDefinition = AddModelDeclarationIfDoesntExist(currentNode, operation, targetSchema, className, shortestNamespace),
CollectionKind = targetSchema.IsArray() ? CodeTypeBase.CodeTypeCollectionKind.Complex : default
};// so we don't create unnecessary union types when anyOf was used only for nullable.
}
@@ -1680,7 +1701,7 @@ private CodeTypeBase CreateComposedModelDeclaration(OpenApiUrlTreeNode currentNo
if (!string.IsNullOrEmpty(schema.Reference?.Id))
unionType.TargetNamespace = codeNamespace.GetRootNamespace().FindOrAddNamespace(GetModelsNamespaceNameFromReferenceId(schema.Reference.Id));
unionType.DiscriminatorInformation.DiscriminatorPropertyName = schema.GetDiscriminatorPropertyName();
- GetDiscriminatorMappings(currentNode, schema, codeNamespace, null)
+ GetDiscriminatorMappings(currentNode, schema, codeNamespace, null, operation)
?.ToList()
.ForEach(x => unionType.DiscriminatorInformation.AddDiscriminatorMapping(x.Key, x.Value));
var membersWithNoName = 0;
@@ -1699,7 +1720,7 @@ private CodeTypeBase CreateComposedModelDeclaration(OpenApiUrlTreeNode currentNo
className = $"{unionType.Name}Member{++membersWithNoName}";
var declarationType = new CodeType
{
- TypeDefinition = AddModelDeclarationIfDoesntExist(currentNode, currentSchema, className, shortestNamespace),
+ TypeDefinition = AddModelDeclarationIfDoesntExist(currentNode, operation, currentSchema, className, shortestNamespace),
CollectionKind = currentSchema.IsArray() ? CodeTypeBase.CodeTypeCollectionKind.Complex : default
};
if (!unionType.ContainsType(declarationType))
@@ -1788,23 +1809,20 @@ private CodeNamespace GetSearchNamespace(OpenApiUrlTreeNode currentNode, CodeNam
return currentNamespace;
}
private ConcurrentDictionary classLifecycles = new(StringComparer.OrdinalIgnoreCase);
- private CodeElement AddModelDeclarationIfDoesntExist(OpenApiUrlTreeNode currentNode, OpenApiSchema schema, string declarationName, CodeNamespace currentNamespace, CodeClass? inheritsFrom = null, OpenApiSchema? parentSchemaToExcludeForIntersections = null)
+ private CodeElement AddModelDeclarationIfDoesntExist(OpenApiUrlTreeNode currentNode, OpenApiOperation? currentOperation, OpenApiSchema schema, string declarationName, CodeNamespace currentNamespace, CodeClass? inheritsFrom = null)
{
if (GetExistingDeclaration(currentNamespace, currentNode, declarationName) is not CodeElement existingDeclaration) // we can find it in the components
{
if (AddEnumDeclaration(currentNode, schema, declarationName, currentNamespace) is CodeEnum enumDeclaration)
return enumDeclaration;
- if (schema.IsIntersection() &&
- (parentSchemaToExcludeForIntersections is null ?
- schema.MergeIntersectionSchemaEntries() :
- schema.MergeIntersectionSchemaEntries([parentSchemaToExcludeForIntersections])) is OpenApiSchema mergedSchema &&
- AddModelDeclarationIfDoesntExist(currentNode, mergedSchema, declarationName, currentNamespace, inheritsFrom) is CodeClass createdClass)
+ if (schema.IsIntersection() && schema.MergeIntersectionSchemaEntries() is { } mergedSchema &&
+ AddModelDeclarationIfDoesntExist(currentNode, currentOperation, mergedSchema, declarationName, currentNamespace, inheritsFrom) is CodeClass createdClass)
{
// multiple allOf entries that do not translate to inheritance
return createdClass;
}
- return AddModelClass(currentNode, schema, declarationName, currentNamespace, inheritsFrom);
+ return AddModelClass(currentNode, schema, declarationName, currentNamespace, currentOperation, inheritsFrom);
}
return existingDeclaration;
}
@@ -1880,13 +1898,13 @@ private CodeNamespace GetShortestNamespace(CodeNamespace currentNamespace, OpenA
}
return currentNamespace;
}
- private CodeClass AddModelClass(OpenApiUrlTreeNode currentNode, OpenApiSchema schema, string declarationName, CodeNamespace currentNamespace, CodeClass? inheritsFrom = null)
+ private CodeClass AddModelClass(OpenApiUrlTreeNode currentNode, OpenApiSchema schema, string declarationName, CodeNamespace currentNamespace, OpenApiOperation? currentOperation, CodeClass? inheritsFrom = null)
{
if (inheritsFrom == null && schema.AllOf.Where(static x => x.Reference != null).ToArray() is { Length: 1 } referencedSchemas)
{// any non-reference would be the current class in some description styles
var parentSchema = referencedSchemas[0];
var parentClassNamespace = GetShortestNamespace(currentNamespace, parentSchema);
- inheritsFrom = (CodeClass)AddModelDeclarationIfDoesntExist(currentNode, parentSchema, parentSchema.GetSchemaName().CleanupSymbolName(), parentClassNamespace);
+ inheritsFrom = (CodeClass)AddModelDeclarationIfDoesntExist(currentNode, currentOperation, parentSchema, parentSchema.GetSchemaName().CleanupSymbolName(), parentClassNamespace);
}
var newClassStub = new CodeClass
{
@@ -1931,17 +1949,21 @@ private CodeClass AddModelClass(OpenApiUrlTreeNode currentNode, OpenApiSchema sc
}
}
- var mappings = GetDiscriminatorMappings(currentNode, schema, currentNamespace, newClass)
+ var mappings = GetDiscriminatorMappings(currentNode, schema, currentNamespace, newClass, currentOperation)
.Where(x => x.Value is { TypeDefinition: CodeClass definition } &&
definition.DerivesFrom(newClass)); // only the mappings that derive from the current class
AddDiscriminatorMethod(newClass, schema.GetDiscriminatorPropertyName(), mappings, static s => s);
return newClass;
}
- private IEnumerable> GetDiscriminatorMappings(OpenApiUrlTreeNode currentNode, OpenApiSchema schema, CodeNamespace currentNamespace, CodeClass? baseClass)
+ private IEnumerable> GetDiscriminatorMappings(OpenApiUrlTreeNode currentNode, OpenApiSchema schema, CodeNamespace currentNamespace, CodeClass? baseClass, OpenApiOperation? currentOperation)
{
return schema.GetDiscriminatorMappings(inheritanceIndex)
- .Select(x => KeyValuePair.Create(x.Key, GetCodeTypeForMapping(currentNode, x.Value, currentNamespace, baseClass, schema)))
+ .Union(baseClass is not null && modelsNamespace is not null &&
+ (openApiDocument?.Components?.Schemas?.TryGetValue(baseClass.GetComponentSchemaName(modelsNamespace), out var componentSchema) ?? false) ?
+ componentSchema.GetDiscriminatorMappings(inheritanceIndex) :
+ [])
+ .Select(x => KeyValuePair.Create(x.Key, GetCodeTypeForMapping(currentNode, x.Value, currentNamespace, baseClass, currentOperation)))
.Where(static x => x.Value != null)
.Select(static x => KeyValuePair.Create(x.Key, x.Value!));
}
@@ -2115,7 +2137,7 @@ internal static void AddDiscriminatorMethod(CodeClass newClass, string discrimin
newClass.DiscriminatorInformation.DiscriminatorPropertyName = discriminatorPropertyName;
newClass.AddMethod(factoryMethod);
}
- private CodeType? GetCodeTypeForMapping(OpenApiUrlTreeNode currentNode, string referenceId, CodeNamespace currentNamespace, CodeClass? baseClass, OpenApiSchema currentSchema)
+ private CodeType? GetCodeTypeForMapping(OpenApiUrlTreeNode currentNode, string referenceId, CodeNamespace currentNamespace, CodeClass? baseClass, OpenApiOperation? currentOperation)
{
var componentKey = referenceId?.Replace("#/components/schemas/", string.Empty, StringComparison.OrdinalIgnoreCase);
if (openApiDocument == null || !openApiDocument.Components.Schemas.TryGetValue(componentKey, out var discriminatorSchema))
@@ -2123,56 +2145,40 @@ internal static void AddDiscriminatorMethod(CodeClass newClass, string discrimin
logger.LogWarning("Discriminator {ComponentKey} not found in the OpenAPI document.", componentKey);
return null;
}
- var className = currentNode.GetClassName(config.StructuredMimeTypes, schema: discriminatorSchema).CleanupSymbolName();
- var shouldInherit = discriminatorSchema.AllOf.Any(x => currentSchema.Reference?.Id.Equals(x.Reference?.Id, StringComparison.OrdinalIgnoreCase) ?? false);
- if (baseClass is not null && shouldInherit && !discriminatorSchema.IsInherited())
+ if (CreateModelDeclarations(currentNode, discriminatorSchema, currentOperation, GetShortestNamespace(currentNamespace, discriminatorSchema), string.Empty) is not CodeType result)
{
- logger.LogWarning("Discriminator {ComponentKey} is not inherited from {ClassName}.", componentKey, baseClass.Name);
+ logger.LogWarning("Discriminator {ComponentKey} is not a valid model and points to a union type.", componentKey);
return null;
}
- var codeClass = AddModelDeclarationIfDoesntExist(currentNode, discriminatorSchema, className, GetShortestNamespace(currentNamespace, discriminatorSchema), shouldInherit ? baseClass : null, currentSchema);
- return new CodeType
+ if (baseClass is not null && (result.TypeDefinition is not CodeClass codeClass || codeClass.StartBlock.Inherits is null))
{
- TypeDefinition = codeClass,
- };
+ logger.LogWarning("Discriminator {ComponentKey} is not inherited from {ClassName}.", componentKey, baseClass.Name);
+ return null;
+ }
+ return result;
}
private void CreatePropertiesForModelClass(OpenApiUrlTreeNode currentNode, OpenApiSchema schema, CodeNamespace ns, CodeClass model)
{
- if (CollectAllProperties(schema) is var properties && properties.Count != 0)
- {
- var propertiesToAdd = properties
- .Select(x =>
+ var propertiesToAdd = schema.Properties
+ .Select(x =>
+ {
+ var propertySchema = x.Value;
+ var className = $"{model.Name}_{x.Key.CleanupSymbolName()}";
+ var shortestNamespaceName = GetModelsNamespaceNameFromReferenceId(propertySchema.Reference?.Id);
+ var targetNamespace = string.IsNullOrEmpty(shortestNamespaceName) ? ns :
+ rootNamespace?.FindOrAddNamespace(shortestNamespaceName) ?? ns;
+ var definition = CreateModelDeclarations(currentNode, propertySchema, default, targetNamespace, string.Empty, typeNameForInlineSchema: className);
+ if (definition == null)
{
- var propertySchema = x.Value;
- var className = $"{model.Name}_{x.Key.CleanupSymbolName()}";
- var shortestNamespaceName = GetModelsNamespaceNameFromReferenceId(propertySchema.Reference?.Id);
- var targetNamespace = string.IsNullOrEmpty(shortestNamespaceName) ? ns :
- rootNamespace?.FindOrAddNamespace(shortestNamespaceName) ?? ns;
- var definition = CreateModelDeclarations(currentNode, propertySchema, default, targetNamespace, string.Empty, typeNameForInlineSchema: className);
- if (definition == null)
- {
- logger.LogWarning("Omitted property {PropertyName} for model {ModelName} in API path {ApiPath}, the schema is invalid.", x.Key, model.Name, currentNode.Path);
- return null;
- }
- return CreateProperty(x.Key, definition.Name, propertySchema: propertySchema, existingType: definition);
- })
- .OfType()
- .ToArray();
- if (propertiesToAdd.Length != 0)
- model.AddProperty(propertiesToAdd);
- }
- }
- private Dictionary CollectAllProperties(OpenApiSchema schema)
- {
- Dictionary result = schema.Properties?.ToDictionary(static x => x.Key, static x => x.Value, StringComparer.Ordinal) ?? new(StringComparer.Ordinal);
- if (schema.AllOf?.Any() ?? false)
- {
- foreach (var supProperty in schema.AllOf.Where(static x => !x.IsReferencedSchema() && x.HasAnyProperty()).SelectMany(static x => x.Properties))
- {
- result.Add(supProperty.Key, supProperty.Value);
- }
- }
- return result;
+ logger.LogWarning("Omitted property {PropertyName} for model {ModelName} in API path {ApiPath}, the schema is invalid.", x.Key, model.Name, currentNode.Path);
+ return null;
+ }
+ return CreateProperty(x.Key, definition.Name, propertySchema: propertySchema, existingType: definition);
+ })
+ .OfType()
+ .ToArray();
+ if (propertiesToAdd.Length != 0)
+ model.AddProperty(propertiesToAdd);
}
private const string FieldDeserializersMethodName = "GetFieldDeserializers";
private const string SerializeMethodName = "Serialize";
diff --git a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs
index 7240e27a4f..19c2d8a249 100644
--- a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs
+++ b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs
@@ -3487,9 +3487,10 @@ public async Task AddsDiscriminatorMappingsAllOfImplicitWithParentHavingMappings
var directoryObjectSchema = new OpenApiSchema
{
Type = "object",
- AllOf = new List {
+ AllOf = [
entitySchema,
- new OpenApiSchema {
+ new OpenApiSchema
+ {
Properties = new Dictionary {
{
"tenant", new OpenApiSchema {
@@ -3506,7 +3507,7 @@ public async Task AddsDiscriminatorMappingsAllOfImplicitWithParentHavingMappings
"@odata.type"
}
}
- },
+ ],
Reference = new OpenApiReference
{
Id = "microsoft.graph.directoryObject",
@@ -3517,9 +3518,10 @@ public async Task AddsDiscriminatorMappingsAllOfImplicitWithParentHavingMappings
var userSchema = new OpenApiSchema
{
Type = "object",
- AllOf = new List {
+ AllOf = [
directoryObjectSchema,
- new OpenApiSchema {
+ new OpenApiSchema
+ {
Properties = new Dictionary {
{
"firstName", new OpenApiSchema {
@@ -3536,7 +3538,7 @@ public async Task AddsDiscriminatorMappingsAllOfImplicitWithParentHavingMappings
"@odata.type"
}
}
- },
+ ],
Reference = new OpenApiReference
{
Id = "microsoft.graph.user",
@@ -7467,6 +7469,9 @@ public async Task InlineSchemaWithSingleAllOfReference()
var memberClass = codeModel.FindChildByName("member");
Assert.NotNull(memberClass);
Assert.Equal(2, memberClass.Properties.Count());// single prop plus additionalData
+ var memberProperty = memberClass.Properties.FirstOrDefault(static x => x.Name.Equals("group", StringComparison.OrdinalIgnoreCase));
+ Assert.NotNull(memberProperty);
+ Assert.Equal("group", memberProperty.Type.Name);
Assert.Null(memberClass.StartBlock.Inherits);//no base
var userClass = codeModel.FindChildByName("user");
Assert.NotNull(userClass);