Skip to content

Commit

Permalink
file share exception annotation working
Browse files Browse the repository at this point in the history
  • Loading branch information
gapra-msft committed Jun 29, 2021
1 parent e78e23c commit 8af9313
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;

/** Parameter group. */
@JacksonXmlRootElement(localName = "CopyFileSmbInfo")
@Fluent
@JacksonXmlRootElement(localName = "copy-file-smb-info")
public final class CopyFileSmbInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;

/** Parameter group. */
@JacksonXmlRootElement(localName = "ShareFileHttpHeaders")
@Fluent
@JacksonXmlRootElement(localName = "share-file-http-headers")
public final class ShareFileHttpHeaders {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;

/** Parameter group. */
@JacksonXmlRootElement(localName = "SourceModifiedAccessConditions")
@Fluent
@JacksonXmlRootElement(localName = "source-modified-access-conditions")
public final class SourceModifiedAccessConditions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,26 @@ public void customize(LibraryCustomization customization, Logger logger) {

// Replace JacksonXmlRootElement annotations that are causing a semantic breaking change.
ClassCustomization shareFileHttpHeaders = models.getClass("ShareFileHttpHeaders");
shareFileHttpHeaders.removeAnnotation("@JacksonXmlRootElement(localName = \"ShareFileHttpHeaders\")");
shareFileHttpHeaders.addAnnotation("@JacksonXmlRootElement(localName = \"share-file-http-headers\")");
shareFileHttpHeaders.removeAnnotation("@JacksonXmlRootElement(localName = \"ShareFileHttpHeaders\")")
.addAnnotation("@JacksonXmlRootElement(localName = \"share-file-http-headers\")");

ClassCustomization sourceModifiedAccessConditions = models.getClass("SourceModifiedAccessConditions");
sourceModifiedAccessConditions.removeAnnotation("@JacksonXmlRootElement(localName = \"SourceModifiedAccessConditions\")");
sourceModifiedAccessConditions.addAnnotation("@JacksonXmlRootElement(localName = \"source-modified-access-conditions\")");
sourceModifiedAccessConditions.removeAnnotation("@JacksonXmlRootElement(localName = \"SourceModifiedAccessConditions\")")
.addAnnotation("@JacksonXmlRootElement(localName = \"source-modified-access-conditions\")");

// Update incorrect JsonProperty of Metrics
ClassCustomization shareServiceProperties = models.getClass("ShareServiceProperties");
PropertyCustomization hourMetrics = shareServiceProperties.getProperty("hourMetrics");
hourMetrics.removeAnnotation("@JsonProperty(value = \"Metrics\")");
hourMetrics.addAnnotation("@JsonProperty(value = \"HourMetrics\")");
hourMetrics.removeAnnotation("@JsonProperty(value = \"Metrics\")")
.addAnnotation("@JsonProperty(value = \"HourMetrics\")");
PropertyCustomization minuteMetrics = shareServiceProperties.getProperty("minuteMetrics");
minuteMetrics.removeAnnotation("@JsonProperty(value = \"Metrics\")");
minuteMetrics.addAnnotation("@JsonProperty(value = \"MinuteMetrics\")");
minuteMetrics.removeAnnotation("@JsonProperty(value = \"Metrics\")")
.addAnnotation("@JsonProperty(value = \"MinuteMetrics\")");

}

private void modifyUnexpectedResponseExceptionType(MethodCustomization method) {
method.removeAnnotation("@UnexpectedResponseExceptionType(StorageErrorException.class)");
method.addAnnotation("@UnexpectedResponseExceptionType(com.azure.storage.file.share.models.ShareStorageException.class)");
method.removeAnnotation("@UnexpectedResponseExceptionType(StorageErrorException.class)")
.addAnnotation("@UnexpectedResponseExceptionType(com.azure.storage.file.share.models.ShareStorageException.class)");
}
}

0 comments on commit 8af9313

Please sign in to comment.