From e631d18013fe6b63412211081d82dfbb5e0f4693 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Fri, 14 Jun 2024 14:39:25 +0800 Subject: [PATCH] tsp, bump dependency (#2816) --- package.json | 2 +- typespec-extension/changelog.md | 4 +- typespec-extension/package-lock.json | 221 +++++++-------- typespec-extension/package.json | 40 +-- typespec-extension/src/code-model-builder.ts | 46 +++- typespec-extension/src/operation-utils.ts | 4 +- typespec-extension/src/type-utils.ts | 6 +- typespec-tests/package.json | 22 +- .../implementation/models/AbstractModel.java | 4 +- .../implementation/models/RealModel.java | 4 +- .../fluent/ArmResourceProviderClient.java | 2 +- .../ArmResourceProviderClientBuilder.java | 4 +- .../ArmResourceProviderClientImpl.java | 6 +- .../implementation/OperationsClientImpl.java | 6 +- ...peration.java => OperationListResult.java} | 10 +- .../models/ManagedServiceIdentity.java | 34 ++- .../models/ManagedServiceIdentityType.java | 6 +- .../models/UserAssignedIdentity.java | 50 +--- .../ArmStreamStyleSerializationClient.java | 2 +- .../fluent/models/FishInner.java | 4 +- .../fluent/models/SalmonInner.java | 4 +- ...StreamStyleSerializationClientBuilder.java | 4 +- ...ArmStreamStyleSerializationClientImpl.java | 6 +- .../models/Fish.java | 2 +- .../models/GoblinShark.java | 4 +- .../models/Salmon.java | 2 +- .../models/SawShark.java | 4 +- .../models/Shark.java | 4 +- .../implementation/FlattenClientImpl.java | 12 +- .../models/SendLongRequest.java | 12 +- .../models/UploadTodoRequest.java | 8 +- .../cadl/flatten/models/SendLongOptions.java | 6 +- .../com/cadl/flatten/models/TodoItem.java | 10 +- ...RequestStatus.java => TodoItemStatus.java} | 18 +- .../flatten/models/UploadTodoOptions.java | 6 +- .../com/cadl/literalservice/models/Model.java | 9 +- ...Literal.java => ModelOptionalLiteral.java} | 18 +- .../longrunning/models/OperationState.java | 62 +++-- .../MultiContentTypesClientImpl.java | 4 +- .../MultipleContentTypesOnRequestsImpl.java | 16 +- .../SingleContentTypesImpl.java | 4 +- .../implementation/MultipartClientImpl.java | 4 +- .../patch/implementation/PatchesImpl.java | 12 +- .../main/java/com/cadl/patch/models/Fish.java | 4 +- .../java/com/cadl/patch/models/Salmon.java | 4 +- .../java/com/cadl/patch/models/SawShark.java | 4 +- .../java/com/cadl/patch/models/Shark.java | 4 +- .../cadl/response/models/OperationState.java | 62 +++-- .../implementation/RequestBodiesImpl.java | 8 +- .../JsonMergePatchClientImpl.java | 8 +- .../implementation/StringBodiesImpl.java | 8 +- .../implementation/FormDatasImpl.java | 32 +-- .../nesteddiscriminator/models/Fish.java | 4 +- .../models/GoblinShark.java | 4 +- .../nesteddiscriminator/models/Salmon.java | 4 +- .../nesteddiscriminator/models/SawShark.java | 4 +- .../nesteddiscriminator/models/Shark.java | 4 +- .../singlediscriminator/models/Dinosaur.java | 4 +- .../singlediscriminator/models/TRex.java | 4 +- .../models/BooleanLiteralProperty.java | 8 +- ...va => BooleanLiteralPropertyProperty.java} | 18 +- .../optional/models/FloatLiteralProperty.java | 8 +- ...java => FloatLiteralPropertyProperty.java} | 18 +- .../optional/models/IntLiteralProperty.java | 8 +- ...1.java => IntLiteralPropertyProperty.java} | 18 +- .../models/StringLiteralProperty.java | 8 +- ...ava => StringLiteralPropertyProperty.java} | 18 +- .../com/type/union/IntsOnlyAsyncClient.java | 4 +- .../java/com/type/union/IntsOnlyClient.java | 4 +- .../union/StringExtensibleAsyncClient.java | 4 +- .../type/union/StringExtensibleClient.java | 4 +- .../type/union/StringsOnlyAsyncClient.java | 4 +- .../com/type/union/StringsOnlyClient.java | 4 +- .../implementation/models/SendRequest.java | 12 +- .../implementation/models/SendRequest1.java | 12 +- .../implementation/models/SendRequest3.java | 12 +- .../com/type/union/models/GetResponse6.java | 10 +- .../com/type/union/models/GetResponse8.java | 10 +- .../com/type/union/models/GetResponse9.java | 10 +- .../type/union/models/GetResponseProp2.java | 59 ++++ .../type/union/models/GetResponseProp3.java | 58 ++-- .../type/union/models/GetResponseProp4.java | 62 +++-- .../type/union/models/GetResponseProp5.java | 61 ---- .../reflect-config.json | 2 +- .../flatten/generated/FlattenOpSendLong.java | 6 +- .../generated/FlattenOpSendLongTests.java | 6 +- .../optional/BooleanLiteralClientTests.java | 6 +- .../optional/FloatLiteralClientTests.java | 6 +- .../optional/IntLiteralClientTests.java | 6 +- .../optional/StringLiteralClientTests.java | 6 +- .../java/com/type/union/UnionsClientTest.java | 10 +- .../tsp/nested-enum-discriminator.tsp | 260 +++++++++--------- typespec-tests/tsp/partialupdate.tsp | 10 +- 93 files changed, 807 insertions(+), 815 deletions(-) rename typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/models/{PagedOperation.java => OperationListResult.java} (89%) rename typespec-tests/src/main/java/com/cadl/flatten/models/{SendLongRequestStatus.java => TodoItemStatus.java} (62%) rename typespec-tests/src/main/java/com/cadl/literalservice/models/{ModelOptionalLiteralOptionalLiteral.java => ModelOptionalLiteral.java} (53%) rename typespec-tests/src/main/java/com/type/property/optional/models/{BooleanLiteralPropertyPropertyTrue.java => BooleanLiteralPropertyProperty.java} (61%) rename typespec-tests/src/main/java/com/type/property/optional/models/{FloatLiteralPropertyProperty125.java => FloatLiteralPropertyProperty.java} (63%) rename typespec-tests/src/main/java/com/type/property/optional/models/{IntLiteralPropertyProperty1.java => IntLiteralPropertyProperty.java} (64%) rename typespec-tests/src/main/java/com/type/property/optional/models/{StringLiteralPropertyPropertyHello.java => StringLiteralPropertyProperty.java} (61%) create mode 100644 typespec-tests/src/main/java/com/type/union/models/GetResponseProp2.java delete mode 100644 typespec-tests/src/main/java/com/type/union/models/GetResponseProp5.java diff --git a/package.json b/package.json index 971b66b5ed..f2aa709b90 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@autorest/java", - "version": "4.1.29", + "version": "4.1.30", "description": "The Java extension for classic generators in AutoRest.", "scripts": { "autorest": "autorest", diff --git a/typespec-extension/changelog.md b/typespec-extension/changelog.md index 4d8e3d1641..cb61b733d2 100644 --- a/typespec-extension/changelog.md +++ b/typespec-extension/changelog.md @@ -1,8 +1,8 @@ # Release History -## 0.16.4 (Unreleased) +## 0.17.0 (2024-06-14) -Compatible with compiler 0.56. +Compatible with compiler 0.57. ## 0.16.3 (2024-06-03) diff --git a/typespec-extension/package-lock.json b/typespec-extension/package-lock.json index c969c0ccc5..dd8011b681 100644 --- a/typespec-extension/package-lock.json +++ b/typespec-extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "@azure-tools/typespec-java", - "version": "0.16.4", + "version": "0.17.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@azure-tools/typespec-java", - "version": "0.16.4", + "version": "0.17.0", "license": "MIT", "dependencies": { "@autorest/codemodel": "~4.20.0", @@ -14,22 +14,22 @@ "lodash": "~4.17.21" }, "devDependencies": { - "@azure-tools/typespec-autorest": "0.42.1", - "@azure-tools/typespec-azure-core": "0.42.0", - "@azure-tools/typespec-azure-resource-manager": "0.42.1", - "@azure-tools/typespec-azure-rulesets": "0.42.1", - "@azure-tools/typespec-client-generator-core": "0.42.3", + "@azure-tools/typespec-autorest": "0.43.0", + "@azure-tools/typespec-azure-core": "0.43.0", + "@azure-tools/typespec-azure-resource-manager": "0.43.0", + "@azure-tools/typespec-azure-rulesets": "0.43.0", + "@azure-tools/typespec-client-generator-core": "0.43.0", "@types/js-yaml": "~4.0.9", "@types/lodash": "~4.17.1", "@types/mocha": "~10.0.6", "@types/node": "~20.12.10", "@typescript-eslint/eslint-plugin": "~7.8.0", "@typescript-eslint/parser": "~7.8.0", - "@typespec/compiler": "0.56.0", - "@typespec/http": "0.56.0", - "@typespec/openapi": "0.56.0", - "@typespec/rest": "0.56.0", - "@typespec/versioning": "0.56.0", + "@typespec/compiler": "0.57.0", + "@typespec/http": "0.57.0", + "@typespec/openapi": "0.57.0", + "@typespec/rest": "0.57.0", + "@typespec/versioning": "0.57.0", "c8": "~9.1.0", "eslint": "~8.57.0", "eslint-plugin-deprecation": "~2.0.0", @@ -42,15 +42,15 @@ "node": ">=14.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": ">=0.42.0 <1.0.0", - "@azure-tools/typespec-azure-resource-manager": ">=0.42.1 <1.0.0", - "@azure-tools/typespec-azure-rulesets": ">=0.42.1 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.42.2 <1.0.0", - "@typespec/compiler": ">=0.56.0 <1.0.0", - "@typespec/http": ">=0.56.0 <1.0.0", - "@typespec/openapi": ">=0.56.0 <1.0.0", - "@typespec/rest": ">=0.56.0 <1.0.0", - "@typespec/versioning": ">=0.56.0 <1.0.0" + "@azure-tools/typespec-azure-core": ">=0.43.0 <1.0.0", + "@azure-tools/typespec-azure-resource-manager": ">=0.43.0 <1.0.0", + "@azure-tools/typespec-azure-rulesets": ">=0.43.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.43.0 <1.0.0", + "@typespec/compiler": ">=0.57.0 <1.0.0", + "@typespec/http": ">=0.57.0 <1.0.0", + "@typespec/openapi": ">=0.57.0 <1.0.0", + "@typespec/rest": ">=0.57.0 <1.0.0", + "@typespec/versioning": ">=0.57.0 <1.0.0" } }, "..": { @@ -118,41 +118,42 @@ } }, "node_modules/@azure-tools/typespec-autorest": { - "version": "0.42.1", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-autorest/-/typespec-autorest-0.42.1.tgz", - "integrity": "sha512-egWR2Ljxde5PvyDwuVu/8Rq8cSW6FW+qMbvwHfzrtm/sULdSnA6k+VnGD/PQ+dk+1SmFeKG1b+0MlaFuBVz1Hw==", + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-autorest/-/typespec-autorest-0.43.0.tgz", + "integrity": "sha512-tZ9uXXOdxu2y01W9n3mzXf+IEY2MQkP/JaQaKlcOx2+dbklHNQWSDU0Vm6Gmm6l//XiF9QiI8653BiuO97czyw==", "dev": true, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "~0.42.0", - "@azure-tools/typespec-client-generator-core": "~0.42.0", - "@typespec/compiler": "~0.56.0", - "@typespec/http": "~0.56.0", - "@typespec/openapi": "~0.56.0", - "@typespec/rest": "~0.56.0", - "@typespec/versioning": "~0.56.0" + "@azure-tools/typespec-azure-core": "~0.43.0", + "@azure-tools/typespec-azure-resource-manager": "~0.43.0", + "@azure-tools/typespec-client-generator-core": "~0.43.0", + "@typespec/compiler": "~0.57.0", + "@typespec/http": "~0.57.0", + "@typespec/openapi": "~0.57.0", + "@typespec/rest": "~0.57.0", + "@typespec/versioning": "~0.57.0" } }, "node_modules/@azure-tools/typespec-azure-core": { - "version": "0.42.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.42.0.tgz", - "integrity": "sha512-8C96RkgSWtgqsaHRMWCd2iDltFJZTGmFQiTZazZj/uRy0Wn1ikjSriSN8t1puL5SiUPd0BVJP/YXiwAfjfZYDA==", + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.43.0.tgz", + "integrity": "sha512-B1r0i3segJ7RuNXxcAMBy8H2t+jTkaf74dkyUWD0HIFPkhETN0uR59nuor+s+LoLU8yI4JypOFSNZt6e1rod8w==", "dev": true, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.56.0", - "@typespec/http": "~0.56.0", - "@typespec/rest": "~0.56.0" + "@typespec/compiler": "~0.57.0", + "@typespec/http": "~0.57.0", + "@typespec/rest": "~0.57.0" } }, "node_modules/@azure-tools/typespec-azure-resource-manager": { - "version": "0.42.1", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-resource-manager/-/typespec-azure-resource-manager-0.42.1.tgz", - "integrity": "sha512-vUqmHWS9OrN+16jXfpgUdUXXa1RLrr8Pkrzb1HFQGmdXuRxMZZtLCRcyyEHZJIMYE4RmmpPoB3JJeqiGWxlegQ==", + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-resource-manager/-/typespec-azure-resource-manager-0.43.0.tgz", + "integrity": "sha512-0GQL+/o1u+PAB63FpYz3sy3ZgZvCtk5T4sDAnICnV23v2YWIONDMUfxxd0x40xJbY6PkcwwHDpBLNMqajf2H6A==", "dev": true, "dependencies": { "change-case": "~5.4.4", @@ -162,34 +163,33 @@ "node": ">=18.0.0" }, "peerDependencies": { - "@azure-tools/typespec-autorest": "~0.42.1", - "@azure-tools/typespec-azure-core": "~0.42.0", - "@typespec/compiler": "~0.56.0", - "@typespec/http": "~0.56.0", - "@typespec/openapi": "~0.56.0", - "@typespec/rest": "~0.56.0", - "@typespec/versioning": "~0.56.0" + "@azure-tools/typespec-azure-core": "~0.43.0", + "@typespec/compiler": "~0.57.0", + "@typespec/http": "~0.57.0", + "@typespec/openapi": "~0.57.0", + "@typespec/rest": "~0.57.0", + "@typespec/versioning": "~0.57.0" } }, "node_modules/@azure-tools/typespec-azure-rulesets": { - "version": "0.42.1", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-rulesets/-/typespec-azure-rulesets-0.42.1.tgz", - "integrity": "sha512-GRiMErWJ96DvDBQMVgGI1sgMTOegXxpx7w6enZyEF0BaodxGfObJyl1TrMb9Pj6NAZfV5Q6uJAfXFbpF1MVDCw==", + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-rulesets/-/typespec-azure-rulesets-0.43.0.tgz", + "integrity": "sha512-yh0dNQIM4hRDWATh/tkONP991uMxFDHY8BkC0eWtIpfTjQTuR2PlGhrLgMxHT2Q5cCusfkNWeFvKDYlxKeoFLA==", "dev": true, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "~0.42.0", - "@azure-tools/typespec-azure-resource-manager": "~0.42.1", - "@azure-tools/typespec-client-generator-core": "~0.42.3", - "@typespec/compiler": "~0.56.0" + "@azure-tools/typespec-azure-core": "~0.43.0", + "@azure-tools/typespec-azure-resource-manager": "~0.43.0", + "@azure-tools/typespec-client-generator-core": "~0.43.0", + "@typespec/compiler": "~0.57.0" } }, "node_modules/@azure-tools/typespec-client-generator-core": { - "version": "0.42.3", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.42.3.tgz", - "integrity": "sha512-ZDVVIY1uJ8EaI4QhCdQmTdKVACm4xYn/I7ySpwv4oxk9X8kZFhxx+PKNHAlx34mhOf4oF0PW3wCN5DMeU6asYg==", + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.43.0.tgz", + "integrity": "sha512-rssB/zsg89wstzJC1MWzbd8oPpqbgoftkp9G/NP3BoMb/gCP5uRLggwlSUAgnoU2Lt0jBUKcMlqEiVLTAkY9LA==", "dev": true, "dependencies": { "change-case": "~5.4.4", @@ -199,11 +199,11 @@ "node": ">=18.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "~0.42.0", - "@typespec/compiler": "~0.56.0", - "@typespec/http": "~0.56.0", - "@typespec/rest": "~0.56.0", - "@typespec/versioning": "~0.56.0" + "@azure-tools/typespec-azure-core": "~0.43.0", + "@typespec/compiler": "~0.57.0", + "@typespec/http": "~0.57.0", + "@typespec/rest": "~0.57.0", + "@typespec/versioning": "~0.57.0" } }, "node_modules/@babel/code-frame": { @@ -1154,23 +1154,23 @@ } }, "node_modules/@typespec/compiler": { - "version": "0.56.0", - "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-0.56.0.tgz", - "integrity": "sha512-K+VhXycoeqcoSGtB0/l1XYco4V2qRsCOOwqklVM4Yew7kTcKVfz7CT7a6a2OKWDMNg5iijZtRBoM5YF50XtQug==", + "version": "0.57.0", + "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-0.57.0.tgz", + "integrity": "sha512-Z5L7J90Ol21IbzU+rBD2wzKy2vJ2Yg2FIzi+yB5rtb7/c4oBea/CgEByMVHBtT7uw45ZXJpHOiepuGSPVXw2EA==", "dev": true, "dependencies": { "@babel/code-frame": "~7.24.2", - "ajv": "~8.12.0", + "ajv": "~8.13.0", "change-case": "~5.4.4", "globby": "~14.0.1", "mustache": "~4.2.0", - "picocolors": "~1.0.0", + "picocolors": "~1.0.1", "prettier": "~3.2.5", "prompts": "~2.4.2", - "semver": "^7.6.0", + "semver": "^7.6.2", "vscode-languageserver": "~9.0.1", "vscode-languageserver-textdocument": "~1.0.11", - "yaml": "~2.4.1", + "yaml": "~2.4.2", "yargs": "~17.7.2" }, "bin": { @@ -1226,53 +1226,53 @@ } }, "node_modules/@typespec/http": { - "version": "0.56.0", - "resolved": "https://registry.npmjs.org/@typespec/http/-/http-0.56.0.tgz", - "integrity": "sha512-f/tpHRWev9bnAtNPFkfCU/5SFou9glA/rPDY0m2W5bK6EG1/6/TKKKz5FoKPA4xvc2dQ5vu/ouGLb4i5UzXvWQ==", + "version": "0.57.0", + "resolved": "https://registry.npmjs.org/@typespec/http/-/http-0.57.0.tgz", + "integrity": "sha512-k3bWOTPNqlRB3/TmrXVBtObmxj2J20l2FnhGXvs+tjdtbXLxCQWmvQz6xlne9nkLAtWVB/pQRUn+oMJfhWta3w==", "dev": true, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.56.0" + "@typespec/compiler": "~0.57.0" } }, "node_modules/@typespec/openapi": { - "version": "0.56.0", - "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-0.56.0.tgz", - "integrity": "sha512-q8+IHRglXBm3slvonRLSNYN2fX7plbWA+ugIiMJZTeyc3enqfxPqMGA8BCiAFV3kwP0uPPpIXbCSIVhHgkONbA==", + "version": "0.57.0", + "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-0.57.0.tgz", + "integrity": "sha512-35wK/BqjOXSlhWuGMwoYN3FSgIYFOKtw8ot4ErcgmxAGuKaS2GkUhZvtQJXUn2ByU0Fl4jqslPmTz8SEcz7rbw==", "dev": true, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.56.0", - "@typespec/http": "~0.56.0" + "@typespec/compiler": "~0.57.0", + "@typespec/http": "~0.57.0" } }, "node_modules/@typespec/rest": { - "version": "0.56.0", - "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.56.0.tgz", - "integrity": "sha512-8w4WhWDcpEQNW8bB1BHhiBxIQUChDJtyq/n9p2OI/Bm1wncd61y/ZNOtcxmlKq8uB9d+dzHiZdEfqFCR8HF8/Q==", + "version": "0.57.0", + "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.57.0.tgz", + "integrity": "sha512-mZj76Kf+cmH38pYA6LT8Zz7QjuR3fdQo5bc8pXhKMwLq9vRqNLz6Z9InbOeo8zY+xP0GfUwEU9kXczmCc8gyRA==", "dev": true, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.56.0", - "@typespec/http": "~0.56.0" + "@typespec/compiler": "~0.57.0", + "@typespec/http": "~0.57.0" } }, "node_modules/@typespec/versioning": { - "version": "0.56.0", - "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.56.0.tgz", - "integrity": "sha512-j7IN9XFyGn3LH6IOJkinEvk9sDncsxiWPULOAe0VQ+D/dtCfLawDMUALnvklMDRKeD1OOUPSCjjUAp9OB0f7YA==", + "version": "0.57.0", + "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.57.0.tgz", + "integrity": "sha512-kk6zCNSwcqqYB9isNNagTy+Zv6wEIRA4NkcZ/X1riTj2zhJwKsIFNXQWm1yxpZn+BY4+1QtuaQHuBLo8HbgR/w==", "dev": true, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.56.0" + "@typespec/compiler": "~0.57.0" } }, "node_modules/@ungap/structured-clone": { @@ -1303,15 +1303,15 @@ } }, "node_modules/ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.13.0.tgz", + "integrity": "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==", "dev": true, "dependencies": { - "fast-deep-equal": "^3.1.1", + "fast-deep-equal": "^3.1.3", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" + "uri-js": "^4.4.1" }, "funding": { "type": "github", @@ -2613,17 +2613,6 @@ "node": ">=8" } }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/make-dir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", @@ -2997,9 +2986,9 @@ } }, "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", "dev": true }, "node_modules/picomatch": { @@ -3275,12 +3264,9 @@ ] }, "node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", - "dependencies": { - "lru-cache": "^6.0.0" - }, + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "bin": { "semver": "bin/semver.js" }, @@ -3752,15 +3738,10 @@ "node": ">=10" } }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, "node_modules/yaml": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.1.tgz", - "integrity": "sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==", + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.5.tgz", + "integrity": "sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==", "dev": true, "bin": { "yaml": "bin.mjs" diff --git a/typespec-extension/package.json b/typespec-extension/package.json index c407e54381..68f40649a6 100644 --- a/typespec-extension/package.json +++ b/typespec-extension/package.json @@ -1,6 +1,6 @@ { "name": "@azure-tools/typespec-java", - "version": "0.16.4", + "version": "0.17.0", "description": "TypeSpec library for emitting Java client from the TypeSpec REST protocol binding", "keywords": [ "TypeSpec" @@ -45,15 +45,15 @@ "target/emitter.jar" ], "peerDependencies": { - "@azure-tools/typespec-azure-core": ">=0.42.0 <1.0.0", - "@azure-tools/typespec-azure-resource-manager": ">=0.42.1 <1.0.0", - "@azure-tools/typespec-azure-rulesets": ">=0.42.1 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.42.2 <1.0.0", - "@typespec/compiler": ">=0.56.0 <1.0.0", - "@typespec/http": ">=0.56.0 <1.0.0", - "@typespec/openapi": ">=0.56.0 <1.0.0", - "@typespec/rest": ">=0.56.0 <1.0.0", - "@typespec/versioning": ">=0.56.0 <1.0.0" + "@azure-tools/typespec-azure-core": ">=0.43.0 <1.0.0", + "@azure-tools/typespec-azure-resource-manager": ">=0.43.0 <1.0.0", + "@azure-tools/typespec-azure-rulesets": ">=0.43.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.43.0 <1.0.0", + "@typespec/compiler": ">=0.57.0 <1.0.0", + "@typespec/http": ">=0.57.0 <1.0.0", + "@typespec/openapi": ">=0.57.0 <1.0.0", + "@typespec/rest": ">=0.57.0 <1.0.0", + "@typespec/versioning": ">=0.57.0 <1.0.0" }, "dependencies": { "@autorest/codemodel": "~4.20.0", @@ -61,22 +61,22 @@ "lodash": "~4.17.21" }, "devDependencies": { - "@azure-tools/typespec-autorest": "0.42.1", - "@azure-tools/typespec-azure-core": "0.42.0", - "@azure-tools/typespec-azure-resource-manager": "0.42.1", - "@azure-tools/typespec-azure-rulesets": "0.42.1", - "@azure-tools/typespec-client-generator-core": "0.42.3", + "@azure-tools/typespec-autorest": "0.43.0", + "@azure-tools/typespec-azure-core": "0.43.0", + "@azure-tools/typespec-azure-resource-manager": "0.43.0", + "@azure-tools/typespec-azure-rulesets": "0.43.0", + "@azure-tools/typespec-client-generator-core": "0.43.0", "@types/js-yaml": "~4.0.9", "@types/lodash": "~4.17.1", "@types/mocha": "~10.0.6", "@types/node": "~20.12.10", "@typescript-eslint/eslint-plugin": "~7.8.0", "@typescript-eslint/parser": "~7.8.0", - "@typespec/compiler": "0.56.0", - "@typespec/http": "0.56.0", - "@typespec/openapi": "0.56.0", - "@typespec/rest": "0.56.0", - "@typespec/versioning": "0.56.0", + "@typespec/compiler": "0.57.0", + "@typespec/http": "0.57.0", + "@typespec/openapi": "0.57.0", + "@typespec/rest": "0.57.0", + "@typespec/versioning": "0.57.0", "c8": "~9.1.0", "eslint": "~8.57.0", "eslint-plugin-deprecation": "~2.0.0", diff --git a/typespec-extension/src/code-model-builder.ts b/typespec-extension/src/code-model-builder.ts index c574a5d37e..98fc5d973f 100644 --- a/typespec-extension/src/code-model-builder.ts +++ b/typespec-extension/src/code-model-builder.ts @@ -104,6 +104,7 @@ import { Authentication, HttpOperation, HttpOperationBody, + HttpOperationMultipartBody, HttpOperationParameter, HttpOperationResponse, HttpServer, @@ -152,6 +153,7 @@ import { ProcessingCache, getAccess, getDurationFormatFromSdkType, + getNonNullSdkType, getUnionDescription, getUsage, hasScalarAsBase, @@ -719,7 +721,7 @@ export class CodeModelBuilder { }, }); - codeModelOperation.crossLanguageDefinitionId = getCrossLanguageDefinitionId(operation); + codeModelOperation.crossLanguageDefinitionId = getCrossLanguageDefinitionId(this.sdkContext, operation); codeModelOperation.internalApi = this.isInternal(this.sdkContext, operation); const convenienceApiName = this.getConvenienceApiName(operation); @@ -789,9 +791,9 @@ export class CodeModelBuilder { this.addAcceptHeaderParameter(codeModelOperation, op.responses); // body if (op.parameters.body) { - if (op.parameters.body.parameter) { - if (!isVoidType(op.parameters.body.parameter.type)) { - this.processParameterBody(codeModelOperation, op, op.parameters.body.parameter); + if (op.parameters.body.property) { + if (!isVoidType(op.parameters.body.property.type)) { + this.processParameterBody(codeModelOperation, op, op.parameters.body.property); } } else if (op.parameters.body.type) { let bodyType = this.getEffectiveSchemaType(op.parameters.body.type); @@ -1018,7 +1020,7 @@ export class CodeModelBuilder { } else { // schema let schema; - const sdkType = getClientType(this.sdkContext, param.param); + const sdkType = getNonNullSdkType(getClientType(this.sdkContext, param.param)); if ( param.type === "header" && param.param.type.kind === "Scalar" && @@ -1532,7 +1534,7 @@ export class CodeModelBuilder { } } - let responseBody: HttpOperationBody | undefined = undefined; + let responseBody: HttpOperationBody | HttpOperationMultipartBody | undefined = undefined; let bodyType: Type | undefined = undefined; let trackConvenienceApi: boolean = Boolean(op.convenienceApi); if (resp.responses && resp.responses.length > 0 && resp.responses[0].body) { @@ -1802,10 +1804,18 @@ export class CodeModelBuilder { } private processArraySchemaFromSdkType(type: SdkArrayType, name: string): ArraySchema { - const elementSchema = this.processSchemaFromSdkType(type.valueType, name); + let nullableItems = false; + let elementType = type.valueType; + if (elementType.kind === "nullable") { + nullableItems = true; + elementType = elementType.type; + } + + const elementSchema = this.processSchemaFromSdkType(elementType, name); return this.codeModel.schemas.add( new ArraySchema(name, type.details ?? "", elementSchema, { summary: type.description, + nullableItems: nullableItems, }), ); } @@ -1820,10 +1830,16 @@ export class CodeModelBuilder { this.schemaCache.set(type, dictSchema); } - const elementSchema = this.processSchemaFromSdkType(type.valueType, name); + let nullableItems = false; + let elementType = type.valueType; + if (elementType.kind === "nullable") { + nullableItems = true; + elementType = elementType.type; + } + const elementSchema = this.processSchemaFromSdkType(elementType, name); dictSchema.elementType = elementSchema; - dictSchema.nullableItems = type.nullableValues; + dictSchema.nullableItems = nullableItems; return this.codeModel.schemas.add(dictSchema); } @@ -2001,11 +2017,8 @@ export class CodeModelBuilder { keyType: { kind: "string", encode: "string", - nullable: false, }, description: type.description, - nullableValues: false, - nullable: false, valueType: type.additionalProperties, }; const parentSchema = this.processSchemaFromSdkType(sdkDictType, "Record"); @@ -2044,8 +2057,13 @@ export class CodeModelBuilder { } private processModelPropertyFromSdkType(prop: SdkModelPropertyType): Property { - let schema = this.processSchemaFromSdkType(prop.type, ""); - let nullable = prop.nullable; + let nullable = false; + let nonNullType = prop.type; + if (nonNullType.kind === "nullable") { + nullable = true; + nonNullType = nonNullType.type; + } + let schema = this.processSchemaFromSdkType(nonNullType, ""); let extensions: Record | undefined = undefined; if (this.isSecret(prop)) { diff --git a/typespec-extension/src/operation-utils.ts b/typespec-extension/src/operation-utils.ts index d46bf9b156..cb12d18340 100644 --- a/typespec-extension/src/operation-utils.ts +++ b/typespec-extension/src/operation-utils.ts @@ -221,8 +221,8 @@ export function operationRefersUnion( } // request body if (op.parameters.body) { - if (op.parameters.body.parameter) { - const ret = unionReferredByType(program, op.parameters.body.parameter.type, cache); + if (op.parameters.body.property) { + const ret = unionReferredByType(program, op.parameters.body.property.type, cache); if (ret) { return ret; } diff --git a/typespec-extension/src/type-utils.ts b/typespec-extension/src/type-utils.ts index 1aa1b08cde..13d59af03f 100644 --- a/typespec-extension/src/type-utils.ts +++ b/typespec-extension/src/type-utils.ts @@ -22,7 +22,7 @@ import { SchemaContext } from "@autorest/codemodel"; import { DurationSchema } from "./common/schemas/time.js"; import { getNamespace } from "./utils.js"; import { getUnionAsEnum } from "@azure-tools/typespec-azure-core"; -import { SdkDurationType, isSdkFloatKind, isSdkIntKind } from "@azure-tools/typespec-client-generator-core"; +import { SdkDurationType, SdkType, isSdkFloatKind, isSdkIntKind } from "@azure-tools/typespec-client-generator-core"; import { Version } from "@typespec/versioning"; /** Acts as a cache for processing inputs. @@ -91,6 +91,10 @@ export function isNullableType(type: Type): boolean { } } +export function getNonNullSdkType(type: SdkType): SdkType { + return type.kind === "nullable" ? type.type : type; +} + export function getDurationFormat(encode: EncodeData): DurationSchema["format"] { let format: DurationSchema["format"] = "duration-rfc3339"; // duration encoded as seconds diff --git a/typespec-tests/package.json b/typespec-tests/package.json index 6bc823f8a3..22b0686c4a 100644 --- a/typespec-tests/package.json +++ b/typespec-tests/package.json @@ -10,23 +10,23 @@ }, "dependencies": { "@azure-tools/cadl-ranch-specs": "0.33.4", - "@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.16.4.tgz" + "@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.17.0.tgz" }, "devDependencies": { - "@typespec/prettier-plugin-typespec": "~0.56.0", + "@typespec/prettier-plugin-typespec": "~0.57.0", "prettier-plugin-organize-imports": "3.2.4", "prettier": "~3.2.5" }, "overrides": { - "@typespec/compiler": ">=0.56.0 <1.0.0", - "@typespec/http": ">=0.56.0 <1.0.0", - "@typespec/rest": ">=0.56.0 <1.0.0", - "@typespec/versioning": ">=0.56.0 <1.0.0", - "@typespec/openapi": ">=0.56.0 <1.0.0", - "@azure-tools/typespec-azure-core": ">=0.42.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.42.2 <1.0.0", - "@azure-tools/typespec-azure-resource-manager": ">=0.42.0 <1.0.0", - "@azure-tools/typespec-autorest": ">=0.42.0 <1.0.0" + "@typespec/compiler": ">=0.57.0 <1.0.0", + "@typespec/http": ">=0.57.0 <1.0.0", + "@typespec/rest": ">=0.57.0 <1.0.0", + "@typespec/versioning": ">=0.57.0 <1.0.0", + "@typespec/openapi": ">=0.57.0 <1.0.0", + "@azure-tools/typespec-azure-core": ">=0.43.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.43.0 <1.0.0", + "@azure-tools/typespec-azure-resource-manager": ">=0.43.0 <1.0.0", + "@azure-tools/typespec-autorest": ">=0.43.0 <1.0.0" }, "private": true } diff --git a/typespec-tests/src/main/java/com/_specs_/azure/clientgenerator/core/access/implementation/models/AbstractModel.java b/typespec-tests/src/main/java/com/_specs_/azure/clientgenerator/core/access/implementation/models/AbstractModel.java index 868c9a2020..6128bdba44 100644 --- a/typespec-tests/src/main/java/com/_specs_/azure/clientgenerator/core/access/implementation/models/AbstractModel.java +++ b/typespec-tests/src/main/java/com/_specs_/azure/clientgenerator/core/access/implementation/models/AbstractModel.java @@ -18,7 +18,7 @@ @Immutable public class AbstractModel implements JsonSerializable { /* - * The kind property. + * Discriminator property for AbstractModel. */ @Generated private String kind = "AbstractModel"; @@ -40,7 +40,7 @@ protected AbstractModel(String name) { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for AbstractModel. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/_specs_/azure/clientgenerator/core/access/implementation/models/RealModel.java b/typespec-tests/src/main/java/com/_specs_/azure/clientgenerator/core/access/implementation/models/RealModel.java index c6da1e83b0..93611ab134 100644 --- a/typespec-tests/src/main/java/com/_specs_/azure/clientgenerator/core/access/implementation/models/RealModel.java +++ b/typespec-tests/src/main/java/com/_specs_/azure/clientgenerator/core/access/implementation/models/RealModel.java @@ -17,7 +17,7 @@ @Immutable public final class RealModel extends AbstractModel { /* - * The kind property. + * Discriminator property for AbstractModel. */ @Generated private String kind = "real"; @@ -33,7 +33,7 @@ private RealModel(String name) { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for AbstractModel. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/cadl/armresourceprovider/fluent/ArmResourceProviderClient.java b/typespec-tests/src/main/java/com/cadl/armresourceprovider/fluent/ArmResourceProviderClient.java index 5902ecfa51..5bb78b9db8 100644 --- a/typespec-tests/src/main/java/com/cadl/armresourceprovider/fluent/ArmResourceProviderClient.java +++ b/typespec-tests/src/main/java/com/cadl/armresourceprovider/fluent/ArmResourceProviderClient.java @@ -26,7 +26,7 @@ public interface ArmResourceProviderClient { String getApiVersion(); /** - * Gets The ID of the target subscription. + * Gets The ID of the target subscription. The value must be an UUID. * * @return the subscriptionId value. */ diff --git a/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/ArmResourceProviderClientBuilder.java b/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/ArmResourceProviderClientBuilder.java index f3459d59ab..2b36c77e05 100644 --- a/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/ArmResourceProviderClientBuilder.java +++ b/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/ArmResourceProviderClientBuilder.java @@ -36,12 +36,12 @@ public ArmResourceProviderClientBuilder endpoint(String endpoint) { } /* - * The ID of the target subscription. + * The ID of the target subscription. The value must be an UUID. */ private String subscriptionId; /** - * Sets The ID of the target subscription. + * Sets The ID of the target subscription. The value must be an UUID. * * @param subscriptionId the subscriptionId value. * @return the ArmResourceProviderClientBuilder. diff --git a/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/ArmResourceProviderClientImpl.java b/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/ArmResourceProviderClientImpl.java index ab17522f48..4437b515e7 100644 --- a/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/ArmResourceProviderClientImpl.java +++ b/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/ArmResourceProviderClientImpl.java @@ -71,12 +71,12 @@ public String getApiVersion() { } /** - * The ID of the target subscription. + * The ID of the target subscription. The value must be an UUID. */ private final String subscriptionId; /** - * Gets The ID of the target subscription. + * Gets The ID of the target subscription. The value must be an UUID. * * @return the subscriptionId value. */ @@ -190,7 +190,7 @@ public OperationsClient getOperations() { * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. * @param endpoint Server parameter. - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. */ ArmResourceProviderClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { diff --git a/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/OperationsClientImpl.java b/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/OperationsClientImpl.java index 92d2f67e5a..a41589074e 100644 --- a/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/OperationsClientImpl.java +++ b/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/OperationsClientImpl.java @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.cadl.armresourceprovider.fluent.OperationsClient; import com.cadl.armresourceprovider.fluent.models.OperationInner; -import com.cadl.armresourceprovider.implementation.models.PagedOperation; +import com.cadl.armresourceprovider.implementation.models.OperationListResult; import reactor.core.publisher.Mono; /** @@ -66,14 +66,14 @@ public interface OperationsService { @Get("/providers/Cadl.ArmResourceProvider/operations") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("endpoint") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("accept") String accept, Context context); } diff --git a/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/models/PagedOperation.java b/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/models/OperationListResult.java similarity index 89% rename from typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/models/PagedOperation.java rename to typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/models/OperationListResult.java index 37962da233..a0b13e0cd7 100644 --- a/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/models/PagedOperation.java +++ b/typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/models/OperationListResult.java @@ -15,7 +15,7 @@ * results. */ @Immutable -public final class PagedOperation { +public final class OperationListResult { /* * The Operation items on this page */ @@ -29,9 +29,9 @@ public final class PagedOperation { private String nextLink; /** - * Creates an instance of PagedOperation class. + * Creates an instance of OperationListResult class. */ - private PagedOperation() { + private OperationListResult() { } /** @@ -60,11 +60,11 @@ public String nextLink() { public void validate() { if (value() == null) { throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property value in model PagedOperation")); + .log(new IllegalArgumentException("Missing required property value in model OperationListResult")); } else { value().forEach(e -> e.validate()); } } - private static final ClientLogger LOGGER = new ClientLogger(PagedOperation.class); + private static final ClientLogger LOGGER = new ClientLogger(OperationListResult.class); } diff --git a/typespec-tests/src/main/java/com/cadl/armresourceprovider/models/ManagedServiceIdentity.java b/typespec-tests/src/main/java/com/cadl/armresourceprovider/models/ManagedServiceIdentity.java index 0f4a0c170d..1fea7ca78f 100644 --- a/typespec-tests/src/main/java/com/cadl/armresourceprovider/models/ManagedServiceIdentity.java +++ b/typespec-tests/src/main/java/com/cadl/armresourceprovider/models/ManagedServiceIdentity.java @@ -11,21 +11,23 @@ import java.util.Map; /** - * The properties of the managed service identities assigned to this resource. + * Managed service identity (system assigned and/or user assigned identities). */ @Fluent public final class ManagedServiceIdentity { /* - * The Active Directory tenant id of the principal. + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. */ - @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) - private String tenantId; + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; /* - * The active directory identifier of this principal. + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. */ - @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) - private String principalId; + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; /* * The type of managed identity assigned to this resource. @@ -47,21 +49,23 @@ public ManagedServiceIdentity() { } /** - * Get the tenantId property: The Active Directory tenant id of the principal. + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. * - * @return the tenantId value. + * @return the principalId value. */ - public String tenantId() { - return this.tenantId; + public String principalId() { + return this.principalId; } /** - * Get the principalId property: The active directory identifier of this principal. + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. * - * @return the principalId value. + * @return the tenantId value. */ - public String principalId() { - return this.principalId; + public String tenantId() { + return this.tenantId; } /** diff --git a/typespec-tests/src/main/java/com/cadl/armresourceprovider/models/ManagedServiceIdentityType.java b/typespec-tests/src/main/java/com/cadl/armresourceprovider/models/ManagedServiceIdentityType.java index 98cec734ec..3870b028de 100644 --- a/typespec-tests/src/main/java/com/cadl/armresourceprovider/models/ManagedServiceIdentityType.java +++ b/typespec-tests/src/main/java/com/cadl/armresourceprovider/models/ManagedServiceIdentityType.java @@ -9,7 +9,7 @@ import java.util.Collection; /** - * The kind of managed identity assigned to this resource. + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ public final class ManagedServiceIdentityType extends ExpandableStringEnum { /** @@ -28,10 +28,10 @@ public final class ManagedServiceIdentityType extends ExpandableStringEnum { /* - * The kind property. + * Discriminator property for Fish. */ private String kind = "Fish"; @@ -40,7 +40,7 @@ protected FishInner() { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/fluent/models/SalmonInner.java b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/fluent/models/SalmonInner.java index 0420f56549..55511d88d7 100644 --- a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/fluent/models/SalmonInner.java +++ b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/fluent/models/SalmonInner.java @@ -19,7 +19,7 @@ @Immutable public final class SalmonInner extends FishInner { /* - * The kind property. + * Discriminator property for Fish. */ private String kind = "salmon"; @@ -55,7 +55,7 @@ private SalmonInner() { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/implementation/ArmStreamStyleSerializationClientBuilder.java b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/implementation/ArmStreamStyleSerializationClientBuilder.java index d83867733e..9b10cf2326 100644 --- a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/implementation/ArmStreamStyleSerializationClientBuilder.java +++ b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/implementation/ArmStreamStyleSerializationClientBuilder.java @@ -36,12 +36,12 @@ public ArmStreamStyleSerializationClientBuilder endpoint(String endpoint) { } /* - * The ID of the target subscription. + * The ID of the target subscription. The value must be an UUID. */ private String subscriptionId; /** - * Sets The ID of the target subscription. + * Sets The ID of the target subscription. The value must be an UUID. * * @param subscriptionId the subscriptionId value. * @return the ArmStreamStyleSerializationClientBuilder. diff --git a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/implementation/ArmStreamStyleSerializationClientImpl.java b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/implementation/ArmStreamStyleSerializationClientImpl.java index 6f8d04995a..29c56c88aa 100644 --- a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/implementation/ArmStreamStyleSerializationClientImpl.java +++ b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/implementation/ArmStreamStyleSerializationClientImpl.java @@ -69,12 +69,12 @@ public String getApiVersion() { } /** - * The ID of the target subscription. + * The ID of the target subscription. The value must be an UUID. */ private final String subscriptionId; /** - * Gets The ID of the target subscription. + * Gets The ID of the target subscription. The value must be an UUID. * * @return the subscriptionId value. */ @@ -160,7 +160,7 @@ public TopLevelArmResourcesClient getTopLevelArmResources() { * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. * @param endpoint Server parameter. - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. */ ArmStreamStyleSerializationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { diff --git a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/Fish.java b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/Fish.java index 67ff6203a0..4b01608aca 100644 --- a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/Fish.java +++ b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/Fish.java @@ -11,7 +11,7 @@ */ public interface Fish { /** - * Gets the kind property: The kind property. + * Gets the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/GoblinShark.java b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/GoblinShark.java index 7239f238b6..e053a7373f 100644 --- a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/GoblinShark.java +++ b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/GoblinShark.java @@ -16,7 +16,7 @@ @Immutable public final class GoblinShark extends Shark { /* - * The kind property. + * Discriminator property for Fish. */ private String kind = "shark"; @@ -42,7 +42,7 @@ private GoblinShark() { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/Salmon.java b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/Salmon.java index d41ea87da0..4eac1b71bf 100644 --- a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/Salmon.java +++ b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/Salmon.java @@ -27,7 +27,7 @@ public interface Salmon { String dna(); /** - * Gets the kind property: The kind property. + * Gets the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/SawShark.java b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/SawShark.java index d6eac01d0a..b15dffcaa1 100644 --- a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/SawShark.java +++ b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/SawShark.java @@ -16,7 +16,7 @@ @Immutable public final class SawShark extends Shark { /* - * The kind property. + * Discriminator property for Fish. */ private String kind = "shark"; @@ -42,7 +42,7 @@ private SawShark() { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/Shark.java b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/Shark.java index 248da20bdd..a82e8c50c8 100644 --- a/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/Shark.java +++ b/typespec-tests/src/main/java/com/cadl/armstreamstyleserialization/models/Shark.java @@ -17,7 +17,7 @@ @Immutable public class Shark extends FishInner { /* - * The kind property. + * Discriminator property for Fish. */ private String kind = "shark"; @@ -43,7 +43,7 @@ protected Shark() { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/cadl/flatten/implementation/FlattenClientImpl.java b/typespec-tests/src/main/java/com/cadl/flatten/implementation/FlattenClientImpl.java index 071f09536f..4fe8ec0071 100644 --- a/typespec-tests/src/main/java/com/cadl/flatten/implementation/FlattenClientImpl.java +++ b/typespec-tests/src/main/java/com/cadl/flatten/implementation/FlattenClientImpl.java @@ -212,7 +212,7 @@ Response sendLongSync(@HostParam("endpoint") String endpoint, @QueryParam( @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> update(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @PathParam("id") long id, + @HeaderParam("Content-Type") String contentType, @PathParam("id") long id, @HeaderParam("accept") String accept, @BodyParam("application/merge-patch+json") BinaryData request, RequestOptions requestOptions, Context context); @@ -223,7 +223,7 @@ Mono> update(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response updateSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @PathParam("id") long id, + @HeaderParam("Content-Type") String contentType, @PathParam("id") long id, @HeaderParam("accept") String accept, @BodyParam("application/merge-patch+json") BinaryData request, RequestOptions requestOptions, Context context); @@ -235,7 +235,7 @@ Response updateSync(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> uploadFile(@HostParam("endpoint") String endpoint, @PathParam("name") String name, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData request, RequestOptions requestOptions, Context context); // @Multipart not supported by RestProxy @@ -246,7 +246,7 @@ Mono> uploadFile(@HostParam("endpoint") String endpoint, @PathPar @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response uploadFileSync(@HostParam("endpoint") String endpoint, @PathParam("name") String name, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData request, RequestOptions requestOptions, Context context); // @Multipart not supported by RestProxy @@ -257,7 +257,7 @@ Response uploadFileSync(@HostParam("endpoint") String endpoint, @PathParam @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> uploadTodo(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData request, RequestOptions requestOptions, Context context); // @Multipart not supported by RestProxy @@ -268,7 +268,7 @@ Mono> uploadTodo(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response uploadTodoSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData request, RequestOptions requestOptions, Context context); } diff --git a/typespec-tests/src/main/java/com/cadl/flatten/implementation/models/SendLongRequest.java b/typespec-tests/src/main/java/com/cadl/flatten/implementation/models/SendLongRequest.java index 9b55f3f82f..a54496adac 100644 --- a/typespec-tests/src/main/java/com/cadl/flatten/implementation/models/SendLongRequest.java +++ b/typespec-tests/src/main/java/com/cadl/flatten/implementation/models/SendLongRequest.java @@ -10,7 +10,7 @@ import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; -import com.cadl.flatten.models.SendLongRequestStatus; +import com.cadl.flatten.models.TodoItemStatus; import com.cadl.flatten.models.User; import java.io.IOException; @@ -71,7 +71,7 @@ public final class SendLongRequest implements JsonSerializable * The status of the todo item */ @Generated - private final SendLongRequestStatus status; + private final TodoItemStatus status; /* * The _dummy property. @@ -94,7 +94,7 @@ public final class SendLongRequest implements JsonSerializable * @param status the status value to set. */ @Generated - public SendLongRequest(String input, int dataInt, String title, SendLongRequestStatus status) { + public SendLongRequest(String input, int dataInt, String title, TodoItemStatus status) { this.input = input; this.dataInt = dataInt; this.title = title; @@ -247,7 +247,7 @@ public SendLongRequest setDescription(String description) { * @return the status value. */ @Generated - public SendLongRequestStatus getStatus() { + public TodoItemStatus getStatus() { return this.status; } @@ -319,7 +319,7 @@ public static SendLongRequest fromJson(JsonReader jsonReader) throws IOException String input = null; int dataInt = 0; String title = null; - SendLongRequestStatus status = null; + TodoItemStatus status = null; User user = null; Integer dataIntOptional = null; Long dataLong = null; @@ -337,7 +337,7 @@ public static SendLongRequest fromJson(JsonReader jsonReader) throws IOException } else if ("title".equals(fieldName)) { title = reader.getString(); } else if ("status".equals(fieldName)) { - status = SendLongRequestStatus.fromString(reader.getString()); + status = TodoItemStatus.fromString(reader.getString()); } else if ("user".equals(fieldName)) { user = User.fromJson(reader); } else if ("dataIntOptional".equals(fieldName)) { diff --git a/typespec-tests/src/main/java/com/cadl/flatten/implementation/models/UploadTodoRequest.java b/typespec-tests/src/main/java/com/cadl/flatten/implementation/models/UploadTodoRequest.java index a1b964c195..4ea65b1663 100644 --- a/typespec-tests/src/main/java/com/cadl/flatten/implementation/models/UploadTodoRequest.java +++ b/typespec-tests/src/main/java/com/cadl/flatten/implementation/models/UploadTodoRequest.java @@ -6,7 +6,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.annotation.Generated; -import com.cadl.flatten.models.SendLongRequestStatus; +import com.cadl.flatten.models.TodoItemStatus; /** * The UploadTodoRequest model. @@ -29,7 +29,7 @@ public final class UploadTodoRequest { * The status of the todo item */ @Generated - private final SendLongRequestStatus status; + private final TodoItemStatus status; /* * The _dummy property. @@ -62,7 +62,7 @@ public final class UploadTodoRequest { * @param status the status value to set. */ @Generated - public UploadTodoRequest(String title, SendLongRequestStatus status) { + public UploadTodoRequest(String title, TodoItemStatus status) { this.title = title; this.status = status; } @@ -105,7 +105,7 @@ public UploadTodoRequest setDescription(String description) { * @return the status value. */ @Generated - public SendLongRequestStatus getStatus() { + public TodoItemStatus getStatus() { return this.status; } diff --git a/typespec-tests/src/main/java/com/cadl/flatten/models/SendLongOptions.java b/typespec-tests/src/main/java/com/cadl/flatten/models/SendLongOptions.java index bcf385491b..e0ba60feeb 100644 --- a/typespec-tests/src/main/java/com/cadl/flatten/models/SendLongOptions.java +++ b/typespec-tests/src/main/java/com/cadl/flatten/models/SendLongOptions.java @@ -76,7 +76,7 @@ public final class SendLongOptions { * The status of the todo item */ @Generated - private final SendLongRequestStatus status; + private final TodoItemStatus status; /* * The _dummy property. @@ -94,7 +94,7 @@ public final class SendLongOptions { * @param status the status value to set. */ @Generated - public SendLongOptions(String name, String input, int dataInt, String title, SendLongRequestStatus status) { + public SendLongOptions(String name, String input, int dataInt, String title, TodoItemStatus status) { this.name = name; this.input = input; this.dataInt = dataInt; @@ -280,7 +280,7 @@ public SendLongOptions setDescription(String description) { * @return the status value. */ @Generated - public SendLongRequestStatus getStatus() { + public TodoItemStatus getStatus() { return this.status; } diff --git a/typespec-tests/src/main/java/com/cadl/flatten/models/TodoItem.java b/typespec-tests/src/main/java/com/cadl/flatten/models/TodoItem.java index d3b4ec61f8..3d4fd03727 100644 --- a/typespec-tests/src/main/java/com/cadl/flatten/models/TodoItem.java +++ b/typespec-tests/src/main/java/com/cadl/flatten/models/TodoItem.java @@ -41,7 +41,7 @@ public final class TodoItem implements JsonSerializable { * The status of the todo item */ @Generated - private final SendLongRequestStatus status; + private final TodoItemStatus status; /* * When the todo item was created. @@ -74,7 +74,7 @@ public final class TodoItem implements JsonSerializable { * @param status the status value to set. */ @Generated - private TodoItem(String title, SendLongRequestStatus status) { + private TodoItem(String title, TodoItemStatus status) { this.title = title; this.status = status; } @@ -115,7 +115,7 @@ public String getDescription() { * @return the status value. */ @Generated - public SendLongRequestStatus getStatus() { + public TodoItemStatus getStatus() { return this.status; } @@ -187,7 +187,7 @@ public static TodoItem fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { long id = 0L; String title = null; - SendLongRequestStatus status = null; + TodoItemStatus status = null; OffsetDateTime createdAt = null; OffsetDateTime updatedAt = null; String description = null; @@ -202,7 +202,7 @@ public static TodoItem fromJson(JsonReader jsonReader) throws IOException { } else if ("title".equals(fieldName)) { title = reader.getString(); } else if ("status".equals(fieldName)) { - status = SendLongRequestStatus.fromString(reader.getString()); + status = TodoItemStatus.fromString(reader.getString()); } else if ("createdAt".equals(fieldName)) { createdAt = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); diff --git a/typespec-tests/src/main/java/com/cadl/flatten/models/SendLongRequestStatus.java b/typespec-tests/src/main/java/com/cadl/flatten/models/TodoItemStatus.java similarity index 62% rename from typespec-tests/src/main/java/com/cadl/flatten/models/SendLongRequestStatus.java rename to typespec-tests/src/main/java/com/cadl/flatten/models/TodoItemStatus.java index 774868e924..dd5546b06d 100644 --- a/typespec-tests/src/main/java/com/cadl/flatten/models/SendLongRequestStatus.java +++ b/typespec-tests/src/main/java/com/cadl/flatten/models/TodoItemStatus.java @@ -5,9 +5,9 @@ package com.cadl.flatten.models; /** - * Defines values for SendLongRequestStatus. + * Defines values for TodoItemStatus. */ -public enum SendLongRequestStatus { +public enum TodoItemStatus { /** * Enum value NotStarted. */ @@ -24,26 +24,26 @@ public enum SendLongRequestStatus { COMPLETED("Completed"); /** - * The actual serialized value for a SendLongRequestStatus instance. + * The actual serialized value for a TodoItemStatus instance. */ private final String value; - SendLongRequestStatus(String value) { + TodoItemStatus(String value) { this.value = value; } /** - * Parses a serialized value to a SendLongRequestStatus instance. + * Parses a serialized value to a TodoItemStatus instance. * * @param value the serialized value to parse. - * @return the parsed SendLongRequestStatus object, or null if unable to parse. + * @return the parsed TodoItemStatus object, or null if unable to parse. */ - public static SendLongRequestStatus fromString(String value) { + public static TodoItemStatus fromString(String value) { if (value == null) { return null; } - SendLongRequestStatus[] items = SendLongRequestStatus.values(); - for (SendLongRequestStatus item : items) { + TodoItemStatus[] items = TodoItemStatus.values(); + for (TodoItemStatus item : items) { if (item.toString().equalsIgnoreCase(value)) { return item; } diff --git a/typespec-tests/src/main/java/com/cadl/flatten/models/UploadTodoOptions.java b/typespec-tests/src/main/java/com/cadl/flatten/models/UploadTodoOptions.java index f05e56c243..e61bcb6023 100644 --- a/typespec-tests/src/main/java/com/cadl/flatten/models/UploadTodoOptions.java +++ b/typespec-tests/src/main/java/com/cadl/flatten/models/UploadTodoOptions.java @@ -28,7 +28,7 @@ public final class UploadTodoOptions { * The status of the todo item */ @Generated - private final SendLongRequestStatus status; + private final TodoItemStatus status; /* * The _dummy property. @@ -61,7 +61,7 @@ public final class UploadTodoOptions { * @param status the status value to set. */ @Generated - public UploadTodoOptions(String title, SendLongRequestStatus status) { + public UploadTodoOptions(String title, TodoItemStatus status) { this.title = title; this.status = status; } @@ -104,7 +104,7 @@ public UploadTodoOptions setDescription(String description) { * @return the status value. */ @Generated - public SendLongRequestStatus getStatus() { + public TodoItemStatus getStatus() { return this.status; } diff --git a/typespec-tests/src/main/java/com/cadl/literalservice/models/Model.java b/typespec-tests/src/main/java/com/cadl/literalservice/models/Model.java index 143157bf1a..d37c9708b2 100644 --- a/typespec-tests/src/main/java/com/cadl/literalservice/models/Model.java +++ b/typespec-tests/src/main/java/com/cadl/literalservice/models/Model.java @@ -27,7 +27,7 @@ public final class Model implements JsonSerializable { * The optionalLiteral property. */ @Generated - private ModelOptionalLiteralOptionalLiteral optionalLiteral; + private ModelOptionalLiteral optionalLiteral; /** * Creates an instance of Model class. @@ -52,7 +52,7 @@ public String getLiteral() { * @return the optionalLiteral value. */ @Generated - public ModelOptionalLiteralOptionalLiteral getOptionalLiteral() { + public ModelOptionalLiteral getOptionalLiteral() { return this.optionalLiteral; } @@ -63,7 +63,7 @@ public ModelOptionalLiteralOptionalLiteral getOptionalLiteral() { * @return the Model object itself. */ @Generated - public Model setOptionalLiteral(ModelOptionalLiteralOptionalLiteral optionalLiteral) { + public Model setOptionalLiteral(ModelOptionalLiteral optionalLiteral) { this.optionalLiteral = optionalLiteral; return this; } @@ -99,8 +99,7 @@ public static Model fromJson(JsonReader jsonReader) throws IOException { reader.nextToken(); if ("optionalLiteral".equals(fieldName)) { - deserializedModel.optionalLiteral - = ModelOptionalLiteralOptionalLiteral.fromString(reader.getString()); + deserializedModel.optionalLiteral = ModelOptionalLiteral.fromString(reader.getString()); } else { reader.skipChildren(); } diff --git a/typespec-tests/src/main/java/com/cadl/literalservice/models/ModelOptionalLiteralOptionalLiteral.java b/typespec-tests/src/main/java/com/cadl/literalservice/models/ModelOptionalLiteral.java similarity index 53% rename from typespec-tests/src/main/java/com/cadl/literalservice/models/ModelOptionalLiteralOptionalLiteral.java rename to typespec-tests/src/main/java/com/cadl/literalservice/models/ModelOptionalLiteral.java index 9804c262c8..d91cb650df 100644 --- a/typespec-tests/src/main/java/com/cadl/literalservice/models/ModelOptionalLiteralOptionalLiteral.java +++ b/typespec-tests/src/main/java/com/cadl/literalservice/models/ModelOptionalLiteral.java @@ -5,35 +5,35 @@ package com.cadl.literalservice.models; /** - * Defines values for ModelOptionalLiteralOptionalLiteral. + * Defines values for ModelOptionalLiteral. */ -public enum ModelOptionalLiteralOptionalLiteral { +public enum ModelOptionalLiteral { /** * Enum value optionalLiteral. */ OPTIONAL_LITERAL("optionalLiteral"); /** - * The actual serialized value for a ModelOptionalLiteralOptionalLiteral instance. + * The actual serialized value for a ModelOptionalLiteral instance. */ private final String value; - ModelOptionalLiteralOptionalLiteral(String value) { + ModelOptionalLiteral(String value) { this.value = value; } /** - * Parses a serialized value to a ModelOptionalLiteralOptionalLiteral instance. + * Parses a serialized value to a ModelOptionalLiteral instance. * * @param value the serialized value to parse. - * @return the parsed ModelOptionalLiteralOptionalLiteral object, or null if unable to parse. + * @return the parsed ModelOptionalLiteral object, or null if unable to parse. */ - public static ModelOptionalLiteralOptionalLiteral fromString(String value) { + public static ModelOptionalLiteral fromString(String value) { if (value == null) { return null; } - ModelOptionalLiteralOptionalLiteral[] items = ModelOptionalLiteralOptionalLiteral.values(); - for (ModelOptionalLiteralOptionalLiteral item : items) { + ModelOptionalLiteral[] items = ModelOptionalLiteral.values(); + for (ModelOptionalLiteral item : items) { if (item.toString().equalsIgnoreCase(value)) { return item; } diff --git a/typespec-tests/src/main/java/com/cadl/longrunning/models/OperationState.java b/typespec-tests/src/main/java/com/cadl/longrunning/models/OperationState.java index 9313f4f237..30784b9a26 100644 --- a/typespec-tests/src/main/java/com/cadl/longrunning/models/OperationState.java +++ b/typespec-tests/src/main/java/com/cadl/longrunning/models/OperationState.java @@ -4,68 +4,72 @@ package com.cadl.longrunning.models; +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + /** * Enum describing allowed operation states. */ -public enum OperationState { +public final class OperationState extends ExpandableStringEnum { /** * The operation has not started. */ - NOT_STARTED("NotStarted"), + @Generated + public static final OperationState NOT_STARTED = fromString("NotStarted"); /** * The operation is in progress. */ - RUNNING("Running"), + @Generated + public static final OperationState RUNNING = fromString("Running"); /** * The operation has completed successfully. */ - SUCCEEDED("Succeeded"), + @Generated + public static final OperationState SUCCEEDED = fromString("Succeeded"); /** * The operation has failed. */ - FAILED("Failed"), + @Generated + public static final OperationState FAILED = fromString("Failed"); /** * The operation has been canceled by the user. */ - CANCELED("Canceled"); + @Generated + public static final OperationState CANCELED = fromString("Canceled"); /** - * The actual serialized value for a OperationState instance. + * Creates a new instance of OperationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. */ - private final String value; - - OperationState(String value) { - this.value = value; + @Generated + @Deprecated + public OperationState() { } /** - * Parses a serialized value to a OperationState instance. + * Creates or finds a OperationState from its string representation. * - * @param value the serialized value to parse. - * @return the parsed OperationState object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding OperationState. */ - public static OperationState fromString(String value) { - if (value == null) { - return null; - } - OperationState[] items = OperationState.values(); - for (OperationState item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + @Generated + public static OperationState fromString(String name) { + return fromString(name, OperationState.class); } /** - * {@inheritDoc} + * Gets known OperationState values. + * + * @return known OperationState values. */ - @Override - public String toString() { - return this.value; + @Generated + public static Collection values() { + return values(OperationState.class); } } diff --git a/typespec-tests/src/main/java/com/cadl/multicontenttypes/implementation/MultiContentTypesClientImpl.java b/typespec-tests/src/main/java/com/cadl/multicontenttypes/implementation/MultiContentTypesClientImpl.java index ee1a36ecb4..085ee0e108 100644 --- a/typespec-tests/src/main/java/com/cadl/multicontenttypes/implementation/MultiContentTypesClientImpl.java +++ b/typespec-tests/src/main/java/com/cadl/multicontenttypes/implementation/MultiContentTypesClientImpl.java @@ -163,7 +163,7 @@ public interface MultiContentTypesClientService { @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> uploadWithOverload(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); @Post("/upload/overload/multi-body-types") @@ -173,7 +173,7 @@ Mono> uploadWithOverload(@HostParam("endpoint") String endpoint, @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response uploadWithOverloadSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); } diff --git a/typespec-tests/src/main/java/com/cadl/multicontenttypes/implementation/MultipleContentTypesOnRequestsImpl.java b/typespec-tests/src/main/java/com/cadl/multicontenttypes/implementation/MultipleContentTypesOnRequestsImpl.java index dcca8971ef..46b7d1cc06 100644 --- a/typespec-tests/src/main/java/com/cadl/multicontenttypes/implementation/MultipleContentTypesOnRequestsImpl.java +++ b/typespec-tests/src/main/java/com/cadl/multicontenttypes/implementation/MultipleContentTypesOnRequestsImpl.java @@ -65,7 +65,7 @@ public interface MultipleContentTypesOnRequestsService { @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> uploadBytesWithSingleBodyTypeForMultiContentTypes(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); @Post("/multiple/sharedroute/request/upload/single-body-type") @@ -75,7 +75,7 @@ Mono> uploadBytesWithSingleBodyTypeForMultiContentTypes(@HostPara @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response uploadBytesWithSingleBodyTypeForMultiContentTypesSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); @Post("/multiple/sharedroute/request/upload/multi-body-types") @@ -85,7 +85,7 @@ Response uploadBytesWithSingleBodyTypeForMultiContentTypesSync(@HostParam( @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> uploadBytesWithMultiBodyTypesForMultiContentTypes(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); @Post("/multiple/sharedroute/request/upload/multi-body-types") @@ -95,7 +95,7 @@ Mono> uploadBytesWithMultiBodyTypesForMultiContentTypes(@HostPara @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response uploadBytesWithMultiBodyTypesForMultiContentTypesSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); @Post("/multiple/sharedroute/request/upload/multi-body-types") @@ -105,7 +105,7 @@ Response uploadBytesWithMultiBodyTypesForMultiContentTypesSync(@HostParam( @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> uploadJsonWithMultiBodyTypesForMultiContentTypes(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); @Post("/multiple/sharedroute/request/upload/multi-body-types") @@ -115,7 +115,7 @@ Mono> uploadJsonWithMultiBodyTypesForMultiContentTypes(@HostParam @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response uploadJsonWithMultiBodyTypesForMultiContentTypesSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); @Post("/multiple/sharedroute/request/upload/multi-body-types") @@ -125,7 +125,7 @@ Response uploadJsonWithMultiBodyTypesForMultiContentTypesSync(@HostParam(" @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypes( - @HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, + @HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); @@ -136,7 +136,7 @@ Mono> uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypes( @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesSync( - @HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, + @HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); } diff --git a/typespec-tests/src/main/java/com/cadl/multicontenttypes/implementation/SingleContentTypesImpl.java b/typespec-tests/src/main/java/com/cadl/multicontenttypes/implementation/SingleContentTypesImpl.java index 1d5a4aae4a..cb4163656d 100644 --- a/typespec-tests/src/main/java/com/cadl/multicontenttypes/implementation/SingleContentTypesImpl.java +++ b/typespec-tests/src/main/java/com/cadl/multicontenttypes/implementation/SingleContentTypesImpl.java @@ -84,7 +84,7 @@ Response downloadImageForSingleContentTypeSync(@HostParam("endpoint" @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> uploadImageForSingleContentType(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("image/png") BinaryData data, RequestOptions requestOptions, Context context); @Post("/single/request/upload/image") @@ -94,7 +94,7 @@ Mono> uploadImageForSingleContentType(@HostParam("endpoint") Stri @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response uploadImageForSingleContentTypeSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("image/png") BinaryData data, RequestOptions requestOptions, Context context); } diff --git a/typespec-tests/src/main/java/com/cadl/multipart/implementation/MultipartClientImpl.java b/typespec-tests/src/main/java/com/cadl/multipart/implementation/MultipartClientImpl.java index 42832caca9..853c9204e5 100644 --- a/typespec-tests/src/main/java/com/cadl/multipart/implementation/MultipartClientImpl.java +++ b/typespec-tests/src/main/java/com/cadl/multipart/implementation/MultipartClientImpl.java @@ -133,7 +133,7 @@ public interface MultipartClientService { @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> upload(@HostParam("endpoint") String endpoint, @PathParam("name") String name, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData data, RequestOptions requestOptions, Context context); // @Multipart not supported by RestProxy @@ -144,7 +144,7 @@ Mono> upload(@HostParam("endpoint") String endpoint, @PathParam(" @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response uploadSync(@HostParam("endpoint") String endpoint, @PathParam("name") String name, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData data, RequestOptions requestOptions, Context context); } diff --git a/typespec-tests/src/main/java/com/cadl/patch/implementation/PatchesImpl.java b/typespec-tests/src/main/java/com/cadl/patch/implementation/PatchesImpl.java index e3e46aed12..7b306b793a 100644 --- a/typespec-tests/src/main/java/com/cadl/patch/implementation/PatchesImpl.java +++ b/typespec-tests/src/main/java/com/cadl/patch/implementation/PatchesImpl.java @@ -65,7 +65,7 @@ public interface PatchesService { @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> createOrUpdateResource(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, Context context); @@ -76,7 +76,7 @@ Mono> createOrUpdateResource(@HostParam("endpoint") String @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response createOrUpdateResourceSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, Context context); @@ -87,7 +87,7 @@ Response createOrUpdateResourceSync(@HostParam("endpoint") String en @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> createOrUpdateOptionalResource(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); @Patch("/patch/resource/optional") @@ -97,7 +97,7 @@ Mono> createOrUpdateOptionalResource(@HostParam("endpoint") @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response createOrUpdateOptionalResourceSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); @Patch("/patch/fish") @@ -107,7 +107,7 @@ Response createOrUpdateOptionalResourceSync(@HostParam("endpoint") S @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> createOrUpdateFish(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/merge-patch+json") BinaryData fish, RequestOptions requestOptions, Context context); @Patch("/patch/fish") @@ -117,7 +117,7 @@ Mono> createOrUpdateFish(@HostParam("endpoint") String endp @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) Response createOrUpdateFishSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/merge-patch+json") BinaryData fish, RequestOptions requestOptions, Context context); } diff --git a/typespec-tests/src/main/java/com/cadl/patch/models/Fish.java b/typespec-tests/src/main/java/com/cadl/patch/models/Fish.java index a0aa73cd30..d555458b52 100644 --- a/typespec-tests/src/main/java/com/cadl/patch/models/Fish.java +++ b/typespec-tests/src/main/java/com/cadl/patch/models/Fish.java @@ -21,7 +21,7 @@ @Fluent public class Fish implements JsonSerializable { /* - * The kind property. + * Discriminator property for Fish. */ @Generated private String kind = "Fish"; @@ -107,7 +107,7 @@ public Fish() { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/cadl/patch/models/Salmon.java b/typespec-tests/src/main/java/com/cadl/patch/models/Salmon.java index a7ccd6ae8a..475b15ac32 100644 --- a/typespec-tests/src/main/java/com/cadl/patch/models/Salmon.java +++ b/typespec-tests/src/main/java/com/cadl/patch/models/Salmon.java @@ -23,7 +23,7 @@ @Fluent public final class Salmon extends Fish { /* - * The kind property. + * Discriminator property for Fish. */ @Generated private String kind = "salmon"; @@ -60,7 +60,7 @@ public Salmon() { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/cadl/patch/models/SawShark.java b/typespec-tests/src/main/java/com/cadl/patch/models/SawShark.java index 15c54652e9..f08773eb1b 100644 --- a/typespec-tests/src/main/java/com/cadl/patch/models/SawShark.java +++ b/typespec-tests/src/main/java/com/cadl/patch/models/SawShark.java @@ -20,7 +20,7 @@ @Fluent public final class SawShark extends Shark { /* - * The kind property. + * Discriminator property for Fish. */ @Generated private String kind = "shark"; @@ -45,7 +45,7 @@ public SawShark() { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/cadl/patch/models/Shark.java b/typespec-tests/src/main/java/com/cadl/patch/models/Shark.java index 32053bffe9..0e22b21bdb 100644 --- a/typespec-tests/src/main/java/com/cadl/patch/models/Shark.java +++ b/typespec-tests/src/main/java/com/cadl/patch/models/Shark.java @@ -20,7 +20,7 @@ @Fluent public class Shark extends Fish { /* - * The kind property. + * Discriminator property for Fish. */ @Generated private String kind = "shark"; @@ -60,7 +60,7 @@ public Shark() { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/cadl/response/models/OperationState.java b/typespec-tests/src/main/java/com/cadl/response/models/OperationState.java index f8874d5a62..ce23be521f 100644 --- a/typespec-tests/src/main/java/com/cadl/response/models/OperationState.java +++ b/typespec-tests/src/main/java/com/cadl/response/models/OperationState.java @@ -4,68 +4,72 @@ package com.cadl.response.models; +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + /** * Enum describing allowed operation states. */ -public enum OperationState { +public final class OperationState extends ExpandableStringEnum { /** * The operation has not started. */ - NOT_STARTED("NotStarted"), + @Generated + public static final OperationState NOT_STARTED = fromString("NotStarted"); /** * The operation is in progress. */ - RUNNING("Running"), + @Generated + public static final OperationState RUNNING = fromString("Running"); /** * The operation has completed successfully. */ - SUCCEEDED("Succeeded"), + @Generated + public static final OperationState SUCCEEDED = fromString("Succeeded"); /** * The operation has failed. */ - FAILED("Failed"), + @Generated + public static final OperationState FAILED = fromString("Failed"); /** * The operation has been canceled by the user. */ - CANCELED("Canceled"); + @Generated + public static final OperationState CANCELED = fromString("Canceled"); /** - * The actual serialized value for a OperationState instance. + * Creates a new instance of OperationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. */ - private final String value; - - OperationState(String value) { - this.value = value; + @Generated + @Deprecated + public OperationState() { } /** - * Parses a serialized value to a OperationState instance. + * Creates or finds a OperationState from its string representation. * - * @param value the serialized value to parse. - * @return the parsed OperationState object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding OperationState. */ - public static OperationState fromString(String value) { - if (value == null) { - return null; - } - OperationState[] items = OperationState.values(); - for (OperationState item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + @Generated + public static OperationState fromString(String name) { + return fromString(name, OperationState.class); } /** - * {@inheritDoc} + * Gets known OperationState values. + * + * @return known OperationState values. */ - @Override - public String toString() { - return this.value; + @Generated + public static Collection values() { + return values(OperationState.class); } } diff --git a/typespec-tests/src/main/java/com/encode/bytes/implementation/RequestBodiesImpl.java b/typespec-tests/src/main/java/com/encode/bytes/implementation/RequestBodiesImpl.java index 257247ebad..762be5849e 100644 --- a/typespec-tests/src/main/java/com/encode/bytes/implementation/RequestBodiesImpl.java +++ b/typespec-tests/src/main/java/com/encode/bytes/implementation/RequestBodiesImpl.java @@ -81,7 +81,7 @@ Response defaultMethodSync(@HeaderParam("accept") String accept, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> octetStream(@HeaderParam("content-type") String contentType, + Mono> octetStream(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/octet-stream") BinaryData value, RequestOptions requestOptions, Context context); @@ -91,7 +91,7 @@ Mono> octetStream(@HeaderParam("content-type") String contentType @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response octetStreamSync(@HeaderParam("content-type") String contentType, + Response octetStreamSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/octet-stream") BinaryData value, RequestOptions requestOptions, Context context); @@ -101,7 +101,7 @@ Response octetStreamSync(@HeaderParam("content-type") String contentType, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> customContentType(@HeaderParam("content-type") String contentType, + Mono> customContentType(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("image/png") BinaryData value, RequestOptions requestOptions, Context context); @@ -111,7 +111,7 @@ Mono> customContentType(@HeaderParam("content-type") String conte @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response customContentTypeSync(@HeaderParam("content-type") String contentType, + Response customContentTypeSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("image/png") BinaryData value, RequestOptions requestOptions, Context context); diff --git a/typespec-tests/src/main/java/com/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java b/typespec-tests/src/main/java/com/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java index a96d48530e..fdd1cb6e35 100644 --- a/typespec-tests/src/main/java/com/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java +++ b/typespec-tests/src/main/java/com/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java @@ -131,7 +131,7 @@ Response createResourceSync(@HeaderParam("accept") String accept, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> updateResource(@HeaderParam("content-type") String contentType, + Mono> updateResource(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); @@ -141,7 +141,7 @@ Mono> updateResource(@HeaderParam("content-type") String co @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response updateResourceSync(@HeaderParam("content-type") String contentType, + Response updateResourceSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); @@ -151,7 +151,7 @@ Response updateResourceSync(@HeaderParam("content-type") String cont @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> updateOptionalResource(@HeaderParam("content-type") String contentType, + Mono> updateOptionalResource(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); @Patch("/json-merge-patch/update/resource/optional") @@ -160,7 +160,7 @@ Mono> updateOptionalResource(@HeaderParam("content-type") S @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response updateOptionalResourceSync(@HeaderParam("content-type") String contentType, + Response updateOptionalResourceSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); } diff --git a/typespec-tests/src/main/java/com/payload/mediatype/implementation/StringBodiesImpl.java b/typespec-tests/src/main/java/com/payload/mediatype/implementation/StringBodiesImpl.java index 6514b25f96..e513ab62de 100644 --- a/typespec-tests/src/main/java/com/payload/mediatype/implementation/StringBodiesImpl.java +++ b/typespec-tests/src/main/java/com/payload/mediatype/implementation/StringBodiesImpl.java @@ -64,7 +64,7 @@ public interface StringBodiesService { @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> sendAsText(@HeaderParam("content-type") String contentType, + Mono> sendAsText(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("text/plain") BinaryData text, RequestOptions requestOptions, Context context); @@ -74,7 +74,7 @@ Mono> sendAsText(@HeaderParam("content-type") String contentType, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendAsTextSync(@HeaderParam("content-type") String contentType, + Response sendAsTextSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("text/plain") BinaryData text, RequestOptions requestOptions, Context context); @@ -102,7 +102,7 @@ Response getAsTextSync(@HeaderParam("accept") String accept, Request @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> sendAsJson(@HeaderParam("content-type") String contentType, + Mono> sendAsJson(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData text, RequestOptions requestOptions, Context context); @@ -112,7 +112,7 @@ Mono> sendAsJson(@HeaderParam("content-type") String contentType, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendAsJsonSync(@HeaderParam("content-type") String contentType, + Response sendAsJsonSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData text, RequestOptions requestOptions, Context context); diff --git a/typespec-tests/src/main/java/com/payload/multipart/implementation/FormDatasImpl.java b/typespec-tests/src/main/java/com/payload/multipart/implementation/FormDatasImpl.java index f234ea0341..fb0060c5d4 100644 --- a/typespec-tests/src/main/java/com/payload/multipart/implementation/FormDatasImpl.java +++ b/typespec-tests/src/main/java/com/payload/multipart/implementation/FormDatasImpl.java @@ -64,7 +64,7 @@ public interface FormDatasService { @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> basic(@HeaderParam("content-type") String contentType, + Mono> basic(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); @@ -75,7 +75,7 @@ Mono> basic(@HeaderParam("content-type") String contentType, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response basicSync(@HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept, + Response basicSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); // @Multipart not supported by RestProxy @@ -85,7 +85,7 @@ Response basicSync(@HeaderParam("content-type") String contentType, @Heade @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> complex(@HeaderParam("content-type") String contentType, + Mono> complex(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); @@ -96,7 +96,7 @@ Mono> complex(@HeaderParam("content-type") String contentType, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response complexSync(@HeaderParam("content-type") String contentType, + Response complexSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); @@ -107,7 +107,7 @@ Response complexSync(@HeaderParam("content-type") String contentType, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> jsonPart(@HeaderParam("content-type") String contentType, + Mono> jsonPart(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); @@ -118,7 +118,7 @@ Mono> jsonPart(@HeaderParam("content-type") String contentType, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response jsonPartSync(@HeaderParam("content-type") String contentType, + Response jsonPartSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); @@ -129,7 +129,7 @@ Response jsonPartSync(@HeaderParam("content-type") String contentType, @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> binaryArrayParts(@HeaderParam("content-type") String contentType, + Mono> binaryArrayParts(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); @@ -140,7 +140,7 @@ Mono> binaryArrayParts(@HeaderParam("content-type") String conten @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response binaryArrayPartsSync(@HeaderParam("content-type") String contentType, + Response binaryArrayPartsSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); @@ -151,7 +151,7 @@ Response binaryArrayPartsSync(@HeaderParam("content-type") String contentT @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> jsonArrayParts(@HeaderParam("content-type") String contentType, + Mono> jsonArrayParts(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); @@ -162,7 +162,7 @@ Mono> jsonArrayParts(@HeaderParam("content-type") String contentT @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response jsonArrayPartsSync(@HeaderParam("content-type") String contentType, + Response jsonArrayPartsSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); @@ -173,7 +173,7 @@ Response jsonArrayPartsSync(@HeaderParam("content-type") String contentTyp @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> multiBinaryParts(@HeaderParam("content-type") String contentType, + Mono> multiBinaryParts(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); @@ -184,7 +184,7 @@ Mono> multiBinaryParts(@HeaderParam("content-type") String conten @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response multiBinaryPartsSync(@HeaderParam("content-type") String contentType, + Response multiBinaryPartsSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); @@ -195,7 +195,7 @@ Response multiBinaryPartsSync(@HeaderParam("content-type") String contentT @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> checkFileNameAndContentType(@HeaderParam("content-type") String contentType, + Mono> checkFileNameAndContentType(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); @@ -206,7 +206,7 @@ Mono> checkFileNameAndContentType(@HeaderParam("content-type") St @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response checkFileNameAndContentTypeSync(@HeaderParam("content-type") String contentType, + Response checkFileNameAndContentTypeSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData body, RequestOptions requestOptions, Context context); @@ -217,7 +217,7 @@ Response checkFileNameAndContentTypeSync(@HeaderParam("content-type") Stri @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> anonymousModel(@HeaderParam("content-type") String contentType, + Mono> anonymousModel(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData request, RequestOptions requestOptions, Context context); @@ -228,7 +228,7 @@ Mono> anonymousModel(@HeaderParam("content-type") String contentT @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response anonymousModelSync(@HeaderParam("content-type") String contentType, + Response anonymousModelSync(@HeaderParam("Content-Type") String contentType, @HeaderParam("accept") String accept, @BodyParam("multipart/form-data") BinaryData request, RequestOptions requestOptions, Context context); } diff --git a/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/Fish.java b/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/Fish.java index 6fab81a60e..982c7bbcf0 100644 --- a/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/Fish.java +++ b/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/Fish.java @@ -18,7 +18,7 @@ @Immutable public class Fish implements JsonSerializable { /* - * The kind property. + * Discriminator property for Fish. */ @Generated private String kind = "Fish"; @@ -40,7 +40,7 @@ public Fish(int age) { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/GoblinShark.java b/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/GoblinShark.java index ec473eeccb..c2fc08553f 100644 --- a/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/GoblinShark.java +++ b/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/GoblinShark.java @@ -17,7 +17,7 @@ @Immutable public final class GoblinShark extends Shark { /* - * The kind property. + * Discriminator property for Fish. */ @Generated private String kind = "shark"; @@ -39,7 +39,7 @@ public GoblinShark(int age) { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/Salmon.java b/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/Salmon.java index d1472a035e..44b7b1494b 100644 --- a/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/Salmon.java +++ b/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/Salmon.java @@ -20,7 +20,7 @@ @Fluent public final class Salmon extends Fish { /* - * The kind property. + * Discriminator property for Fish. */ @Generated private String kind = "salmon"; @@ -54,7 +54,7 @@ public Salmon(int age) { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/SawShark.java b/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/SawShark.java index a7804391a4..4120bcd9ad 100644 --- a/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/SawShark.java +++ b/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/SawShark.java @@ -17,7 +17,7 @@ @Immutable public final class SawShark extends Shark { /* - * The kind property. + * Discriminator property for Fish. */ @Generated private String kind = "shark"; @@ -39,7 +39,7 @@ public SawShark(int age) { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/Shark.java b/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/Shark.java index 887f447ad7..640495c57b 100644 --- a/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/Shark.java +++ b/typespec-tests/src/main/java/com/type/model/inheritance/nesteddiscriminator/models/Shark.java @@ -17,7 +17,7 @@ @Immutable public class Shark extends Fish { /* - * The kind property. + * Discriminator property for Fish. */ @Generated private String kind = "shark"; @@ -39,7 +39,7 @@ public Shark(int age) { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Fish. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/type/model/inheritance/singlediscriminator/models/Dinosaur.java b/typespec-tests/src/main/java/com/type/model/inheritance/singlediscriminator/models/Dinosaur.java index 5c98891e39..940c920603 100644 --- a/typespec-tests/src/main/java/com/type/model/inheritance/singlediscriminator/models/Dinosaur.java +++ b/typespec-tests/src/main/java/com/type/model/inheritance/singlediscriminator/models/Dinosaur.java @@ -18,7 +18,7 @@ @Immutable public class Dinosaur implements JsonSerializable { /* - * The kind property. + * Discriminator property for Dinosaur. */ @Generated private String kind = "Dinosaur"; @@ -40,7 +40,7 @@ protected Dinosaur(int size) { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Dinosaur. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/type/model/inheritance/singlediscriminator/models/TRex.java b/typespec-tests/src/main/java/com/type/model/inheritance/singlediscriminator/models/TRex.java index 9274080842..90902817d5 100644 --- a/typespec-tests/src/main/java/com/type/model/inheritance/singlediscriminator/models/TRex.java +++ b/typespec-tests/src/main/java/com/type/model/inheritance/singlediscriminator/models/TRex.java @@ -17,7 +17,7 @@ @Immutable public final class TRex extends Dinosaur { /* - * The kind property. + * Discriminator property for Dinosaur. */ @Generated private String kind = "t-rex"; @@ -33,7 +33,7 @@ private TRex(int size) { } /** - * Get the kind property: The kind property. + * Get the kind property: Discriminator property for Dinosaur. * * @return the kind value. */ diff --git a/typespec-tests/src/main/java/com/type/property/optional/models/BooleanLiteralProperty.java b/typespec-tests/src/main/java/com/type/property/optional/models/BooleanLiteralProperty.java index 77a88618b6..4d68c92ad1 100644 --- a/typespec-tests/src/main/java/com/type/property/optional/models/BooleanLiteralProperty.java +++ b/typespec-tests/src/main/java/com/type/property/optional/models/BooleanLiteralProperty.java @@ -21,7 +21,7 @@ public final class BooleanLiteralProperty implements JsonSerializable get() { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(GetResponseProp3 prop) { + public Mono send(GetResponseProp2 prop) { // Generated convenience method for sendWithResponse RequestOptions requestOptions = new RequestOptions(); SendRequest3 sendRequest6Obj = new SendRequest3(prop); diff --git a/typespec-tests/src/main/java/com/type/union/IntsOnlyClient.java b/typespec-tests/src/main/java/com/type/union/IntsOnlyClient.java index 6064495db7..41afa4d634 100644 --- a/typespec-tests/src/main/java/com/type/union/IntsOnlyClient.java +++ b/typespec-tests/src/main/java/com/type/union/IntsOnlyClient.java @@ -18,7 +18,7 @@ import com.type.union.implementation.IntsOnliesImpl; import com.type.union.implementation.models.SendRequest3; import com.type.union.models.GetResponse6; -import com.type.union.models.GetResponseProp3; +import com.type.union.models.GetResponseProp2; /** * Initializes a new instance of the synchronous UnionClient type. @@ -116,7 +116,7 @@ public GetResponse6 get() { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public void send(GetResponseProp3 prop) { + public void send(GetResponseProp2 prop) { // Generated convenience method for sendWithResponse RequestOptions requestOptions = new RequestOptions(); SendRequest3 sendRequest6Obj = new SendRequest3(prop); diff --git a/typespec-tests/src/main/java/com/type/union/StringExtensibleAsyncClient.java b/typespec-tests/src/main/java/com/type/union/StringExtensibleAsyncClient.java index e55a9a2338..ca9899924e 100644 --- a/typespec-tests/src/main/java/com/type/union/StringExtensibleAsyncClient.java +++ b/typespec-tests/src/main/java/com/type/union/StringExtensibleAsyncClient.java @@ -19,7 +19,7 @@ import com.type.union.implementation.StringExtensiblesImpl; import com.type.union.implementation.models.SendRequest1; import com.type.union.models.GetResponse8; -import com.type.union.models.GetResponseProp4; +import com.type.union.models.GetResponseProp3; import reactor.core.publisher.Mono; /** @@ -120,7 +120,7 @@ public Mono get() { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(GetResponseProp4 prop) { + public Mono send(GetResponseProp3 prop) { // Generated convenience method for sendWithResponse RequestOptions requestOptions = new RequestOptions(); SendRequest1 sendRequest8Obj = new SendRequest1(prop); diff --git a/typespec-tests/src/main/java/com/type/union/StringExtensibleClient.java b/typespec-tests/src/main/java/com/type/union/StringExtensibleClient.java index 54d118dbc9..c6f749c45f 100644 --- a/typespec-tests/src/main/java/com/type/union/StringExtensibleClient.java +++ b/typespec-tests/src/main/java/com/type/union/StringExtensibleClient.java @@ -18,7 +18,7 @@ import com.type.union.implementation.StringExtensiblesImpl; import com.type.union.implementation.models.SendRequest1; import com.type.union.models.GetResponse8; -import com.type.union.models.GetResponseProp4; +import com.type.union.models.GetResponseProp3; /** * Initializes a new instance of the synchronous UnionClient type. @@ -116,7 +116,7 @@ public GetResponse8 get() { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public void send(GetResponseProp4 prop) { + public void send(GetResponseProp3 prop) { // Generated convenience method for sendWithResponse RequestOptions requestOptions = new RequestOptions(); SendRequest1 sendRequest8Obj = new SendRequest1(prop); diff --git a/typespec-tests/src/main/java/com/type/union/StringsOnlyAsyncClient.java b/typespec-tests/src/main/java/com/type/union/StringsOnlyAsyncClient.java index c4a12f6ab2..33f7f84828 100644 --- a/typespec-tests/src/main/java/com/type/union/StringsOnlyAsyncClient.java +++ b/typespec-tests/src/main/java/com/type/union/StringsOnlyAsyncClient.java @@ -19,7 +19,7 @@ import com.type.union.implementation.StringsOnliesImpl; import com.type.union.implementation.models.SendRequest; import com.type.union.models.GetResponse9; -import com.type.union.models.GetResponseProp5; +import com.type.union.models.GetResponseProp4; import reactor.core.publisher.Mono; /** @@ -120,7 +120,7 @@ public Mono get() { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(GetResponseProp5 prop) { + public Mono send(GetResponseProp4 prop) { // Generated convenience method for sendWithResponse RequestOptions requestOptions = new RequestOptions(); SendRequest sendRequest9Obj = new SendRequest(prop); diff --git a/typespec-tests/src/main/java/com/type/union/StringsOnlyClient.java b/typespec-tests/src/main/java/com/type/union/StringsOnlyClient.java index 945b27e5c7..2700b5b7ad 100644 --- a/typespec-tests/src/main/java/com/type/union/StringsOnlyClient.java +++ b/typespec-tests/src/main/java/com/type/union/StringsOnlyClient.java @@ -18,7 +18,7 @@ import com.type.union.implementation.StringsOnliesImpl; import com.type.union.implementation.models.SendRequest; import com.type.union.models.GetResponse9; -import com.type.union.models.GetResponseProp5; +import com.type.union.models.GetResponseProp4; /** * Initializes a new instance of the synchronous UnionClient type. @@ -116,7 +116,7 @@ public GetResponse9 get() { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public void send(GetResponseProp5 prop) { + public void send(GetResponseProp4 prop) { // Generated convenience method for sendWithResponse RequestOptions requestOptions = new RequestOptions(); SendRequest sendRequest9Obj = new SendRequest(prop); diff --git a/typespec-tests/src/main/java/com/type/union/implementation/models/SendRequest.java b/typespec-tests/src/main/java/com/type/union/implementation/models/SendRequest.java index 83efd01f9e..61d84b4934 100644 --- a/typespec-tests/src/main/java/com/type/union/implementation/models/SendRequest.java +++ b/typespec-tests/src/main/java/com/type/union/implementation/models/SendRequest.java @@ -10,7 +10,7 @@ import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; -import com.type.union.models.GetResponseProp5; +import com.type.union.models.GetResponseProp4; import java.io.IOException; /** @@ -22,7 +22,7 @@ public final class SendRequest implements JsonSerializable { * The prop property. */ @Generated - private final GetResponseProp5 prop; + private final GetResponseProp4 prop; /** * Creates an instance of SendRequest class. @@ -30,7 +30,7 @@ public final class SendRequest implements JsonSerializable { * @param prop the prop value to set. */ @Generated - public SendRequest(GetResponseProp5 prop) { + public SendRequest(GetResponseProp4 prop) { this.prop = prop; } @@ -40,7 +40,7 @@ public SendRequest(GetResponseProp5 prop) { * @return the prop value. */ @Generated - public GetResponseProp5 getProp() { + public GetResponseProp4 getProp() { return this.prop; } @@ -67,13 +67,13 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { @Generated public static SendRequest fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - GetResponseProp5 prop = null; + GetResponseProp4 prop = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if ("prop".equals(fieldName)) { - prop = GetResponseProp5.fromString(reader.getString()); + prop = GetResponseProp4.fromString(reader.getString()); } else { reader.skipChildren(); } diff --git a/typespec-tests/src/main/java/com/type/union/implementation/models/SendRequest1.java b/typespec-tests/src/main/java/com/type/union/implementation/models/SendRequest1.java index 25f217f07b..6d355540c9 100644 --- a/typespec-tests/src/main/java/com/type/union/implementation/models/SendRequest1.java +++ b/typespec-tests/src/main/java/com/type/union/implementation/models/SendRequest1.java @@ -10,7 +10,7 @@ import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; -import com.type.union.models.GetResponseProp4; +import com.type.union.models.GetResponseProp3; import java.io.IOException; /** @@ -22,7 +22,7 @@ public final class SendRequest1 implements JsonSerializable { * The prop property. */ @Generated - private final GetResponseProp4 prop; + private final GetResponseProp3 prop; /** * Creates an instance of SendRequest1 class. @@ -30,7 +30,7 @@ public final class SendRequest1 implements JsonSerializable { * @param prop the prop value to set. */ @Generated - public SendRequest1(GetResponseProp4 prop) { + public SendRequest1(GetResponseProp3 prop) { this.prop = prop; } @@ -40,7 +40,7 @@ public SendRequest1(GetResponseProp4 prop) { * @return the prop value. */ @Generated - public GetResponseProp4 getProp() { + public GetResponseProp3 getProp() { return this.prop; } @@ -67,13 +67,13 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { @Generated public static SendRequest1 fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - GetResponseProp4 prop = null; + GetResponseProp3 prop = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if ("prop".equals(fieldName)) { - prop = GetResponseProp4.fromString(reader.getString()); + prop = GetResponseProp3.fromString(reader.getString()); } else { reader.skipChildren(); } diff --git a/typespec-tests/src/main/java/com/type/union/implementation/models/SendRequest3.java b/typespec-tests/src/main/java/com/type/union/implementation/models/SendRequest3.java index 018caf5fd9..d3970dfa97 100644 --- a/typespec-tests/src/main/java/com/type/union/implementation/models/SendRequest3.java +++ b/typespec-tests/src/main/java/com/type/union/implementation/models/SendRequest3.java @@ -10,7 +10,7 @@ import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; -import com.type.union.models.GetResponseProp3; +import com.type.union.models.GetResponseProp2; import java.io.IOException; /** @@ -22,7 +22,7 @@ public final class SendRequest3 implements JsonSerializable { * The prop property. */ @Generated - private final GetResponseProp3 prop; + private final GetResponseProp2 prop; /** * Creates an instance of SendRequest3 class. @@ -30,7 +30,7 @@ public final class SendRequest3 implements JsonSerializable { * @param prop the prop value to set. */ @Generated - public SendRequest3(GetResponseProp3 prop) { + public SendRequest3(GetResponseProp2 prop) { this.prop = prop; } @@ -40,7 +40,7 @@ public SendRequest3(GetResponseProp3 prop) { * @return the prop value. */ @Generated - public GetResponseProp3 getProp() { + public GetResponseProp2 getProp() { return this.prop; } @@ -67,13 +67,13 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { @Generated public static SendRequest3 fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - GetResponseProp3 prop = null; + GetResponseProp2 prop = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if ("prop".equals(fieldName)) { - prop = GetResponseProp3.fromInt(reader.getInt()); + prop = GetResponseProp2.fromInt(reader.getInt()); } else { reader.skipChildren(); } diff --git a/typespec-tests/src/main/java/com/type/union/models/GetResponse6.java b/typespec-tests/src/main/java/com/type/union/models/GetResponse6.java index a19c92a074..bf2939ae73 100644 --- a/typespec-tests/src/main/java/com/type/union/models/GetResponse6.java +++ b/typespec-tests/src/main/java/com/type/union/models/GetResponse6.java @@ -21,7 +21,7 @@ public final class GetResponse6 implements JsonSerializable { * The prop property. */ @Generated - private final GetResponseProp3 prop; + private final GetResponseProp2 prop; /** * Creates an instance of GetResponse6 class. @@ -29,7 +29,7 @@ public final class GetResponse6 implements JsonSerializable { * @param prop the prop value to set. */ @Generated - private GetResponse6(GetResponseProp3 prop) { + private GetResponse6(GetResponseProp2 prop) { this.prop = prop; } @@ -39,7 +39,7 @@ private GetResponse6(GetResponseProp3 prop) { * @return the prop value. */ @Generated - public GetResponseProp3 getProp() { + public GetResponseProp2 getProp() { return this.prop; } @@ -66,13 +66,13 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { @Generated public static GetResponse6 fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - GetResponseProp3 prop = null; + GetResponseProp2 prop = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if ("prop".equals(fieldName)) { - prop = GetResponseProp3.fromInt(reader.getInt()); + prop = GetResponseProp2.fromInt(reader.getInt()); } else { reader.skipChildren(); } diff --git a/typespec-tests/src/main/java/com/type/union/models/GetResponse8.java b/typespec-tests/src/main/java/com/type/union/models/GetResponse8.java index 7029419012..c30aa8fe89 100644 --- a/typespec-tests/src/main/java/com/type/union/models/GetResponse8.java +++ b/typespec-tests/src/main/java/com/type/union/models/GetResponse8.java @@ -21,7 +21,7 @@ public final class GetResponse8 implements JsonSerializable { * The prop property. */ @Generated - private final GetResponseProp4 prop; + private final GetResponseProp3 prop; /** * Creates an instance of GetResponse8 class. @@ -29,7 +29,7 @@ public final class GetResponse8 implements JsonSerializable { * @param prop the prop value to set. */ @Generated - private GetResponse8(GetResponseProp4 prop) { + private GetResponse8(GetResponseProp3 prop) { this.prop = prop; } @@ -39,7 +39,7 @@ private GetResponse8(GetResponseProp4 prop) { * @return the prop value. */ @Generated - public GetResponseProp4 getProp() { + public GetResponseProp3 getProp() { return this.prop; } @@ -66,13 +66,13 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { @Generated public static GetResponse8 fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - GetResponseProp4 prop = null; + GetResponseProp3 prop = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if ("prop".equals(fieldName)) { - prop = GetResponseProp4.fromString(reader.getString()); + prop = GetResponseProp3.fromString(reader.getString()); } else { reader.skipChildren(); } diff --git a/typespec-tests/src/main/java/com/type/union/models/GetResponse9.java b/typespec-tests/src/main/java/com/type/union/models/GetResponse9.java index 760b96ac57..098299d314 100644 --- a/typespec-tests/src/main/java/com/type/union/models/GetResponse9.java +++ b/typespec-tests/src/main/java/com/type/union/models/GetResponse9.java @@ -21,7 +21,7 @@ public final class GetResponse9 implements JsonSerializable { * The prop property. */ @Generated - private final GetResponseProp5 prop; + private final GetResponseProp4 prop; /** * Creates an instance of GetResponse9 class. @@ -29,7 +29,7 @@ public final class GetResponse9 implements JsonSerializable { * @param prop the prop value to set. */ @Generated - private GetResponse9(GetResponseProp5 prop) { + private GetResponse9(GetResponseProp4 prop) { this.prop = prop; } @@ -39,7 +39,7 @@ private GetResponse9(GetResponseProp5 prop) { * @return the prop value. */ @Generated - public GetResponseProp5 getProp() { + public GetResponseProp4 getProp() { return this.prop; } @@ -66,13 +66,13 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { @Generated public static GetResponse9 fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - GetResponseProp5 prop = null; + GetResponseProp4 prop = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if ("prop".equals(fieldName)) { - prop = GetResponseProp5.fromString(reader.getString()); + prop = GetResponseProp4.fromString(reader.getString()); } else { reader.skipChildren(); } diff --git a/typespec-tests/src/main/java/com/type/union/models/GetResponseProp2.java b/typespec-tests/src/main/java/com/type/union/models/GetResponseProp2.java new file mode 100644 index 0000000000..68a8a0c791 --- /dev/null +++ b/typespec-tests/src/main/java/com/type/union/models/GetResponseProp2.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.type.union.models; + +/** + * Defines values for GetResponseProp2. + */ +public enum GetResponseProp2 { + /** + * Enum value 1. + */ + ONE(1), + + /** + * Enum value 2. + */ + TWO(2), + + /** + * Enum value 3. + */ + THREE(3); + + /** + * The actual serialized value for a GetResponseProp2 instance. + */ + private final int value; + + GetResponseProp2(int value) { + this.value = value; + } + + /** + * Parses a serialized value to a GetResponseProp2 instance. + * + * @param value the serialized value to parse. + * @return the parsed GetResponseProp2 object, or null if unable to parse. + */ + public static GetResponseProp2 fromInt(int value) { + GetResponseProp2[] items = GetResponseProp2.values(); + for (GetResponseProp2 item : items) { + if (item.toInt() == value) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to int value. + * + * @return the int value. + */ + public int toInt() { + return this.value; + } +} diff --git a/typespec-tests/src/main/java/com/type/union/models/GetResponseProp3.java b/typespec-tests/src/main/java/com/type/union/models/GetResponseProp3.java index c91dca276d..887c9a2b72 100644 --- a/typespec-tests/src/main/java/com/type/union/models/GetResponseProp3.java +++ b/typespec-tests/src/main/java/com/type/union/models/GetResponseProp3.java @@ -4,56 +4,54 @@ package com.type.union.models; +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + /** * Defines values for GetResponseProp3. */ -public enum GetResponseProp3 { - /** - * Enum value 1. - */ - ONE(1), - +public final class GetResponseProp3 extends ExpandableStringEnum { /** - * Enum value 2. + * Static value b for GetResponseProp3. */ - TWO(2), + @Generated + public static final GetResponseProp3 B = fromString("b"); /** - * Enum value 3. + * Static value c for GetResponseProp3. */ - THREE(3); + @Generated + public static final GetResponseProp3 C = fromString("c"); /** - * The actual serialized value for a GetResponseProp3 instance. + * Creates a new instance of GetResponseProp3 value. + * + * @deprecated Use the {@link #fromString(String)} factory method. */ - private final int value; - - GetResponseProp3(int value) { - this.value = value; + @Generated + @Deprecated + public GetResponseProp3() { } /** - * Parses a serialized value to a GetResponseProp3 instance. + * Creates or finds a GetResponseProp3 from its string representation. * - * @param value the serialized value to parse. - * @return the parsed GetResponseProp3 object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding GetResponseProp3. */ - public static GetResponseProp3 fromInt(int value) { - GetResponseProp3[] items = GetResponseProp3.values(); - for (GetResponseProp3 item : items) { - if (item.toInt() == value) { - return item; - } - } - return null; + @Generated + public static GetResponseProp3 fromString(String name) { + return fromString(name, GetResponseProp3.class); } /** - * De-serializes the instance to int value. + * Gets known GetResponseProp3 values. * - * @return the int value. + * @return known GetResponseProp3 values. */ - public int toInt() { - return this.value; + @Generated + public static Collection values() { + return values(GetResponseProp3.class); } } diff --git a/typespec-tests/src/main/java/com/type/union/models/GetResponseProp4.java b/typespec-tests/src/main/java/com/type/union/models/GetResponseProp4.java index 083734dff8..fba34d3ce5 100644 --- a/typespec-tests/src/main/java/com/type/union/models/GetResponseProp4.java +++ b/typespec-tests/src/main/java/com/type/union/models/GetResponseProp4.java @@ -4,54 +4,58 @@ package com.type.union.models; -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - /** * Defines values for GetResponseProp4. */ -public final class GetResponseProp4 extends ExpandableStringEnum { +public enum GetResponseProp4 { /** - * Static value b for GetResponseProp4. + * Enum value a. */ - @Generated - public static final GetResponseProp4 B = fromString("b"); + A("a"), /** - * Static value c for GetResponseProp4. + * Enum value b. */ - @Generated - public static final GetResponseProp4 C = fromString("c"); + B("b"), /** - * Creates a new instance of GetResponseProp4 value. - * - * @deprecated Use the {@link #fromString(String)} factory method. + * Enum value c. */ - @Generated - @Deprecated - public GetResponseProp4() { + C("c"); + + /** + * The actual serialized value for a GetResponseProp4 instance. + */ + private final String value; + + GetResponseProp4(String value) { + this.value = value; } /** - * Creates or finds a GetResponseProp4 from its string representation. + * Parses a serialized value to a GetResponseProp4 instance. * - * @param name a name to look for. - * @return the corresponding GetResponseProp4. + * @param value the serialized value to parse. + * @return the parsed GetResponseProp4 object, or null if unable to parse. */ - @Generated - public static GetResponseProp4 fromString(String name) { - return fromString(name, GetResponseProp4.class); + public static GetResponseProp4 fromString(String value) { + if (value == null) { + return null; + } + GetResponseProp4[] items = GetResponseProp4.values(); + for (GetResponseProp4 item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; } /** - * Gets known GetResponseProp4 values. - * - * @return known GetResponseProp4 values. + * {@inheritDoc} */ - @Generated - public static Collection values() { - return values(GetResponseProp4.class); + @Override + public String toString() { + return this.value; } } diff --git a/typespec-tests/src/main/java/com/type/union/models/GetResponseProp5.java b/typespec-tests/src/main/java/com/type/union/models/GetResponseProp5.java deleted file mode 100644 index 8227ba3050..0000000000 --- a/typespec-tests/src/main/java/com/type/union/models/GetResponseProp5.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.type.union.models; - -/** - * Defines values for GetResponseProp5. - */ -public enum GetResponseProp5 { - /** - * Enum value a. - */ - A("a"), - - /** - * Enum value b. - */ - B("b"), - - /** - * Enum value c. - */ - C("c"); - - /** - * The actual serialized value for a GetResponseProp5 instance. - */ - private final String value; - - GetResponseProp5(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a GetResponseProp5 instance. - * - * @param value the serialized value to parse. - * @return the parsed GetResponseProp5 object, or null if unable to parse. - */ - public static GetResponseProp5 fromString(String value) { - if (value == null) { - return null; - } - GetResponseProp5[] items = GetResponseProp5.values(); - for (GetResponseProp5 item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/typespec-tests/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/reflect-config.json b/typespec-tests/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/reflect-config.json index 55e30525cc..45d2dddeda 100644 --- a/typespec-tests/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/reflect-config.json +++ b/typespec-tests/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/reflect-config.json @@ -49,7 +49,7 @@ "allDeclaredFields" : true, "allDeclaredMethods" : true }, { - "name" : "com.cadl.armresourceprovider.implementation.models.PagedOperation", + "name" : "com.cadl.armresourceprovider.implementation.models.OperationListResult", "allDeclaredConstructors" : true, "allDeclaredFields" : true, "allDeclaredMethods" : true diff --git a/typespec-tests/src/samples/java/com/cadl/flatten/generated/FlattenOpSendLong.java b/typespec-tests/src/samples/java/com/cadl/flatten/generated/FlattenOpSendLong.java index 6b6fbdc40d..4a373d51f4 100644 --- a/typespec-tests/src/samples/java/com/cadl/flatten/generated/FlattenOpSendLong.java +++ b/typespec-tests/src/samples/java/com/cadl/flatten/generated/FlattenOpSendLong.java @@ -8,7 +8,7 @@ import com.cadl.flatten.FlattenClient; import com.cadl.flatten.FlattenClientBuilder; import com.cadl.flatten.models.SendLongOptions; -import com.cadl.flatten.models.SendLongRequestStatus; +import com.cadl.flatten.models.TodoItemStatus; import com.cadl.flatten.models.User; public class FlattenOpSendLong { @@ -16,8 +16,8 @@ public static void main(String[] args) { FlattenClient flattenClient = new FlattenClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")).buildClient(); // BEGIN:com.cadl.flatten.generated.sendlong.flattenopsendlong - flattenClient.sendLong( - new SendLongOptions("myRequiredId", "myRequiredInput", 11, "title", SendLongRequestStatus.NOT_STARTED) + flattenClient + .sendLong(new SendLongOptions("myRequiredId", "myRequiredInput", 11, "title", TodoItemStatus.NOT_STARTED) .setFilter("name=myName") .setUser(new User("myOptionalUser")) .setDataIntOptional(12) diff --git a/typespec-tests/src/test/java/com/cadl/flatten/generated/FlattenOpSendLongTests.java b/typespec-tests/src/test/java/com/cadl/flatten/generated/FlattenOpSendLongTests.java index 7c24c40b4f..40b0180e71 100644 --- a/typespec-tests/src/test/java/com/cadl/flatten/generated/FlattenOpSendLongTests.java +++ b/typespec-tests/src/test/java/com/cadl/flatten/generated/FlattenOpSendLongTests.java @@ -5,7 +5,7 @@ package com.cadl.flatten.generated; import com.cadl.flatten.models.SendLongOptions; -import com.cadl.flatten.models.SendLongRequestStatus; +import com.cadl.flatten.models.TodoItemStatus; import com.cadl.flatten.models.User; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -16,8 +16,8 @@ public final class FlattenOpSendLongTests extends FlattenClientTestBase { @Disabled public void testFlattenOpSendLongTests() { // method invocation - flattenClient.sendLong( - new SendLongOptions("myRequiredId", "myRequiredInput", 11, "title", SendLongRequestStatus.NOT_STARTED) + flattenClient + .sendLong(new SendLongOptions("myRequiredId", "myRequiredInput", 11, "title", TodoItemStatus.NOT_STARTED) .setFilter("name=myName") .setUser(new User("myOptionalUser")) .setDataIntOptional(12) diff --git a/typespec-tests/src/test/java/com/type/property/optional/BooleanLiteralClientTests.java b/typespec-tests/src/test/java/com/type/property/optional/BooleanLiteralClientTests.java index b640851aeb..321bf6718a 100644 --- a/typespec-tests/src/test/java/com/type/property/optional/BooleanLiteralClientTests.java +++ b/typespec-tests/src/test/java/com/type/property/optional/BooleanLiteralClientTests.java @@ -4,7 +4,7 @@ package com.type.property.optional; import com.type.property.optional.models.BooleanLiteralProperty; -import com.type.property.optional.models.BooleanLiteralPropertyPropertyTrue; +import com.type.property.optional.models.BooleanLiteralPropertyProperty; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class BooleanLiteralClientTests { @Test public void getAll() { BooleanLiteralProperty booleanLiteralProperty = client.getAll(); - Assertions.assertEquals(BooleanLiteralPropertyPropertyTrue.TRUE, booleanLiteralProperty.getProperty()); + Assertions.assertEquals(BooleanLiteralPropertyProperty.TRUE, booleanLiteralProperty.getProperty()); } @Test @@ -26,7 +26,7 @@ public void getDefault() { @Test public void putAll() { BooleanLiteralProperty booleanLiteralProperty = new BooleanLiteralProperty(); - booleanLiteralProperty.setProperty(BooleanLiteralPropertyPropertyTrue.TRUE); + booleanLiteralProperty.setProperty(BooleanLiteralPropertyProperty.TRUE); client.putAll(booleanLiteralProperty); } diff --git a/typespec-tests/src/test/java/com/type/property/optional/FloatLiteralClientTests.java b/typespec-tests/src/test/java/com/type/property/optional/FloatLiteralClientTests.java index 4b8fe74f15..32d620364b 100644 --- a/typespec-tests/src/test/java/com/type/property/optional/FloatLiteralClientTests.java +++ b/typespec-tests/src/test/java/com/type/property/optional/FloatLiteralClientTests.java @@ -4,7 +4,7 @@ package com.type.property.optional; import com.type.property.optional.models.FloatLiteralProperty; -import com.type.property.optional.models.FloatLiteralPropertyProperty125; +import com.type.property.optional.models.FloatLiteralPropertyProperty; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class FloatLiteralClientTests { @Test public void getAll() { FloatLiteralProperty floatLiteralProperty = client.getAll(); - Assertions.assertEquals(FloatLiteralPropertyProperty125.ONE_TWO_FIVE, floatLiteralProperty.getProperty()); + Assertions.assertEquals(FloatLiteralPropertyProperty.ONE_TWO_FIVE, floatLiteralProperty.getProperty()); } @Test @@ -26,7 +26,7 @@ public void getDefault() { @Test public void putAll() { FloatLiteralProperty floatLiteralProperty = new FloatLiteralProperty(); - floatLiteralProperty.setProperty(FloatLiteralPropertyProperty125.ONE_TWO_FIVE); + floatLiteralProperty.setProperty(FloatLiteralPropertyProperty.ONE_TWO_FIVE); client.putAll(floatLiteralProperty); } diff --git a/typespec-tests/src/test/java/com/type/property/optional/IntLiteralClientTests.java b/typespec-tests/src/test/java/com/type/property/optional/IntLiteralClientTests.java index fa3fb55929..20ed9f3195 100644 --- a/typespec-tests/src/test/java/com/type/property/optional/IntLiteralClientTests.java +++ b/typespec-tests/src/test/java/com/type/property/optional/IntLiteralClientTests.java @@ -4,7 +4,7 @@ package com.type.property.optional; import com.type.property.optional.models.IntLiteralProperty; -import com.type.property.optional.models.IntLiteralPropertyProperty1; +import com.type.property.optional.models.IntLiteralPropertyProperty; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class IntLiteralClientTests { @Test public void getAll() { IntLiteralProperty intLiteralProperty = client.getAll(); - Assertions.assertEquals(IntLiteralPropertyProperty1.ONE, intLiteralProperty.getProperty()); + Assertions.assertEquals(IntLiteralPropertyProperty.ONE, intLiteralProperty.getProperty()); } @Test @@ -26,7 +26,7 @@ public void getDefault() { @Test public void putAll() { IntLiteralProperty intLiteralProperty = new IntLiteralProperty(); - intLiteralProperty.setProperty(IntLiteralPropertyProperty1.ONE); + intLiteralProperty.setProperty(IntLiteralPropertyProperty.ONE); client.putAll(intLiteralProperty); } diff --git a/typespec-tests/src/test/java/com/type/property/optional/StringLiteralClientTests.java b/typespec-tests/src/test/java/com/type/property/optional/StringLiteralClientTests.java index 7a887ebb56..67c25424b7 100644 --- a/typespec-tests/src/test/java/com/type/property/optional/StringLiteralClientTests.java +++ b/typespec-tests/src/test/java/com/type/property/optional/StringLiteralClientTests.java @@ -4,7 +4,7 @@ package com.type.property.optional; import com.type.property.optional.models.StringLiteralProperty; -import com.type.property.optional.models.StringLiteralPropertyPropertyHello; +import com.type.property.optional.models.StringLiteralPropertyProperty; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -14,7 +14,7 @@ public class StringLiteralClientTests { @Test public void getAll() { StringLiteralProperty stringLiteralProperty = client.getAll(); - Assertions.assertEquals(StringLiteralPropertyPropertyHello.HELLO, stringLiteralProperty.getProperty()); + Assertions.assertEquals(StringLiteralPropertyProperty.HELLO, stringLiteralProperty.getProperty()); } @Test @@ -26,7 +26,7 @@ public void getDefault() { @Test public void putAll() { StringLiteralProperty stringLiteralProperty = new StringLiteralProperty(); - stringLiteralProperty.setProperty(StringLiteralPropertyPropertyHello.HELLO); + stringLiteralProperty.setProperty(StringLiteralPropertyProperty.HELLO); client.putAll(stringLiteralProperty); } diff --git a/typespec-tests/src/test/java/com/type/union/UnionsClientTest.java b/typespec-tests/src/test/java/com/type/union/UnionsClientTest.java index 0270026b64..ef38d04ee6 100644 --- a/typespec-tests/src/test/java/com/type/union/UnionsClientTest.java +++ b/typespec-tests/src/test/java/com/type/union/UnionsClientTest.java @@ -9,7 +9,7 @@ import com.type.union.models.EnumsOnlyCases; import com.type.union.models.EnumsOnlyCasesLr; import com.type.union.models.EnumsOnlyCasesUd; -import com.type.union.models.GetResponseProp5; +import com.type.union.models.GetResponseProp2; import com.type.union.models.MixedLiteralsCases; import com.type.union.models.MixedTypesCases; import com.type.union.models.GetResponseProp1; @@ -38,14 +38,14 @@ public class UnionsClientTest { @Test public void testStringsOnlyClient() { - GetResponseProp5 prop = client1.get().getProp(); - Assertions.assertEquals(GetResponseProp5.B, prop); + GetResponseProp4 prop = client1.get().getProp(); + Assertions.assertEquals(GetResponseProp4.B, prop); client1.send(prop); } @Test public void testStringExtensibleClient() { - GetResponseProp4 prop = client2.get().getProp(); + GetResponseProp3 prop = client2.get().getProp(); Assertions.assertEquals("custom", prop.toString()); client2.send(prop); } @@ -59,7 +59,7 @@ public void testStringExtensibleNamedClient() { @Test public void testIntsOnlyClient() { - GetResponseProp3 prop = client4.get().getProp(); + GetResponseProp2 prop = client4.get().getProp(); Assertions.assertEquals(2L, prop.toInt()); client4.send(prop); } diff --git a/typespec-tests/tsp/nested-enum-discriminator.tsp b/typespec-tests/tsp/nested-enum-discriminator.tsp index 24d8c11fe5..d10fea706f 100644 --- a/typespec-tests/tsp/nested-enum-discriminator.tsp +++ b/typespec-tests/tsp/nested-enum-discriminator.tsp @@ -66,183 +66,183 @@ model GoblinShark extends Shark { @scenario @route("/model") @scenarioDoc(""" -Generate and receive polymorphic model in multiple levels inheritance with 2 discriminators. -Expected response body: -```json -{"age": 1, "kind": "shark", "sharktype": "goblin"} -``` -""") + Generate and receive polymorphic model in multiple levels inheritance with 2 discriminators. + Expected response body: + ```json + {"age": 1, "kind": "shark", "sharktype": "goblin"} + ``` + """) @get op getModel(): Fish; @scenario @route("/model") @scenarioDoc(""" -Generate and send polymorphic model in multiple levels inheritance with 2 discriminators. -Expected input body: -```json -{"age": 1, "kind": "shark", "sharktype": "goblin"} -``` -""") + Generate and send polymorphic model in multiple levels inheritance with 2 discriminators. + Expected input body: + ```json + {"age": 1, "kind": "shark", "sharktype": "goblin"} + ``` + """) @put op putModel(@body input: Fish): NoContentResponse; @scenario @route("/recursivemodel") @scenarioDoc(""" -Generate and receive polymorphic models has collection and dictionary properties referring to other polymorphic models. -Expected response body: -```json -{ - "age": 1, - "kind": "salmon", - "partner": { - "age": 2, - "kind": "shark", - "sharktype": "saw" - }, - "friends": [ - { + Generate and receive polymorphic models has collection and dictionary properties referring to other polymorphic models. + Expected response body: + ```json + { + "age": 1, + "kind": "salmon", + "partner": { "age": 2, - "kind": "salmon", - "partner": { - "age": 3, - "kind": "salmon" - }, - "hate": { - "key1": { - "age": 4, - "kind": "salmon" - }, - "key2": { - "age": 2, - "kind": "shark", - "sharktype": "goblin" - } - } - }, - { - "age": 3, - "kind": "shark", - "sharktype": "goblin" - } - ], - "hate": { - "key3": { - "age": 3, "kind": "shark", "sharktype": "saw" }, - "key4": { - "age": 2, - "kind": "salmon", - "friends": [ - { - "age": 1, + "friends": [ + { + "age": 2, + "kind": "salmon", + "partner": { + "age": 3, "kind": "salmon" }, - { - "age": 4, - "kind": "shark", - "sharktype": "goblin" + "hate": { + "key1": { + "age": 4, + "kind": "salmon" + }, + "key2": { + "age": 2, + "kind": "shark", + "sharktype": "goblin" + } } - ] + }, + { + "age": 3, + "kind": "shark", + "sharktype": "goblin" + } + ], + "hate": { + "key3": { + "age": 3, + "kind": "shark", + "sharktype": "saw" + }, + "key4": { + "age": 2, + "kind": "salmon", + "friends": [ + { + "age": 1, + "kind": "salmon" + }, + { + "age": 4, + "kind": "shark", + "sharktype": "goblin" + } + ] + } } } -} -``` -""") + ``` + """) @get op getRecursiveModel(): Fish; @scenario @route("/recursivemodel") @scenarioDoc(""" -Generate and send polymorphic models has collection and dictionary properties referring to other polymorphic models. -Expected input body: -```json -{ - "age": 1, - "kind": "salmon", - "partner": { - "age": 2, - "kind": "shark", - "sharktype": "saw" - }, - "friends": [ - { + Generate and send polymorphic models has collection and dictionary properties referring to other polymorphic models. + Expected input body: + ```json + { + "age": 1, + "kind": "salmon", + "partner": { "age": 2, - "kind": "salmon", - "partner": { - "age": 3, - "kind": "salmon" - }, - "hate": { - "key1": { - "age": 4, - "kind": "salmon" - }, - "key2": { - "age": 2, - "kind": "shark", - "sharktype": "goblin" - } - } - }, - { - "age": 3, - "kind": "shark", - "sharktype": "goblin" - } - ], - "hate": { - "key3": { - "age": 3, "kind": "shark", "sharktype": "saw" }, - "key4": { - "age": 2, - "kind": "salmon", - "friends": [ - { - "age": 1, + "friends": [ + { + "age": 2, + "kind": "salmon", + "partner": { + "age": 3, "kind": "salmon" }, - { - "age": 4, - "kind": "shark", - "sharktype": "goblin" + "hate": { + "key1": { + "age": 4, + "kind": "salmon" + }, + "key2": { + "age": 2, + "kind": "shark", + "sharktype": "goblin" + } } - ] + }, + { + "age": 3, + "kind": "shark", + "sharktype": "goblin" + } + ], + "hate": { + "key3": { + "age": 3, + "kind": "shark", + "sharktype": "saw" + }, + "key4": { + "age": 2, + "kind": "salmon", + "friends": [ + { + "age": 1, + "kind": "salmon" + }, + { + "age": 4, + "kind": "shark", + "sharktype": "goblin" + } + ] + } } } -} -``` -""") + ``` + """) @put op putRecursiveModel(@body input: Fish): NoContentResponse; @scenario @route("/missingdiscriminator") @scenarioDoc(""" -Get a model omitting the discriminator. -Expected response body: -```json -{"age": 1} -``` -""") + Get a model omitting the discriminator. + Expected response body: + ```json + {"age": 1} + ``` + """) @get op getMissingDiscriminator(): Fish; @scenario @route("/wrongdiscriminator") @scenarioDoc(""" -Get a model containing discriminator value never defined. -Expected response body: -```json -{"age": 1, "kind": "wrongKind" } -``` -""") + Get a model containing discriminator value never defined. + Expected response body: + ```json + {"age": 1, "kind": "wrongKind" } + ``` + """) @get op getWrongDiscriminator(): Fish; diff --git a/typespec-tests/tsp/partialupdate.tsp b/typespec-tests/tsp/partialupdate.tsp index 8236eecfa6..d36022de99 100644 --- a/typespec-tests/tsp/partialupdate.tsp +++ b/typespec-tests/tsp/partialupdate.tsp @@ -15,11 +15,11 @@ model PartialUpdateModel { bytes: bytes; @doc(""" - The aggregation function to be applied on the client metric. Allowed functions - - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, - ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, - ‘count’ - for requests - """) + The aggregation function to be applied on the client metric. Allowed functions + - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, + ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, + ‘count’ - for requests + """) aggregate?: string; }