diff --git a/core b/core index e6cf27481b..9c74e7767e 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit e6cf27481b40f7b09e83c249cf3607bd6e1e3b99 +Subproject commit 9c74e7767e776e3158d867143b1f13ff951971df diff --git a/typespec-extension/changelog.md b/typespec-extension/changelog.md index 253dbc1012..cf654642d8 100644 --- a/typespec-extension/changelog.md +++ b/typespec-extension/changelog.md @@ -1,5 +1,11 @@ # Release History +## 0.38.1 (2026-01-12) + +Compatible with compiler 1.7.1. + +- Updated package dependencies to latest versions. + ## 0.38.0 (2026-01-08) Compatible with compiler 1.7.1. diff --git a/typespec-extension/package-lock.json b/typespec-extension/package-lock.json index 86c10ae688..0dd3d8fd1f 100644 --- a/typespec-extension/package-lock.json +++ b/typespec-extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "@azure-tools/typespec-java", - "version": "0.38.0", + "version": "0.38.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@azure-tools/typespec-java", - "version": "0.38.0", + "version": "0.38.1", "license": "MIT", "dependencies": { "@autorest/codemodel": "~4.20.1", @@ -22,8 +22,8 @@ "@azure-tools/typespec-liftr-base": "0.11.0", "@microsoft/api-extractor": "^7.55.2", "@types/js-yaml": "~4.0.9", - "@types/lodash": "~4.17.21", - "@types/node": "~25.0.3", + "@types/lodash": "~4.17.23", + "@types/node": "~25.0.6", "@typescript-eslint/eslint-plugin": "~8.52.0", "@typescript-eslint/parser": "~8.52.0", "@typespec/compiler": "1.7.1", @@ -36,8 +36,8 @@ "@typespec/tspd": "0.73.2", "@typespec/versioning": "0.77.0", "@typespec/xml": "0.77.0", - "@vitest/coverage-v8": "^4.0.16", - "@vitest/ui": "^4.0.16", + "@vitest/coverage-v8": "^4.0.17", + "@vitest/ui": "^4.0.17", "c8": "~10.1.3", "eslint": "~9.39.2", "eslint-plugin-deprecation": "~3.0.0", @@ -47,7 +47,7 @@ "rimraf": "~6.1.2", "typescript": "~5.9.3", "typescript-eslint": "^8.52.0", - "vitest": "^4.0.16" + "vitest": "^4.0.17" }, "engines": { "node": ">=20.0.0" @@ -1820,9 +1820,9 @@ "license": "MIT" }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.5.tgz", - "integrity": "sha512-iDGS/h7D8t7tvZ1t6+WPK04KD0MwzLZrG0se1hzBjSi5fyxlsiggoJHwh18PCFNn7tG43OWb6pdZ6Y+rMlmyNQ==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.55.1.tgz", + "integrity": "sha512-9R0DM/ykwfGIlNu6+2U09ga0WXeZ9MRC2Ter8jnz8415VbuIykVuc6bhdrbORFZANDmTDvq26mJrEVTl8TdnDg==", "cpu": [ "arm" ], @@ -1834,9 +1834,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.5.tgz", - "integrity": "sha512-wrSAViWvZHBMMlWk6EJhvg8/rjxzyEhEdgfMMjREHEq11EtJ6IP6yfcCH57YAEca2Oe3FNCE9DSTgU70EIGmVw==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.55.1.tgz", + "integrity": "sha512-eFZCb1YUqhTysgW3sj/55du5cG57S7UTNtdMjCW7LwVcj3dTTcowCsC8p7uBdzKsZYa8J7IDE8lhMI+HX1vQvg==", "cpu": [ "arm64" ], @@ -1848,9 +1848,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.5.tgz", - "integrity": "sha512-S87zZPBmRO6u1YXQLwpveZm4JfPpAa6oHBX7/ghSiGH3rz/KDgAu1rKdGutV+WUI6tKDMbaBJomhnT30Y2t4VQ==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.55.1.tgz", + "integrity": "sha512-p3grE2PHcQm2e8PSGZdzIhCKbMCw/xi9XvMPErPhwO17vxtvCN5FEA2mSLgmKlCjHGMQTP6phuQTYWUnKewwGg==", "cpu": [ "arm64" ], @@ -1862,9 +1862,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.5.tgz", - "integrity": "sha512-YTbnsAaHo6VrAczISxgpTva8EkfQus0VPEVJCEaboHtZRIb6h6j0BNxRBOwnDciFTZLDPW5r+ZBmhL/+YpTZgA==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.55.1.tgz", + "integrity": "sha512-rDUjG25C9qoTm+e02Esi+aqTKSBYwVTaoS1wxcN47/Luqef57Vgp96xNANwt5npq9GDxsH7kXxNkJVEsWEOEaQ==", "cpu": [ "x64" ], @@ -1876,9 +1876,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.5.tgz", - "integrity": "sha512-1T8eY2J8rKJWzaznV7zedfdhD1BqVs1iqILhmHDq/bqCUZsrMt+j8VCTHhP0vdfbHK3e1IQ7VYx3jlKqwlf+vw==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.55.1.tgz", + "integrity": "sha512-+JiU7Jbp5cdxekIgdte0jfcu5oqw4GCKr6i3PJTlXTCU5H5Fvtkpbs4XJHRmWNXF+hKmn4v7ogI5OQPaupJgOg==", "cpu": [ "arm64" ], @@ -1890,9 +1890,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.5.tgz", - "integrity": "sha512-sHTiuXyBJApxRn+VFMaw1U+Qsz4kcNlxQ742snICYPrY+DDL8/ZbaC4DVIB7vgZmp3jiDaKA0WpBdP0aqPJoBQ==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.55.1.tgz", + "integrity": "sha512-V5xC1tOVWtLLmr3YUk2f6EJK4qksksOYiz/TCsFHu/R+woubcLWdC9nZQmwjOAbmExBIVKsm1/wKmEy4z4u4Bw==", "cpu": [ "x64" ], @@ -1904,9 +1904,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.5.tgz", - "integrity": "sha512-dV3T9MyAf0w8zPVLVBptVlzaXxka6xg1f16VAQmjg+4KMSTWDvhimI/Y6mp8oHwNrmnmVl9XxJ/w/mO4uIQONA==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.55.1.tgz", + "integrity": "sha512-Rn3n+FUk2J5VWx+ywrG/HGPTD9jXNbicRtTM11e/uorplArnXZYsVifnPPqNNP5BsO3roI4n8332ukpY/zN7rQ==", "cpu": [ "arm" ], @@ -1918,9 +1918,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.5.tgz", - "integrity": "sha512-wIGYC1x/hyjP+KAu9+ewDI+fi5XSNiUi9Bvg6KGAh2TsNMA3tSEs+Sh6jJ/r4BV/bx/CyWu2ue9kDnIdRyafcQ==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.55.1.tgz", + "integrity": "sha512-grPNWydeKtc1aEdrJDWk4opD7nFtQbMmV7769hiAaYyUKCT1faPRm2av8CX1YJsZ4TLAZcg9gTR1KvEzoLjXkg==", "cpu": [ "arm" ], @@ -1932,9 +1932,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.5.tgz", - "integrity": "sha512-Y+qVA0D9d0y2FRNiG9oM3Hut/DgODZbU9I8pLLPwAsU0tUKZ49cyV1tzmB/qRbSzGvY8lpgGkJuMyuhH7Ma+Vg==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.55.1.tgz", + "integrity": "sha512-a59mwd1k6x8tXKcUxSyISiquLwB5pX+fJW9TkWU46lCqD/GRDe9uDN31jrMmVP3feI3mhAdvcCClhV8V5MhJFQ==", "cpu": [ "arm64" ], @@ -1946,9 +1946,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.5.tgz", - "integrity": "sha512-juaC4bEgJsyFVfqhtGLz8mbopaWD+WeSOYr5E16y+1of6KQjc0BpwZLuxkClqY1i8sco+MdyoXPNiCkQou09+g==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.55.1.tgz", + "integrity": "sha512-puS1MEgWX5GsHSoiAsF0TYrpomdvkaXm0CofIMG5uVkP6IBV+ZO9xhC5YEN49nsgYo1DuuMquF9+7EDBVYu4uA==", "cpu": [ "arm64" ], @@ -1960,9 +1960,23 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.5.tgz", - "integrity": "sha512-rIEC0hZ17A42iXtHX+EPJVL/CakHo+tT7W0pbzdAGuWOt2jxDFh7A/lRhsNHBcqL4T36+UiAgwO8pbmn3dE8wA==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.55.1.tgz", + "integrity": "sha512-r3Wv40in+lTsULSb6nnoudVbARdOwb2u5fpeoOAZjFLznp6tDU8kd+GTHmJoqZ9lt6/Sys33KdIHUaQihFcu7g==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.55.1.tgz", + "integrity": "sha512-MR8c0+UxAlB22Fq4R+aQSPBayvYa3+9DrwG/i1TKQXFYEaoW3B5b/rkSRIypcZDdWjWnpcvxbNaAJDcSbJU3Lw==", "cpu": [ "loong64" ], @@ -1974,9 +1988,23 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.5.tgz", - "integrity": "sha512-T7l409NhUE552RcAOcmJHj3xyZ2h7vMWzcwQI0hvn5tqHh3oSoclf9WgTl+0QqffWFG8MEVZZP1/OBglKZx52Q==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.55.1.tgz", + "integrity": "sha512-3KhoECe1BRlSYpMTeVrD4sh2Pw2xgt4jzNSZIIPLFEsnQn9gAnZagW9+VqDqAHgm1Xc77LzJOo2LdigS5qZ+gw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.55.1.tgz", + "integrity": "sha512-ziR1OuZx0vdYZZ30vueNZTg73alF59DicYrPViG0NEgDVN8/Jl87zkAPu4u6VjZST2llgEUjaiNl9JM6HH1Vdw==", "cpu": [ "ppc64" ], @@ -1988,9 +2016,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.5.tgz", - "integrity": "sha512-7OK5/GhxbnrMcxIFoYfhV/TkknarkYC1hqUw1wU2xUN3TVRLNT5FmBv4KkheSG2xZ6IEbRAhTooTV2+R5Tk0lQ==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.55.1.tgz", + "integrity": "sha512-uW0Y12ih2XJRERZ4jAfKamTyIHVMPQnTZcQjme2HMVDAHY4amf5u414OqNYC+x+LzRdRcnIG1YodLrrtA8xsxw==", "cpu": [ "riscv64" ], @@ -2002,9 +2030,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.5.tgz", - "integrity": "sha512-GwuDBE/PsXaTa76lO5eLJTyr2k8QkPipAyOrs4V/KJufHCZBJ495VCGJol35grx9xryk4V+2zd3Ri+3v7NPh+w==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.55.1.tgz", + "integrity": "sha512-u9yZ0jUkOED1BFrqu3BwMQoixvGHGZ+JhJNkNKY/hyoEgOwlqKb62qu+7UjbPSHYjiVy8kKJHvXKv5coH4wDeg==", "cpu": [ "riscv64" ], @@ -2016,9 +2044,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.5.tgz", - "integrity": "sha512-IAE1Ziyr1qNfnmiQLHBURAD+eh/zH1pIeJjeShleII7Vj8kyEm2PF77o+lf3WTHDpNJcu4IXJxNO0Zluro8bOw==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.55.1.tgz", + "integrity": "sha512-/0PenBCmqM4ZUd0190j7J0UsQ/1nsi735iPRakO8iPciE7BQ495Y6msPzaOmvx0/pn+eJVVlZrNrSh4WSYLxNg==", "cpu": [ "s390x" ], @@ -2030,9 +2058,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.5.tgz", - "integrity": "sha512-Pg6E+oP7GvZ4XwgRJBuSXZjcqpIW3yCBhK4BcsANvb47qMvAbCjR6E+1a/U2WXz1JJxp9/4Dno3/iSJLcm5auw==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.55.1.tgz", + "integrity": "sha512-a8G4wiQxQG2BAvo+gU6XrReRRqj+pLS2NGXKm8io19goR+K8lw269eTrPkSdDTALwMmJp4th2Uh0D8J9bEV1vg==", "cpu": [ "x64" ], @@ -2044,9 +2072,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.5.tgz", - "integrity": "sha512-txGtluxDKTxaMDzUduGP0wdfng24y1rygUMnmlUJ88fzCCULCLn7oE5kb2+tRB+MWq1QDZT6ObT5RrR8HFRKqg==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.55.1.tgz", + "integrity": "sha512-bD+zjpFrMpP/hqkfEcnjXWHMw5BIghGisOKPj+2NaNDuVT+8Ds4mPf3XcPHuat1tz89WRL+1wbcxKY3WSbiT7w==", "cpu": [ "x64" ], @@ -2057,10 +2085,24 @@ "linux" ] }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.55.1.tgz", + "integrity": "sha512-eLXw0dOiqE4QmvikfQ6yjgkg/xDM+MdU9YJuP4ySTibXU0oAvnEWXt7UDJmD4UkYialMfOGFPJnIHSe/kdzPxg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.5.tgz", - "integrity": "sha512-3DFiLPnTxiOQV993fMc+KO8zXHTcIjgaInrqlG8zDp1TlhYl6WgrOHuJkJQ6M8zHEcntSJsUp1XFZSY8C1DYbg==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.55.1.tgz", + "integrity": "sha512-xzm44KgEP11te3S2HCSyYf5zIzWmx3n8HDCc7EE59+lTcswEWNpvMLfd9uJvVX8LCg9QWG67Xt75AuHn4vgsXw==", "cpu": [ "arm64" ], @@ -2072,9 +2114,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.5.tgz", - "integrity": "sha512-nggc/wPpNTgjGg75hu+Q/3i32R00Lq1B6N1DO7MCU340MRKL3WZJMjA9U4K4gzy3dkZPXm9E1Nc81FItBVGRlA==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.55.1.tgz", + "integrity": "sha512-yR6Bl3tMC/gBok5cz/Qi0xYnVbIxGx5Fcf/ca0eB6/6JwOY+SRUcJfI0OpeTpPls7f194as62thCt/2BjxYN8g==", "cpu": [ "arm64" ], @@ -2086,9 +2128,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.5.tgz", - "integrity": "sha512-U/54pTbdQpPLBdEzCT6NBCFAfSZMvmjr0twhnD9f4EIvlm9wy3jjQ38yQj1AGznrNO65EWQMgm/QUjuIVrYF9w==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.55.1.tgz", + "integrity": "sha512-3fZBidchE0eY0oFZBnekYCfg+5wAB0mbpCBuofh5mZuzIU/4jIVkbESmd2dOsFNS78b53CYv3OAtwqkZZmU5nA==", "cpu": [ "ia32" ], @@ -2100,9 +2142,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.5.tgz", - "integrity": "sha512-2NqKgZSuLH9SXBBV2dWNRCZmocgSOx8OJSdpRaEcRlIfX8YrKxUT6z0F1NpvDVhOsl190UFTRh2F2WDWWCYp3A==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.55.1.tgz", + "integrity": "sha512-xGGY5pXj69IxKb4yv/POoocPy/qmEGhimy/FoTpTSVju3FYXUQQMFCaZZXJVidsmGxRioZAwpThl/4zX41gRKg==", "cpu": [ "x64" ], @@ -2114,9 +2156,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.5.tgz", - "integrity": "sha512-JRpZUhCfhZ4keB5v0fe02gQJy05GqboPOaxvjugW04RLSYYoB/9t2lx2u/tMs/Na/1NXfY8QYjgRljRpN+MjTQ==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.55.1.tgz", + "integrity": "sha512-SPEpaL6DX4rmcXtnhdrQYgzQ5W2uW3SCJch88lB2zImhJRhIIK44fkUrgIV/Q8yUNfw5oyZ5vkeQsZLhCb06lw==", "cpu": [ "x64" ], @@ -2413,16 +2455,16 @@ "license": "MIT" }, "node_modules/@types/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-FOvQ0YPD5NOfPgMzJihoT+Za5pdkDJWcbpuj1DjaKZIr/gxodQjY/uWEFlTNqW2ugXHUiL8lRQgw63dzKHZdeQ==", + "version": "4.17.23", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.23.tgz", + "integrity": "sha512-RDvF6wTulMPjrNdCoYRC8gNR880JNGT8uB+REUpC2Ns4pRqQJhGz90wh7rgdXDPpCczF3VGktDuFGVnz8zP7HA==", "dev": true, "license": "MIT" }, "node_modules/@types/node": { - "version": "25.0.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.3.tgz", - "integrity": "sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA==", + "version": "25.0.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.6.tgz", + "integrity": "sha512-NNu0sjyNxpoiW3YuVFfNz7mxSQ+S4X2G28uqg2s+CzoqoQjLPsWSbsFFyztIAqt2vb8kfEAsJNepMGPTxFDx3Q==", "dev": true, "license": "MIT", "dependencies": { @@ -3228,18 +3270,17 @@ } }, "node_modules/@vitest/coverage-v8": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-4.0.16.tgz", - "integrity": "sha512-2rNdjEIsPRzsdu6/9Eq0AYAzYdpP6Bx9cje9tL3FE5XzXRQF1fNU9pe/1yE8fCrS0HD+fBtt6gLPh6LI57tX7A==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-4.0.17.tgz", + "integrity": "sha512-/6zU2FLGg0jsd+ePZcwHRy3+WpNTBBhDY56P4JTRqUN/Dp6CvOEa9HrikcQ4KfV2b2kAHUFB4dl1SuocWXSFEw==", "dev": true, "license": "MIT", "dependencies": { "@bcoe/v8-coverage": "^1.0.2", - "@vitest/utils": "4.0.16", - "ast-v8-to-istanbul": "^0.3.8", + "@vitest/utils": "4.0.17", + "ast-v8-to-istanbul": "^0.3.10", "istanbul-lib-coverage": "^3.2.2", "istanbul-lib-report": "^3.0.1", - "istanbul-lib-source-maps": "^5.0.6", "istanbul-reports": "^3.2.0", "magicast": "^0.5.1", "obug": "^2.1.1", @@ -3250,8 +3291,8 @@ "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "@vitest/browser": "4.0.16", - "vitest": "4.0.16" + "@vitest/browser": "4.0.17", + "vitest": "4.0.17" }, "peerDependenciesMeta": { "@vitest/browser": { @@ -3260,16 +3301,16 @@ } }, "node_modules/@vitest/expect": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.0.16.tgz", - "integrity": "sha512-eshqULT2It7McaJkQGLkPjPjNph+uevROGuIMJdG3V+0BSR2w9u6J9Lwu+E8cK5TETlfou8GRijhafIMhXsimA==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.0.17.tgz", + "integrity": "sha512-mEoqP3RqhKlbmUmntNDDCJeTDavDR+fVYkSOw8qRwJFaW/0/5zA9zFeTrHqNtcmwh6j26yMmwx2PqUDPzt5ZAQ==", "dev": true, "license": "MIT", "dependencies": { "@standard-schema/spec": "^1.0.0", "@types/chai": "^5.2.2", - "@vitest/spy": "4.0.16", - "@vitest/utils": "4.0.16", + "@vitest/spy": "4.0.17", + "@vitest/utils": "4.0.17", "chai": "^6.2.1", "tinyrainbow": "^3.0.3" }, @@ -3278,13 +3319,13 @@ } }, "node_modules/@vitest/mocker": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.0.16.tgz", - "integrity": "sha512-yb6k4AZxJTB+q9ycAvsoxGn+j/po0UaPgajllBgt1PzoMAAmJGYFdDk0uCcRcxb3BrME34I6u8gHZTQlkqSZpg==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.0.17.tgz", + "integrity": "sha512-+ZtQhLA3lDh1tI2wxe3yMsGzbp7uuJSWBM1iTIKCbppWTSBN09PUC+L+fyNlQApQoR+Ps8twt2pbSSXg2fQVEQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "4.0.16", + "@vitest/spy": "4.0.17", "estree-walker": "^3.0.3", "magic-string": "^0.30.21" }, @@ -3305,9 +3346,9 @@ } }, "node_modules/@vitest/pretty-format": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.0.16.tgz", - "integrity": "sha512-eNCYNsSty9xJKi/UdVD8Ou16alu7AYiS2fCPRs0b1OdhJiV89buAXQLpTbe+X8V9L6qrs9CqyvU7OaAopJYPsA==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.0.17.tgz", + "integrity": "sha512-Ah3VAYmjcEdHg6+MwFE17qyLqBHZ+ni2ScKCiW2XrlSBV4H3Z7vYfPfz7CWQ33gyu76oc0Ai36+kgLU3rfF4nw==", "dev": true, "license": "MIT", "dependencies": { @@ -3318,13 +3359,13 @@ } }, "node_modules/@vitest/runner": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.0.16.tgz", - "integrity": "sha512-VWEDm5Wv9xEo80ctjORcTQRJ539EGPB3Pb9ApvVRAY1U/WkHXmmYISqU5E79uCwcW7xYUV38gwZD+RV755fu3Q==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.0.17.tgz", + "integrity": "sha512-JmuQyf8aMWoo/LmNFppdpkfRVHJcsgzkbCA+/Bk7VfNH7RE6Ut2qxegeyx2j3ojtJtKIbIGy3h+KxGfYfk28YQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "4.0.16", + "@vitest/utils": "4.0.17", "pathe": "^2.0.3" }, "funding": { @@ -3332,13 +3373,13 @@ } }, "node_modules/@vitest/snapshot": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.0.16.tgz", - "integrity": "sha512-sf6NcrYhYBsSYefxnry+DR8n3UV4xWZwWxYbCJUt2YdvtqzSPR7VfGrY0zsv090DAbjFZsi7ZaMi1KnSRyK1XA==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.0.17.tgz", + "integrity": "sha512-npPelD7oyL+YQM2gbIYvlavlMVWUfNNGZPcu0aEUQXt7FXTuqhmgiYupPnAanhKvyP6Srs2pIbWo30K0RbDtRQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "4.0.16", + "@vitest/pretty-format": "4.0.17", "magic-string": "^0.30.21", "pathe": "^2.0.3" }, @@ -3347,9 +3388,9 @@ } }, "node_modules/@vitest/spy": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.0.16.tgz", - "integrity": "sha512-4jIOWjKP0ZUaEmJm00E0cOBLU+5WE0BpeNr3XN6TEF05ltro6NJqHWxXD0kA8/Zc8Nh23AT8WQxwNG+WeROupw==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.0.17.tgz", + "integrity": "sha512-I1bQo8QaP6tZlTomQNWKJE6ym4SHf3oLS7ceNjozxxgzavRAgZDc06T7kD8gb9bXKEgcLNt00Z+kZO6KaJ62Ew==", "dev": true, "license": "MIT", "funding": { @@ -3357,13 +3398,13 @@ } }, "node_modules/@vitest/ui": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-4.0.16.tgz", - "integrity": "sha512-rkoPH+RqWopVxDnCBE/ysIdfQ2A7j1eDmW8tCxxrR9nnFBa9jKf86VgsSAzxBd1x+ny0GC4JgiD3SNfRHv3pOg==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-4.0.17.tgz", + "integrity": "sha512-hRDjg6dlDz7JlZAvjbiCdAJ3SDG+NH8tjZe21vjxfvT2ssYAn72SRXMge3dKKABm3bIJ3C+3wdunIdur8PHEAw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "4.0.16", + "@vitest/utils": "4.0.17", "fflate": "^0.8.2", "flatted": "^3.3.3", "pathe": "^2.0.3", @@ -3375,17 +3416,17 @@ "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "vitest": "4.0.16" + "vitest": "4.0.17" } }, "node_modules/@vitest/utils": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.0.16.tgz", - "integrity": "sha512-h8z9yYhV3e1LEfaQ3zdypIrnAg/9hguReGZoS7Gl0aBG5xgA410zBqECqmaF/+RkTggRsfnzc1XaAHA6bmUufA==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.0.17.tgz", + "integrity": "sha512-RG6iy+IzQpa9SB8HAFHJ9Y+pTzI+h8553MrciN9eC6TFBErqrQaTas4vG+MVj8S4uKk8uTT2p0vgZPnTdxd96w==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "4.0.16", + "@vitest/pretty-format": "4.0.17", "tinyrainbow": "^3.0.3" }, "funding": { @@ -3652,9 +3693,9 @@ } }, "node_modules/ast-v8-to-istanbul": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/ast-v8-to-istanbul/-/ast-v8-to-istanbul-0.3.8.tgz", - "integrity": "sha512-szgSZqUxI5T8mLKvS7WTjF9is+MVbOeLADU73IseOcrqhxr/VAvy6wfoVE39KnKzA7JRhjF5eUagNlHwvZPlKQ==", + "version": "0.3.10", + "resolved": "https://registry.npmjs.org/ast-v8-to-istanbul/-/ast-v8-to-istanbul-0.3.10.tgz", + "integrity": "sha512-p4K7vMz2ZSk3wN8l5o3y2bJAoZXT3VuJI5OLTATY/01CYWumWvwkUw0SqDBnNq6IiTO3qDa1eSQDibAV8g7XOQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3895,9 +3936,9 @@ "license": "CC-BY-4.0" }, "node_modules/chai": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.1.tgz", - "integrity": "sha512-p4Z49OGG5W/WBCPSS/dH3jQ73kD6tiMmUM+bckNK6Jr5JHMG3k9bg/BvKR8lKmtVBKmOiuVaV2ws8s9oSbwysg==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", + "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", "dev": true, "license": "MIT", "engines": { @@ -6225,20 +6266,6 @@ "node": ">=10" } }, - "node_modules/istanbul-lib-source-maps": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz", - "integrity": "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.23", - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/istanbul-reports": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz", @@ -7220,9 +7247,9 @@ } }, "node_modules/rollup": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.5.tgz", - "integrity": "sha512-iTNAbFSlRpcHeeWu73ywU/8KuU/LZmNCSxp6fjQkJBD3ivUb8tpDrXhIxEzA05HlYMEwmtaUnb3RP+YNv162OQ==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.55.1.tgz", + "integrity": "sha512-wDv/Ht1BNHB4upNbK74s9usvl7hObDnvVzknxqY/E/O3X6rW1U1rV1aENEfJ54eFZDTNo7zv1f5N4edCluH7+A==", "dev": true, "license": "MIT", "dependencies": { @@ -7236,28 +7263,31 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.53.5", - "@rollup/rollup-android-arm64": "4.53.5", - "@rollup/rollup-darwin-arm64": "4.53.5", - "@rollup/rollup-darwin-x64": "4.53.5", - "@rollup/rollup-freebsd-arm64": "4.53.5", - "@rollup/rollup-freebsd-x64": "4.53.5", - "@rollup/rollup-linux-arm-gnueabihf": "4.53.5", - "@rollup/rollup-linux-arm-musleabihf": "4.53.5", - "@rollup/rollup-linux-arm64-gnu": "4.53.5", - "@rollup/rollup-linux-arm64-musl": "4.53.5", - "@rollup/rollup-linux-loong64-gnu": "4.53.5", - "@rollup/rollup-linux-ppc64-gnu": "4.53.5", - "@rollup/rollup-linux-riscv64-gnu": "4.53.5", - "@rollup/rollup-linux-riscv64-musl": "4.53.5", - "@rollup/rollup-linux-s390x-gnu": "4.53.5", - "@rollup/rollup-linux-x64-gnu": "4.53.5", - "@rollup/rollup-linux-x64-musl": "4.53.5", - "@rollup/rollup-openharmony-arm64": "4.53.5", - "@rollup/rollup-win32-arm64-msvc": "4.53.5", - "@rollup/rollup-win32-ia32-msvc": "4.53.5", - "@rollup/rollup-win32-x64-gnu": "4.53.5", - "@rollup/rollup-win32-x64-msvc": "4.53.5", + "@rollup/rollup-android-arm-eabi": "4.55.1", + "@rollup/rollup-android-arm64": "4.55.1", + "@rollup/rollup-darwin-arm64": "4.55.1", + "@rollup/rollup-darwin-x64": "4.55.1", + "@rollup/rollup-freebsd-arm64": "4.55.1", + "@rollup/rollup-freebsd-x64": "4.55.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.55.1", + "@rollup/rollup-linux-arm-musleabihf": "4.55.1", + "@rollup/rollup-linux-arm64-gnu": "4.55.1", + "@rollup/rollup-linux-arm64-musl": "4.55.1", + "@rollup/rollup-linux-loong64-gnu": "4.55.1", + "@rollup/rollup-linux-loong64-musl": "4.55.1", + "@rollup/rollup-linux-ppc64-gnu": "4.55.1", + "@rollup/rollup-linux-ppc64-musl": "4.55.1", + "@rollup/rollup-linux-riscv64-gnu": "4.55.1", + "@rollup/rollup-linux-riscv64-musl": "4.55.1", + "@rollup/rollup-linux-s390x-gnu": "4.55.1", + "@rollup/rollup-linux-x64-gnu": "4.55.1", + "@rollup/rollup-linux-x64-musl": "4.55.1", + "@rollup/rollup-openbsd-x64": "4.55.1", + "@rollup/rollup-openharmony-arm64": "4.55.1", + "@rollup/rollup-win32-arm64-msvc": "4.55.1", + "@rollup/rollup-win32-ia32-msvc": "4.55.1", + "@rollup/rollup-win32-x64-gnu": "4.55.1", + "@rollup/rollup-win32-x64-msvc": "4.55.1", "fsevents": "~2.3.2" } }, @@ -8233,9 +8263,9 @@ } }, "node_modules/vite": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.0.tgz", - "integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz", + "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==", "dev": true, "license": "MIT", "dependencies": { @@ -8339,19 +8369,19 @@ } }, "node_modules/vitest": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.0.16.tgz", - "integrity": "sha512-E4t7DJ9pESL6E3I8nFjPa4xGUd3PmiWDLsDztS2qXSJWfHtbQnwAWylaBvSNY48I3vr8PTqIZlyK8TE3V3CA4Q==", + "version": "4.0.17", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.0.17.tgz", + "integrity": "sha512-FQMeF0DJdWY0iOnbv466n/0BudNdKj1l5jYgl5JVTwjSsZSlqyXFt/9+1sEyhR6CLowbZpV7O1sCHrzBhucKKg==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/expect": "4.0.16", - "@vitest/mocker": "4.0.16", - "@vitest/pretty-format": "4.0.16", - "@vitest/runner": "4.0.16", - "@vitest/snapshot": "4.0.16", - "@vitest/spy": "4.0.16", - "@vitest/utils": "4.0.16", + "@vitest/expect": "4.0.17", + "@vitest/mocker": "4.0.17", + "@vitest/pretty-format": "4.0.17", + "@vitest/runner": "4.0.17", + "@vitest/snapshot": "4.0.17", + "@vitest/spy": "4.0.17", + "@vitest/utils": "4.0.17", "es-module-lexer": "^1.7.0", "expect-type": "^1.2.2", "magic-string": "^0.30.21", @@ -8379,10 +8409,10 @@ "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", - "@vitest/browser-playwright": "4.0.16", - "@vitest/browser-preview": "4.0.16", - "@vitest/browser-webdriverio": "4.0.16", - "@vitest/ui": "4.0.16", + "@vitest/browser-playwright": "4.0.17", + "@vitest/browser-preview": "4.0.17", + "@vitest/browser-webdriverio": "4.0.17", + "@vitest/ui": "4.0.17", "happy-dom": "*", "jsdom": "*" }, diff --git a/typespec-extension/package.json b/typespec-extension/package.json index 67fd1cdc67..a9a08d1258 100644 --- a/typespec-extension/package.json +++ b/typespec-extension/package.json @@ -1,6 +1,6 @@ { "name": "@azure-tools/typespec-java", - "version": "0.38.0", + "version": "0.38.1", "description": "TypeSpec library for emitting Java client from the TypeSpec REST protocol binding", "keywords": [ "TypeSpec" @@ -74,8 +74,8 @@ "@azure-tools/typespec-liftr-base": "0.11.0", "@microsoft/api-extractor": "^7.55.2", "@types/js-yaml": "~4.0.9", - "@types/lodash": "~4.17.21", - "@types/node": "~25.0.3", + "@types/lodash": "~4.17.23", + "@types/node": "~25.0.6", "@typescript-eslint/eslint-plugin": "~8.52.0", "@typescript-eslint/parser": "~8.52.0", "@typespec/compiler": "1.7.1", @@ -88,8 +88,8 @@ "@typespec/tspd": "0.73.2", "@typespec/versioning": "0.77.0", "@typespec/xml": "0.77.0", - "@vitest/coverage-v8": "^4.0.16", - "@vitest/ui": "^4.0.16", + "@vitest/coverage-v8": "^4.0.17", + "@vitest/ui": "^4.0.17", "c8": "~10.1.3", "eslint": "~9.39.2", "eslint-plugin-deprecation": "~3.0.0", @@ -99,7 +99,7 @@ "rimraf": "~6.1.2", "typescript": "~5.9.3", "typescript-eslint": "^8.52.0", - "vitest": "^4.0.16" + "vitest": "^4.0.17" }, "overrides": { "eslint": "~9.39.2", diff --git a/typespec-tests/package.json b/typespec-tests/package.json index 29b0ed3f4d..2fe5f0148f 100644 --- a/typespec-tests/package.json +++ b/typespec-tests/package.json @@ -13,7 +13,7 @@ "@typespec/spector": "0.1.0-alpha.21", "@typespec/http-specs": "0.1.0-alpha.29", "@azure-tools/azure-http-specs": "0.1.0-alpha.34", - "@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.38.0.tgz" + "@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.38.1.tgz" }, "devDependencies": { "@typespec/prettier-plugin-typespec": "^1.7.0", diff --git a/typespec-tests/src/main/java/tsptest/armstreamstyleserialization/models/SawShark.java b/typespec-tests/src/main/java/tsptest/armstreamstyleserialization/models/SawShark.java index dad701b3bc..49590e9c11 100644 --- a/typespec-tests/src/main/java/tsptest/armstreamstyleserialization/models/SawShark.java +++ b/typespec-tests/src/main/java/tsptest/armstreamstyleserialization/models/SawShark.java @@ -276,7 +276,6 @@ public void validate() { public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeIntField("age", age()); jsonWriter.writeJsonField("properties", innerProperties()); jsonWriter.writeJsonField("anotherProperties", innerAnotherProperties()); jsonWriter.writeStringField("dna", this.dna); diff --git a/typespec-tests/src/main/java/tsptest/subclass/SubclassAsyncClient.java b/typespec-tests/src/main/java/tsptest/subclass/SubclassAsyncClient.java new file mode 100644 index 0000000000..b1dde9b3e0 --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/SubclassAsyncClient.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.subclass.implementation.SubclassImpl; +import tsptest.subclass.models.Body; + +/** + * Initializes a new instance of the asynchronous SubclassClient type. + */ +@ServiceClient(builder = SubclassClientBuilder.class, isAsync = true) +public final class SubclassAsyncClient { + @Generated + private final SubclassImpl serviceClient; + + /** + * Initializes an instance of SubclassAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SubclassAsyncClient(SubclassImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The propertyInSubclass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> propertyInSubclassWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.propertyInSubclassWithResponseAsync(body, requestOptions); + } + + /** + * The propertyInSubclass operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono propertyInSubclass(Body body) { + // Generated convenience method for propertyInSubclassWithResponse + RequestOptions requestOptions = new RequestOptions(); + return propertyInSubclassWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Body.class)); + } +} diff --git a/typespec-tests/src/main/java/tsptest/subclass/SubclassClient.java b/typespec-tests/src/main/java/tsptest/subclass/SubclassClient.java new file mode 100644 index 0000000000..775c767336 --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/SubclassClient.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.subclass.implementation.SubclassImpl; +import tsptest.subclass.models.Body; + +/** + * Initializes a new instance of the synchronous SubclassClient type. + */ +@ServiceClient(builder = SubclassClientBuilder.class) +public final class SubclassClient { + @Generated + private final SubclassImpl serviceClient; + + /** + * Initializes an instance of SubclassClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SubclassClient(SubclassImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The propertyInSubclass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response propertyInSubclassWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.propertyInSubclassWithResponse(body, requestOptions); + } + + /** + * The propertyInSubclass operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Body propertyInSubclass(Body body) { + // Generated convenience method for propertyInSubclassWithResponse + RequestOptions requestOptions = new RequestOptions(); + return propertyInSubclassWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Body.class); + } +} diff --git a/typespec-tests/src/main/java/tsptest/subclass/SubclassClientBuilder.java b/typespec-tests/src/main/java/tsptest/subclass/SubclassClientBuilder.java new file mode 100644 index 0000000000..13b233af8f --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/SubclassClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.subclass.implementation.SubclassClientImpl; + +/** + * A builder for creating a new instance of the SubclassClient type. + */ +@ServiceClientBuilder(serviceClients = { SubclassClient.class, SubclassAsyncClient.class }) +public final class SubclassClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-subclass.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the SubclassClientBuilder. + */ + @Generated + public SubclassClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the SubclassClientBuilder. + */ + @Generated + public SubclassClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of SubclassClientImpl with the provided parameters. + * + * @return an instance of SubclassClientImpl. + */ + @Generated + private SubclassClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + SubclassClientImpl client + = new SubclassClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of SubclassAsyncClient class. + * + * @return an instance of SubclassAsyncClient. + */ + @Generated + public SubclassAsyncClient buildAsyncClient() { + return new SubclassAsyncClient(buildInnerClient().getSubclass()); + } + + /** + * Builds an instance of SubclassClient class. + * + * @return an instance of SubclassClient. + */ + @Generated + public SubclassClient buildClient() { + return new SubclassClient(buildInnerClient().getSubclass()); + } + + private static final ClientLogger LOGGER = new ClientLogger(SubclassClientBuilder.class); +} diff --git a/typespec-tests/src/main/java/tsptest/subclass/implementation/SubclassClientImpl.java b/typespec-tests/src/main/java/tsptest/subclass/implementation/SubclassClientImpl.java new file mode 100644 index 0000000000..5566742f36 --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/implementation/SubclassClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; + +/** + * Initializes a new instance of the SubclassClient type. + */ +public final class SubclassClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The SubclassImpl object to access its operations. + */ + private final SubclassImpl subclass; + + /** + * Gets the SubclassImpl object to access its operations. + * + * @return the SubclassImpl object. + */ + public SubclassImpl getSubclass() { + return this.subclass; + } + + /** + * Initializes an instance of SubclassClient client. + * + * @param endpoint Service host. + */ + public SubclassClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SubclassClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public SubclassClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SubclassClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public SubclassClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.subclass = new SubclassImpl(this); + } +} diff --git a/typespec-tests/src/main/java/tsptest/subclass/implementation/SubclassImpl.java b/typespec-tests/src/main/java/tsptest/subclass/implementation/SubclassImpl.java new file mode 100644 index 0000000000..92a552910a --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/implementation/SubclassImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Subclass. + */ +public final class SubclassImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SubclassService service; + + /** + * The service client containing this operation class. + */ + private final SubclassClientImpl client; + + /** + * Initializes an instance of SubclassImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SubclassImpl(SubclassClientImpl client) { + this.service = RestProxy.create(SubclassService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SubclassClientSubclass to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SubclassClientSubclass") + public interface SubclassService { + @Post("/subclass/property-in-subclass") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> propertyInSubclass(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/subclass/property-in-subclass") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response propertyInSubclassSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The propertyInSubclass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> propertyInSubclassWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.propertyInSubclass(this.client.getEndpoint(), contentType, + accept, body, requestOptions, context)); + } + + /** + * The propertyInSubclass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response propertyInSubclassWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.propertyInSubclassSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } +} diff --git a/typespec-tests/src/main/java/tsptest/subclass/implementation/package-info.java b/typespec-tests/src/main/java/tsptest/subclass/implementation/package-info.java new file mode 100644 index 0000000000..4cc0977cd8 --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Subclass. + * + */ +package tsptest.subclass.implementation; diff --git a/typespec-tests/src/main/java/tsptest/subclass/models/Body.java b/typespec-tests/src/main/java/tsptest/subclass/models/Body.java new file mode 100644 index 0000000000..432ee35a8b --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/models/Body.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Body model. + */ +@Fluent +public final class Body implements JsonSerializable { + /* + * The duplicateRequiredProperty property. + */ + @Generated + private DuplicateRequiredProperty duplicateRequiredProperty; + + /* + * The propertyChangedToRequired property. + */ + @Generated + private PropertyChangedToRequired propertyChangedToRequired; + + /* + * The propertyChangedToConstant property. + */ + @Generated + private PropertyChangedToConstant propertyChangedToConstant; + + /** + * Creates an instance of Body class. + */ + @Generated + public Body() { + } + + /** + * Get the duplicateRequiredProperty property: The duplicateRequiredProperty property. + * + * @return the duplicateRequiredProperty value. + */ + @Generated + public DuplicateRequiredProperty getDuplicateRequiredProperty() { + return this.duplicateRequiredProperty; + } + + /** + * Set the duplicateRequiredProperty property: The duplicateRequiredProperty property. + * + * @param duplicateRequiredProperty the duplicateRequiredProperty value to set. + * @return the Body object itself. + */ + @Generated + public Body setDuplicateRequiredProperty(DuplicateRequiredProperty duplicateRequiredProperty) { + this.duplicateRequiredProperty = duplicateRequiredProperty; + return this; + } + + /** + * Get the propertyChangedToRequired property: The propertyChangedToRequired property. + * + * @return the propertyChangedToRequired value. + */ + @Generated + public PropertyChangedToRequired getPropertyChangedToRequired() { + return this.propertyChangedToRequired; + } + + /** + * Set the propertyChangedToRequired property: The propertyChangedToRequired property. + * + * @param propertyChangedToRequired the propertyChangedToRequired value to set. + * @return the Body object itself. + */ + @Generated + public Body setPropertyChangedToRequired(PropertyChangedToRequired propertyChangedToRequired) { + this.propertyChangedToRequired = propertyChangedToRequired; + return this; + } + + /** + * Get the propertyChangedToConstant property: The propertyChangedToConstant property. + * + * @return the propertyChangedToConstant value. + */ + @Generated + public PropertyChangedToConstant getPropertyChangedToConstant() { + return this.propertyChangedToConstant; + } + + /** + * Set the propertyChangedToConstant property: The propertyChangedToConstant property. + * + * @param propertyChangedToConstant the propertyChangedToConstant value to set. + * @return the Body object itself. + */ + @Generated + public Body setPropertyChangedToConstant(PropertyChangedToConstant propertyChangedToConstant) { + this.propertyChangedToConstant = propertyChangedToConstant; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("duplicateRequiredProperty", this.duplicateRequiredProperty); + jsonWriter.writeJsonField("propertyChangedToRequired", this.propertyChangedToRequired); + jsonWriter.writeJsonField("propertyChangedToConstant", this.propertyChangedToConstant); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Body from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Body if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Body. + */ + @Generated + public static Body fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Body deserializedBody = new Body(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("duplicateRequiredProperty".equals(fieldName)) { + deserializedBody.duplicateRequiredProperty = DuplicateRequiredProperty.fromJson(reader); + } else if ("propertyChangedToRequired".equals(fieldName)) { + deserializedBody.propertyChangedToRequired = PropertyChangedToRequired.fromJson(reader); + } else if ("propertyChangedToConstant".equals(fieldName)) { + deserializedBody.propertyChangedToConstant = PropertyChangedToConstant.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBody; + }); + } +} diff --git a/typespec-tests/src/main/java/tsptest/subclass/models/DuplicateRequiredProperty.java b/typespec-tests/src/main/java/tsptest/subclass/models/DuplicateRequiredProperty.java new file mode 100644 index 0000000000..0444173953 --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/models/DuplicateRequiredProperty.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The DuplicateRequiredProperty model. + */ +@Immutable +public final class DuplicateRequiredProperty extends DuplicateRequiredPropertyParent { + /* + * The duplicateRequiredProperty property. + */ + @Generated + private final String newRequiredProperty; + + /** + * Creates an instance of DuplicateRequiredProperty class. + * + * @param requiredProperty the requiredProperty value to set. + * @param newRequiredProperty the newRequiredProperty value to set. + */ + @Generated + public DuplicateRequiredProperty(String requiredProperty, String newRequiredProperty) { + super(requiredProperty, newRequiredProperty); + this.newRequiredProperty = newRequiredProperty; + } + + /** + * Get the newRequiredProperty property: The duplicateRequiredProperty property. + * + * @return the newRequiredProperty value. + */ + @Generated + public String getNewRequiredProperty() { + return this.newRequiredProperty; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", getRequiredProperty()); + jsonWriter.writeStringField("duplicateRequiredProperty", this.newRequiredProperty); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DuplicateRequiredProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DuplicateRequiredProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DuplicateRequiredProperty. + */ + @Generated + public static DuplicateRequiredProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String requiredProperty = null; + String newRequiredProperty = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + requiredProperty = reader.getString(); + } else if ("duplicateRequiredProperty".equals(fieldName)) { + newRequiredProperty = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new DuplicateRequiredProperty(requiredProperty, newRequiredProperty); + }); + } +} diff --git a/typespec-tests/src/main/java/tsptest/subclass/models/DuplicateRequiredPropertyParent.java b/typespec-tests/src/main/java/tsptest/subclass/models/DuplicateRequiredPropertyParent.java new file mode 100644 index 0000000000..14989bc2da --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/models/DuplicateRequiredPropertyParent.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The DuplicateRequiredPropertyParent model. + */ +@Immutable +public class DuplicateRequiredPropertyParent implements JsonSerializable { + /* + * The property property. + */ + @Generated + private final String requiredProperty; + + /* + * The duplicateRequiredProperty property. + */ + @Generated + private final String duplicateRequiredProperty; + + /** + * Creates an instance of DuplicateRequiredPropertyParent class. + * + * @param requiredProperty the requiredProperty value to set. + * @param duplicateRequiredProperty the duplicateRequiredProperty value to set. + */ + @Generated + public DuplicateRequiredPropertyParent(String requiredProperty, String duplicateRequiredProperty) { + this.requiredProperty = requiredProperty; + this.duplicateRequiredProperty = duplicateRequiredProperty; + } + + /** + * Get the requiredProperty property: The property property. + * + * @return the requiredProperty value. + */ + @Generated + public String getRequiredProperty() { + return this.requiredProperty; + } + + /** + * Get the duplicateRequiredProperty property: The duplicateRequiredProperty property. + * + * @return the duplicateRequiredProperty value. + */ + @Generated + public String getDuplicateRequiredProperty() { + return this.duplicateRequiredProperty; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.requiredProperty); + jsonWriter.writeStringField("duplicateRequiredProperty", this.duplicateRequiredProperty); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DuplicateRequiredPropertyParent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DuplicateRequiredPropertyParent if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DuplicateRequiredPropertyParent. + */ + @Generated + public static DuplicateRequiredPropertyParent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String requiredProperty = null; + String duplicateRequiredProperty = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + requiredProperty = reader.getString(); + } else if ("duplicateRequiredProperty".equals(fieldName)) { + duplicateRequiredProperty = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new DuplicateRequiredPropertyParent(requiredProperty, duplicateRequiredProperty); + }); + } +} diff --git a/typespec-tests/src/main/java/tsptest/subclass/models/PropertyChangedToConstant.java b/typespec-tests/src/main/java/tsptest/subclass/models/PropertyChangedToConstant.java new file mode 100644 index 0000000000..4112d8e0e6 --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/models/PropertyChangedToConstant.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The PropertyChangedToConstant model. + */ +@Immutable +public final class PropertyChangedToConstant extends PropertyChangedToConstantParent { + /* + * The propertyChangedToConstant property. + */ + @Generated + private final String propertyChangedToConstant = "constantValue"; + + /** + * Creates an instance of PropertyChangedToConstant class. + */ + @Generated + public PropertyChangedToConstant() { + super("constantValue"); + } + + /** + * Get the propertyChangedToConstant property: The propertyChangedToConstant property. + * + * @return the propertyChangedToConstant value. + */ + @Generated + public String getPropertyChangedToConstant() { + return this.propertyChangedToConstant; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("propertyChangedToConstant", this.propertyChangedToConstant); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PropertyChangedToConstant from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PropertyChangedToConstant if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PropertyChangedToConstant. + */ + @Generated + public static PropertyChangedToConstant fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PropertyChangedToConstant deserializedPropertyChangedToConstant = new PropertyChangedToConstant(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedPropertyChangedToConstant; + }); + } +} diff --git a/typespec-tests/src/main/java/tsptest/subclass/models/PropertyChangedToConstantParent.java b/typespec-tests/src/main/java/tsptest/subclass/models/PropertyChangedToConstantParent.java new file mode 100644 index 0000000000..42ec9ff3a1 --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/models/PropertyChangedToConstantParent.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The PropertyChangedToConstantParent model. + */ +@Immutable +public class PropertyChangedToConstantParent implements JsonSerializable { + /* + * The propertyChangedToConstant property. + */ + @Generated + private final String propertyChangedToConstant; + + /** + * Creates an instance of PropertyChangedToConstantParent class. + * + * @param propertyChangedToConstant the propertyChangedToConstant value to set. + */ + @Generated + public PropertyChangedToConstantParent(String propertyChangedToConstant) { + this.propertyChangedToConstant = propertyChangedToConstant; + } + + /** + * Get the propertyChangedToConstant property: The propertyChangedToConstant property. + * + * @return the propertyChangedToConstant value. + */ + @Generated + public String getPropertyChangedToConstant() { + return this.propertyChangedToConstant; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("propertyChangedToConstant", this.propertyChangedToConstant); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PropertyChangedToConstantParent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PropertyChangedToConstantParent if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PropertyChangedToConstantParent. + */ + @Generated + public static PropertyChangedToConstantParent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String propertyChangedToConstant = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("propertyChangedToConstant".equals(fieldName)) { + propertyChangedToConstant = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new PropertyChangedToConstantParent(propertyChangedToConstant); + }); + } +} diff --git a/typespec-tests/src/main/java/tsptest/subclass/models/PropertyChangedToRequired.java b/typespec-tests/src/main/java/tsptest/subclass/models/PropertyChangedToRequired.java new file mode 100644 index 0000000000..b71da97a6a --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/models/PropertyChangedToRequired.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The PropertyChangedToRequired model. + */ +@Fluent +public final class PropertyChangedToRequired extends PropertyChangedToRequiredParent { + /* + * The propertyChangedToRequired property. + */ + @Generated + private final String propertyChangedToRequired; + + /** + * Creates an instance of PropertyChangedToRequired class. + * + * @param propertyChangedToRequired the propertyChangedToRequired value to set. + */ + @Generated + public PropertyChangedToRequired(String propertyChangedToRequired) { + this.propertyChangedToRequired = propertyChangedToRequired; + } + + /** + * Get the propertyChangedToRequired property: The propertyChangedToRequired property. + * + * @return the propertyChangedToRequired value. + */ + @Generated + public String getPropertyChangedToRequired() { + return this.propertyChangedToRequired; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("propertyChangedToRequired", this.propertyChangedToRequired); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PropertyChangedToRequired from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PropertyChangedToRequired if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PropertyChangedToRequired. + */ + @Generated + public static PropertyChangedToRequired fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String propertyChangedToRequired = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("propertyChangedToRequired".equals(fieldName)) { + propertyChangedToRequired = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new PropertyChangedToRequired(propertyChangedToRequired); + }); + } +} diff --git a/typespec-tests/src/main/java/tsptest/subclass/models/PropertyChangedToRequiredParent.java b/typespec-tests/src/main/java/tsptest/subclass/models/PropertyChangedToRequiredParent.java new file mode 100644 index 0000000000..2ab1511ea6 --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/models/PropertyChangedToRequiredParent.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The PropertyChangedToRequiredParent model. + */ +@Fluent +public class PropertyChangedToRequiredParent implements JsonSerializable { + /* + * The propertyChangedToRequired property. + */ + @Generated + private String propertyChangedToRequired; + + /** + * Creates an instance of PropertyChangedToRequiredParent class. + */ + @Generated + public PropertyChangedToRequiredParent() { + } + + /** + * Get the propertyChangedToRequired property: The propertyChangedToRequired property. + * + * @return the propertyChangedToRequired value. + */ + @Generated + public String getPropertyChangedToRequired() { + return this.propertyChangedToRequired; + } + + /** + * Set the propertyChangedToRequired property: The propertyChangedToRequired property. + * + * @param propertyChangedToRequired the propertyChangedToRequired value to set. + * @return the PropertyChangedToRequiredParent object itself. + */ + @Generated + public PropertyChangedToRequiredParent setPropertyChangedToRequired(String propertyChangedToRequired) { + this.propertyChangedToRequired = propertyChangedToRequired; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("propertyChangedToRequired", this.propertyChangedToRequired); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PropertyChangedToRequiredParent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PropertyChangedToRequiredParent if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PropertyChangedToRequiredParent. + */ + @Generated + public static PropertyChangedToRequiredParent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PropertyChangedToRequiredParent deserializedPropertyChangedToRequiredParent + = new PropertyChangedToRequiredParent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("propertyChangedToRequired".equals(fieldName)) { + deserializedPropertyChangedToRequiredParent.propertyChangedToRequired = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPropertyChangedToRequiredParent; + }); + } +} diff --git a/typespec-tests/src/main/java/tsptest/subclass/models/package-info.java b/typespec-tests/src/main/java/tsptest/subclass/models/package-info.java new file mode 100644 index 0000000000..a14fc55334 --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Subclass. + * + */ +package tsptest.subclass.models; diff --git a/typespec-tests/src/main/java/tsptest/subclass/package-info.java b/typespec-tests/src/main/java/tsptest/subclass/package-info.java new file mode 100644 index 0000000000..925d7ab7f0 --- /dev/null +++ b/typespec-tests/src/main/java/tsptest/subclass/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Subclass. + * + */ +package tsptest.subclass; diff --git a/typespec-tests/src/main/resources/tsptest-subclass.properties b/typespec-tests/src/main/resources/tsptest-subclass.properties new file mode 100644 index 0000000000..ca812989b4 --- /dev/null +++ b/typespec-tests/src/main/resources/tsptest-subclass.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/typespec-tests/src/test/java/tsptest/subclass/SubclassPropertyTests.java b/typespec-tests/src/test/java/tsptest/subclass/SubclassPropertyTests.java new file mode 100644 index 0000000000..0d425cbad4 --- /dev/null +++ b/typespec-tests/src/test/java/tsptest/subclass/SubclassPropertyTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.subclass; + +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import tsptest.subclass.models.PropertyChangedToConstant; +import tsptest.subclass.models.PropertyChangedToRequired; + +public class SubclassPropertyTests { + + @Test + public void testPropertyChangedToRequired() { + PropertyChangedToRequired model = new PropertyChangedToRequired("value"); + String json = BinaryData.fromObject(model).toString(); + Assertions.assertEquals("{\"propertyChangedToRequired\":\"value\"}", json); + + model = BinaryData.fromString(json).toObject(PropertyChangedToRequired.class); + Assertions.assertEquals("value", model.getPropertyChangedToRequired()); + } + + @Test + public void testPropertyChangedToConstant() { + PropertyChangedToConstant model = new PropertyChangedToConstant(); + String json = BinaryData.fromObject(model).toString(); + Assertions.assertEquals("{\"propertyChangedToConstant\":\"constantValue\"}", json); + + model = BinaryData.fromString(json).toObject(PropertyChangedToConstant.class); + Assertions.assertEquals("constantValue", model.getPropertyChangedToConstant()); + } +} diff --git a/typespec-tests/src/test/java/tsptest/subclass/generated/SubclassClientTestBase.java b/typespec-tests/src/test/java/tsptest/subclass/generated/SubclassClientTestBase.java new file mode 100644 index 0000000000..5ade858bbc --- /dev/null +++ b/typespec-tests/src/test/java/tsptest/subclass/generated/SubclassClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.subclass.SubclassClient; +import tsptest.subclass.SubclassClientBuilder; + +class SubclassClientTestBase extends TestProxyTestBase { + protected SubclassClient subclassClient; + + @Override + protected void beforeTest() { + SubclassClientBuilder subclassClientbuilder + = new SubclassClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + subclassClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + subclassClient = subclassClientbuilder.buildClient(); + + } +} diff --git a/typespec-tests/tsp/subclass.tsp b/typespec-tests/tsp/subclass.tsp new file mode 100644 index 0000000000..8f76d84f82 --- /dev/null +++ b/typespec-tests/tsp/subclass.tsp @@ -0,0 +1,58 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; + +@service(#{ title: "Subclass" }) +namespace TspTest.Subclass; + +model DuplicateRequiredPropertyParent { + @encodedName("application/json", "property") + requiredProperty: string; + + duplicateRequiredProperty: string; +} +model DuplicateRequiredProperty extends DuplicateRequiredPropertyParent { + @encodedName("application/json", "duplicateRequiredProperty") + newRequiredProperty: string; +} + +model PropertyChangedToRequiredParent { + propertyChangedToRequired?: string; +} +model PropertyChangedToRequired extends PropertyChangedToRequiredParent { + propertyChangedToRequired: string; +} + +model PropertyChangedToConstantParent { + propertyChangedToConstant: string; +} +model PropertyChangedToConstant extends PropertyChangedToConstantParent { + propertyChangedToConstant: "constantValue"; +} + +// Incompatible return type in Java method override +// model PropertyChangedToEnumParent { +// propertyChangedToEnum: string; +// } +// model PropertyChangedToEnum extends PropertyChangedToEnumParent { +// propertyChangedToEnum: EnumModel; +// } +// union EnumModel { +// string, +// "value1", +// } + +model Body { + duplicateRequiredProperty?: DuplicateRequiredProperty; + propertyChangedToRequired?: PropertyChangedToRequired; + propertyChangedToConstant?: PropertyChangedToConstant; +} + +@route("/subclass") +interface Subclass { + @post + @route("/property-in-subclass") + propertyInSubclass(@body body: Body): Body; +}