Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions sdk/webpubsub/azure-messaging-webpubsub-chat/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,29 @@

### Features Added

- Added support for service API version `2026-08-01-preview`, now the default service version.
- Added synchronous and asynchronous operations to list rooms, users, and rooms associated with a user.
- Added topic creation, replacement, retrieval, update, soft deletion, and listing.
- Added `ChatTopic`, `ChatTopicState`, and the read-only `ChatUserRoom` projection.

### Breaking Changes

- Replaced the public `MessageContent` constructor and `setText`/`setBinary` methods with `MessageContent.fromText` and `MessageContent.fromBinary`. Each instance contains exactly one non-null representation; empty text and binary payloads remain supported.
- Renamed `GetClientAccessTokenOptions` to `ClientAccessTokenOptions`.
- Renamed `ChatConversation.getParentRoom()` to `getRoomId()`. The JSON property remains `parentRoom`.

### Bugs Fixed

- Corrected request and response Javadoc schemas to reflect read-only properties and partial-update optionality, and clarified that topic state is optional on creation.
- Regenerated with Java emitter 0.48.1 to preserve page-size overrides on typed asynchronous collections, including continuation requests.

### Other Changes

- Renamed request body parameters from `resource` to `role`, `room`, `member`, `user`, `topic`, or `message` to match their operations.
- Clarified message-ID-based descending pagination, text versus binary message content, and client access token generation.
- Verified all existing and new operations end to end with `2026-08-01-preview` in Central US EUAP; removed the temporary server routing workaround and restored the complete live/playback suite.
- Enabled all typed asynchronous page-size regression cases and removed the temporary protocol paging workaround from tests and samples.

## 1.0.0-beta.1 (2026-09-15)

- Azure WebPubSubChat client library for Java. This package contains Microsoft Azure WebPubSubChat client library.
Expand Down
225 changes: 182 additions & 43 deletions sdk/webpubsub/azure-messaging-webpubsub-chat/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sdk/webpubsub/azure-messaging-webpubsub-chat/assets.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"AssetsRepo":"Azure/azure-sdk-assets","AssetsRepoPrefixPath":"java","TagPrefix":"java/webpubsub/azure-messaging-webpubsub-chat","Tag": "java/webpubsub/azure-messaging-webpubsub-chat_395861d3d4"}
{"AssetsRepo":"Azure/azure-sdk-assets","AssetsRepoPrefixPath":"java","TagPrefix":"java/webpubsub/azure-messaging-webpubsub-chat","Tag": "java/webpubsub/azure-messaging-webpubsub-chat_56e475133e"}
372 changes: 0 additions & 372 deletions sdk/webpubsub/azure-messaging-webpubsub-chat/customization.md

This file was deleted.

Comment thread
alzimmermsft marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
<properties>
<relative.path.to.eng.folder>../../../../</relative.path.to.eng.folder>
</properties>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import com.azure.autorest.customization.Customization;
import com.azure.autorest.customization.LibraryCustomization;
import com.azure.autorest.customization.PackageCustomization;
import com.github.javaparser.StaticJavaParser;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import org.slf4j.Logger;

/** Customizes the generated Azure Web PubSub Chat client library. */
Expand All @@ -26,15 +30,124 @@ public void customize(LibraryCustomization libraryCustomization, Logger logger)
.noneMatch(type -> type.getNameAsString().equals("ConnectionStringTrait"))) {
builder.addImplementedType("ConnectionStringTrait<WebPubSubChatServiceClientBuilder>");
}
for (String methodName : new String[] { "buildClient", "buildAsyncClient" }) {
MethodDeclaration method = builder.getMethodsByName(methodName)
.stream()
.findFirst()
.orElseThrow(() -> new IllegalStateException("Missing builder method: " + methodName));
method.setBody(StaticJavaParser.parseBlock(
"{ return new " + method.getTypeAsString() + "(buildInnerClient(), keyCredential); }"));
}
});
});

customizeTokenClient(chatPackage, "WebPubSubChatServiceClient");
customizeTokenClient(chatPackage, "WebPubSubChatServiceAsyncClient");
libraryCustomization.getPackage(PACKAGE_NAME + ".models")
.getClass("MessageContent")
.customizeAst(WebPubSubChatCustomization::customizeMessageContent);

customizeLifecycleDocumentation(libraryCustomization);
removeTrailingJavadocWhitespace(libraryCustomization);
}

static void customizeLifecycleDocumentation(LibraryCustomization libraryCustomization) {
String root = "src/main/java/com/azure/messaging/webpubsub/chat/";
for (String file : new String[] {
"WebPubSubChatServiceClient.java",
"WebPubSubChatServiceAsyncClient.java",
"implementation/WebPubSubChatServiceClientImpl.java" }) {
String path = root + file;
String source = libraryCustomization.getRawEditor().getFileContent(path);
libraryCustomization.getRawEditor().replaceFile(path, correctLifecycleDocumentation(source));
}
}

