Skip to content

Commit

Permalink
eng, bump typespec libs, prepare 0.27.0 release (#2995)
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft authored Dec 11, 2024
1 parent 132e859 commit 16bda4a
Show file tree
Hide file tree
Showing 20 changed files with 415 additions and 371 deletions.
2 changes: 1 addition & 1 deletion core
Submodule core updated 185 files
4 changes: 4 additions & 0 deletions typespec-extension/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History

## 0.27.0 (2024-12-11)

Compatible with compiler 0.63.

## 0.26.1 (2024-12-10)

Compatible with compiler 0.62.
Expand Down
503 changes: 303 additions & 200 deletions typespec-extension/package-lock.json

Large diffs are not rendered by default.

62 changes: 31 additions & 31 deletions typespec-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure-tools/typespec-java",
"version": "0.26.1",
"version": "0.27.0",
"description": "TypeSpec library for emitting Java client from the TypeSpec REST protocol binding",
"keywords": [
"TypeSpec"
Expand Down Expand Up @@ -45,47 +45,47 @@
"generator/http-client-generator/target/emitter.jar"
],
"peerDependencies": {
"@azure-tools/typespec-azure-core": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-azure-resource-manager": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-azure-rulesets": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.48.5 <1.0.0",
"@typespec/compiler": ">=0.62.0 <1.0.0",
"@typespec/http": ">=0.62.0 <1.0.0",
"@typespec/openapi": ">=0.62.0 <1.0.0",
"@typespec/rest": ">=0.62.0 <1.0.0",
"@typespec/versioning": ">=0.62.0 <1.0.0",
"@typespec/xml": ">=0.62.0 <1.0.0"
"@azure-tools/typespec-azure-core": ">=0.49.0 <1.0.0",
"@azure-tools/typespec-azure-resource-manager": ">=0.49.0 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.49.0 <1.0.0",
"@azure-tools/typespec-azure-rulesets": ">=0.49.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.49.0 <1.0.0",
"@typespec/compiler": ">=0.63.0 <1.0.0",
"@typespec/http": ">=0.63.0 <1.0.0",
"@typespec/openapi": ">=0.63.0 <1.0.0",
"@typespec/rest": ">=0.63.0 <1.0.0",
"@typespec/versioning": ">=0.63.0 <1.0.0",
"@typespec/xml": ">=0.63.0 <1.0.0"
},
"dependencies": {
"@autorest/codemodel": "~4.20.0",
"js-yaml": "~4.1.0",
"lodash": "~4.17.21"
},
"devDependencies": {
"@azure-tools/typespec-azure-core": "0.48.0",
"@azure-tools/typespec-azure-resource-manager": "0.48.0",
"@azure-tools/typespec-autorest": "0.48.0",
"@azure-tools/typespec-azure-rulesets": "0.48.0",
"@azure-tools/typespec-client-generator-core": "0.48.5",
"@azure-tools/typespec-azure-core": "0.49.0",
"@azure-tools/typespec-azure-resource-manager": "0.49.0",
"@azure-tools/typespec-autorest": "0.49.0",
"@azure-tools/typespec-azure-rulesets": "0.49.0",
"@azure-tools/typespec-client-generator-core": "0.49.0",
"@types/js-yaml": "~4.0.9",
"@types/lodash": "~4.17.13",
"@types/mocha": "~10.0.9",
"@types/node": "~22.9.0",
"@typescript-eslint/eslint-plugin": "~8.14.0",
"@typescript-eslint/parser": "~8.14.0",
"@typespec/compiler": "0.62.0",
"@typespec/http": "0.62.0",
"@typespec/openapi": "0.62.0",
"@typespec/rest": "0.62.0",
"@typespec/versioning": "0.62.0",
"@typespec/xml": "0.62.0",
"c8": "~10.1.2",
"@types/mocha": "~10.0.10",
"@types/node": "~22.10.1",
"@typescript-eslint/eslint-plugin": "~8.18.0",
"@typescript-eslint/parser": "~8.18.0",
"@typespec/compiler": "0.63.0",
"@typespec/http": "0.63.0",
"@typespec/openapi": "0.63.0",
"@typespec/rest": "0.63.0",
"@typespec/versioning": "0.63.0",
"@typespec/xml": "0.63.0",
"c8": "~10.1.3",
"eslint": "~8.57.0",
"eslint-plugin-deprecation": "~3.0.0",
"mocha": "~10.8.2",
"prettier": "~3.3.3",
"mocha": "~11.0.1",
"prettier": "~3.4.2",
"rimraf": "~6.0.1",
"typescript": "~5.6.3"
"typescript": "~5.7.2"
}
}
2 changes: 1 addition & 1 deletion typespec-extension/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Install [Java](https://docs.microsoft.com/java/openjdk/download) 11 or above. (V

Install [Maven](https://maven.apache.org/install.html). (Verify by running `mvn --version`)

Install [TypeSpec](https://typespec.io/) 0.62.
Install [TypeSpec](https://typespec.io/) 0.63.

# Initialize TypeSpec Project

Expand Down
28 changes: 14 additions & 14 deletions typespec-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@
"testserver-run": "npx cadl-ranch serve ./node_modules/@azure-tools/cadl-ranch-specs/http --coverageFile ./cadl-ranch-coverage-java.json"
},
"dependencies": {
"@azure-tools/cadl-ranch-specs": "0.39.4",
"@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.26.1.tgz"
"@azure-tools/cadl-ranch-specs": "0.39.5",
"@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.27.0.tgz"
},
"devDependencies": {
"@typespec/prettier-plugin-typespec": "~0.62.0",
"@typespec/prettier-plugin-typespec": "~0.63.0",
"prettier-plugin-organize-imports": "4.1.0",
"prettier": "~3.3.3"
"prettier": "~3.4.2"
},
"overrides": {
"@typespec/compiler": "~0.62.0",
"@typespec/http": "~0.62.0",
"@typespec/rest": "~0.62.0",
"@typespec/versioning": "~0.62.0",
"@typespec/openapi": "~0.62.0",
"@typespec/xml": "~0.62.0",
"@azure-tools/typespec-azure-core": "~0.48.0",
"@azure-tools/typespec-client-generator-core": "~0.48.0",
"@azure-tools/typespec-azure-resource-manager": "~0.48.0",
"@azure-tools/typespec-autorest": "~0.48.0"
"@typespec/compiler": "~0.63.0",
"@typespec/http": "~0.63.0",
"@typespec/rest": "~0.63.0",
"@typespec/versioning": "~0.63.0",
"@typespec/openapi": "~0.63.0",
"@typespec/xml": "~0.63.0",
"@azure-tools/typespec-azure-core": "~0.49.0",
"@azure-tools/typespec-client-generator-core": "~0.49.0",
"@azure-tools/typespec-azure-resource-manager": "~0.49.0",
"@azure-tools/typespec-autorest": "~0.49.0"
},
"private": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public final class OperationInner {
/*
* Localized display information for this particular operation.
*/
@JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY)
@JsonProperty(value = "display")
private OperationDisplay display;

/*
Expand All @@ -45,7 +45,7 @@ public final class OperationInner {
/*
* Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
*/
@JsonProperty(value = "actionType")
@JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY)
private ActionType actionType;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,26 +407,6 @@ Mono<Response<BinaryData>> listStringsNext(@PathParam(value = "nextLink", encode
Response<BinaryData> listStringsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink,
@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions,
Context context);

@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
@UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
@UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
Mono<Response<BinaryData>> listIntegersNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions,
Context context);

@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
@UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
@UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
Response<BinaryData> listIntegersNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink,
@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions,
Context context);
}

/**
Expand Down Expand Up @@ -1290,7 +1270,7 @@ private Mono<PagedResponse<BinaryData>> listIntegersSinglePageAsync(RequestOptio
return FluxUtil
.withContext(context -> service.listIntegers(this.getEndpoint(), accept, requestOptions, context))
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
getValues(res.getValue(), "value"), null, null));
}

/**
Expand All @@ -1312,11 +1292,7 @@ private Mono<PagedResponse<BinaryData>> listIntegersSinglePageAsync(RequestOptio
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<BinaryData> listIntegersAsync(RequestOptions requestOptions) {
RequestOptions requestOptionsForNextPage = new RequestOptions();
requestOptionsForNextPage.setContext(
requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
return new PagedFlux<>(() -> listIntegersSinglePageAsync(requestOptions),
nextLink -> listIntegersNextSinglePageAsync(nextLink, requestOptionsForNextPage));
return new PagedFlux<>(() -> listIntegersSinglePageAsync(requestOptions));
}

/**
Expand All @@ -1341,7 +1317,7 @@ private PagedResponse<BinaryData> listIntegersSinglePage(RequestOptions requestO
final String accept = "application/json";
Response<BinaryData> res = service.listIntegersSync(this.getEndpoint(), accept, requestOptions, Context.NONE);
return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
getValues(res.getValue(), "value"), null, null);
}

/**
Expand All @@ -1363,11 +1339,7 @@ private PagedResponse<BinaryData> listIntegersSinglePage(RequestOptions requestO
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<BinaryData> listIntegers(RequestOptions requestOptions) {
RequestOptions requestOptionsForNextPage = new RequestOptions();
requestOptionsForNextPage.setContext(
requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE);
return new PagedIterable<>(() -> listIntegersSinglePage(requestOptions),
nextLink -> listIntegersNextSinglePage(nextLink, requestOptionsForNextPage));
return new PagedIterable<>(() -> listIntegersSinglePage(requestOptions));
}

/**
Expand Down Expand Up @@ -1540,62 +1512,6 @@ private PagedResponse<BinaryData> listStringsNextSinglePage(String nextLink, Req
getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
}

/**
* Get the next page of items.
* <p><strong>Response Body Schema</strong></p>
*
* <pre>
* {@code
* int
* }
* </pre>
*
* @param nextLink The URL to get the next list of items.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<BinaryData>> listIntegersNextSinglePageAsync(String nextLink,
RequestOptions requestOptions) {
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.listIntegersNext(nextLink, this.getEndpoint(), accept, requestOptions, context))
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null));
}

/**
* Get the next page of items.
* <p><strong>Response Body Schema</strong></p>
*
* <pre>
* {@code
* int
* }
* </pre>
*
* @param nextLink The URL to get the next list of items.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return the response body along with {@link PagedResponse}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PagedResponse<BinaryData> listIntegersNextSinglePage(String nextLink, RequestOptions requestOptions) {
final String accept = "application/json";
Response<BinaryData> res
= service.listIntegersNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE);
return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null);
}

private List<BinaryData> getValues(BinaryData binaryData, String path) {
try {
Map<?, ?> obj = binaryData.toObject(Map.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public Mono<Response<BinaryData>> getWithResponse(RequestOptions requestOptions)
* <pre>
* {@code
* {
* secretName: String (Required)
* name: String (Required)
* }
* }
Expand Down Expand Up @@ -113,7 +114,7 @@ public Mono<Response<BinaryData>> createWithResponse(BinaryData dog, RequestOpti
* <pre>
* {@code
* {
* id: int (Required)
* secretName: String (Required)
* name: String (Required)
* }
* }
Expand All @@ -125,7 +126,6 @@ public Mono<Response<BinaryData>> createWithResponse(BinaryData dog, RequestOpti
* {@code
* {
* id: int (Required)
* secretName: String (Required)
* name: String (Required)
* }
* }
Expand Down Expand Up @@ -237,11 +237,11 @@ public Mono<Dog> create(WriteDog dog) {
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Dog> query(ReadDog dog) {
public Mono<ReadDog> query(WriteDog dog) {
// Generated convenience method for queryWithResponse
RequestOptions requestOptions = new RequestOptions();
return queryWithResponse(BinaryData.fromObject(dog), requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(Dog.class));
.map(protocolMethodData -> protocolMethodData.toObject(ReadDog.class));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public Response<BinaryData> getWithResponse(RequestOptions requestOptions) {
* <pre>
* {@code
* {
* secretName: String (Required)
* name: String (Required)
* }
* }
Expand Down Expand Up @@ -111,7 +112,7 @@ public Response<BinaryData> createWithResponse(BinaryData dog, RequestOptions re
* <pre>
* {@code
* {
* id: int (Required)
* secretName: String (Required)
* name: String (Required)
* }
* }
Expand All @@ -123,7 +124,6 @@ public Response<BinaryData> createWithResponse(BinaryData dog, RequestOptions re
* {@code
* {
* id: int (Required)
* secretName: String (Required)
* name: String (Required)
* }
* }
Expand Down Expand Up @@ -233,10 +233,10 @@ public Dog create(WriteDog dog) {
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Dog query(ReadDog dog) {
public ReadDog query(WriteDog dog) {
// Generated convenience method for queryWithResponse
RequestOptions requestOptions = new RequestOptions();
return queryWithResponse(BinaryData.fromObject(dog), requestOptions).getValue().toObject(Dog.class);
return queryWithResponse(BinaryData.fromObject(dog), requestOptions).getValue().toObject(ReadDog.class);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public final class VisibilityWriteAsyncClient {
* <pre>
* {@code
* {
* secretName: String (Required)
* name: String (Required)
* }
* }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public final class VisibilityWriteClient {
* <pre>
* {@code
* {
* secretName: String (Required)
* name: String (Required)
* }
* }
Expand Down
Loading

0 comments on commit 16bda4a

Please sign in to comment.