static String correctLifecycleDocumentation(String source) {
Comment thread
Y-Sindo marked this conversation as resolved.
Resolved
for (MethodDeclaration method : StaticJavaParser.parse(source).findAll(MethodDeclaration.class)) {
if (!method.getJavadocComment().isPresent()) {
continue;
}
String original = method.getJavadocComment().get().getContent();
String corrected = original;
String responseHeading = "<p><strong>Response Body Schema</strong></p>";
int responseStart = corrected.indexOf(responseHeading);
if (responseStart >= 0) {
// Topic state is required on read even though it isn't accepted on create.
corrected = corrected.substring(0, responseStart)
+ corrected.substring(responseStart)
.replace("(Optional, Required on create)", "(Required)")
.replace("state: String(Normal/Archived/SoftDeleted) (Optional)",
"state: String(Normal/Archived/SoftDeleted) (Required)");
}
int requestStart = corrected.indexOf("<p><strong>Request Body Schema</strong></p>");
if (requestStart >= 0) {
if (responseStart < requestStart) {
throw new IllegalStateException("Missing response schema for " + method.getNameAsString());
}
String request = corrected.substring(requestStart, responseStart);
String readOnlyFields;
String name = method.getNameAsString();
if (name.startsWith("updateMessage")) {
readOnlyFields = "id|createdAt|etag";
} else if (name.startsWith("createOrReplaceRole")) {
readOnlyFields = "name|etag";
} else if (name.startsWith("createOrReplaceRoomMember")) {
readOnlyFields = "userId|etag";
} else if (name.startsWith("createOrReplaceRoom")) {
readOnlyFields = "id|defaultConversation|etag";
} else if (name.startsWith("createOrReplaceUser")) {
readOnlyFields = "id|etag";
} else if (name.startsWith("createOrReplaceTopic") || name.startsWith("updateTopic")) {
readOnlyFields = "id|createdAt|createdBy|conversationId|etag";
} else {
throw new IllegalStateException("Unrecognized request schema for " + name);
}
request = request.replaceAll("(?m)^\\h*\\*\\h+(?:" + readOnlyFields + "):[^\\r\\n]*\\R", "");
request = request.replace("(Optional, Required on create)",
name.startsWith("update") ? "(Optional)" : "(Required)");
if (name.startsWith("createOrReplaceTopic")) {
request = request.replaceAll("(state: [^\\r\\n]+)\\(Required\\)", "$1(Optional)");
}
corrected = corrected.substring(0, requestStart) + request + corrected.substring(responseStart);
}
if (method.getNameAsString().startsWith("createOrReplaceTopic")
&& !corrected.contains("When creating a topic, omit state")) {
corrected = corrected.replace("Create or replace a topic.",
"Create or replace a topic.\n *\n"
+ " * <p>When creating a topic, omit state. "
+ "Other states are only valid when replacing an existing topic.</p>");
}
if (!original.equals(corrected)) {
source = source.replace(original, corrected);
}
}
return source;
}

static void customizeMessageContent(CompilationUnit ast) {
// Partial update preserves handwritten members without @Generated, but regenerates removed setters.
ClassOrInterfaceDeclaration model = ast.getClassByName("MessageContent")
.orElseThrow(() -> new IllegalStateException("MessageContent model not found."));
ast.getImports()
.removeIf(
importDeclaration -> importDeclaration.getNameAsString().equals("com.azure.core.annotation.Fluent")
|| importDeclaration.getNameAsString().equals("java.util.HashSet")
|| importDeclaration.getNameAsString().equals("java.util.Set"));
ast.addImport("com.azure.core.annotation.Immutable");
model.getAnnotations().removeIf(annotation -> annotation.getNameAsString().equals("Fluent"));
if (!model.getAnnotationByName("Immutable").isPresent()) {
model.addMarkerAnnotation("Immutable");
}
model.setJavadocComment("Message content containing exactly one of text or binary data.\n"
+ "Use {@link #fromText(String)} or {@link #fromBinary(byte[])} to create content.\n"
+ "The getter for the unselected representation returns {@code null}.");
model.getFieldByName("updatedProperties").ifPresent(field -> field.remove());
model.getMethodsByName("setText").forEach(method -> method.remove());
model.getMethodsByName("setBinary").forEach(method -> method.remove());
model.getMethodsByName("toJsonMergePatch").forEach(method -> method.remove());
}

private static void customizeTokenClient(PackageCustomization chatPackage, String className) {
chatPackage.getClass(className).customizeAst(ast -> {
ast.getImports()
Expand Down
Loading
Loading