Skip to content
Merged
Prev Previous commit
Next Next commit
fix autorest generation swagger mismatch issue
  • Loading branch information
ericasp16 committed Jul 1, 2023
commit b298f7ee804babb9ef73c37be92f2cb67ee91982
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@

package com.azure.communication.phonenumbers.models;

import com.azure.communication.phonenumbers.implementation.models.PhoneNumberSearchResultError;
import com.azure.core.annotation.Fluent;
import com.azure.core.annotation.Immutable;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** The result of a phone number search operation. */
@Fluent
@Immutable
public final class PhoneNumberSearchResult {
/*
* The search id.
Expand Down Expand Up @@ -58,18 +57,6 @@ public final class PhoneNumberSearchResult {
@JsonProperty(value = "searchExpiresBy", required = true, access = JsonProperty.Access.WRITE_ONLY)
private OffsetDateTime searchExpiresBy;

/*
* The error code of the search.
*/
@JsonProperty(value = "errorCode")
private Integer errorCode;

/*
* Mapping Error Messages to Codes
*/
@JsonProperty(value = "error")
private PhoneNumberSearchResultError error;

/**
* Get the searchId property: The search id.
*
Expand Down Expand Up @@ -134,44 +121,4 @@ public PhoneNumberCost getCost() {
public OffsetDateTime getSearchExpiresBy() {
return this.searchExpiresBy;
}

/**
* Get the errorCode property: The error code of the search.
*
* @return the errorCode value.
*/
public Integer getErrorCode() {
return this.errorCode;
}

/**
* Set the errorCode property: The error code of the search.
*
* @param errorCode the errorCode value to set.
* @return the PhoneNumberSearchResult object itself.
*/
public PhoneNumberSearchResult setErrorCode(Integer errorCode) {
this.errorCode = errorCode;
return this;
}

/**
* Get the error property: Mapping Error Messages to Codes.
*
* @return the error value.
*/
public PhoneNumberSearchResultError getError() {
return this.error;
}

/**
* Set the error property: Mapping Error Messages to Codes.
*
* @param error the error value to set.
* @return the PhoneNumberSearchResult object itself.
*/
public PhoneNumberSearchResult setError(PhoneNumberSearchResultError error) {
this.error = error;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ autorest README.md --java --v4 --use=@autorest/[email protected]
### Code generation settings
``` yaml
tag: package-phonenumber-2023-05-01-preview
require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/4d2e746ac1e094f87bfe0807b1d51b375a6c5517/specification/communication/data-plane/PhoneNumbers/readme.md
require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/2d4881cf7101773b8c677a267b53d915b30a8c6c/specification/communication/data-plane/PhoneNumbers/readme.md
override-client-name: PhoneNumberAdminClient
custom-types: PurchasedPhoneNumber,BillingFrequency,PhoneNumberOperationStatus,PhoneNumberOperationStatusCodes,PhoneNumberOperationType,PhoneNumberAssignmentType,PhoneNumberCapabilities,PhoneNumberCapabilityType,PhoneNumberCost,PhoneNumberSearchResult,PhoneNumberType,PhoneNumberCapability,PhoneNumberAdministrativeDivision,PhoneNumberCountry,PhoneNumberLocality,PhoneNumberOffering,AreaCodeResult,AreaCodes,PhoneNumberAreaCode,OperatorDetails,OperatorInformation,OperatorInformationRequest,OperatorInformationResult,OperatorNumberType
custom-types-subpackage: models
Expand Down Expand Up @@ -190,22 +190,4 @@ directive:
transform: >
$["properties"]["localizedName"].readOnly = true;
$["properties"]["countryCode"].readOnly = true;
```

### Change a generic error to more specific name
``` yaml
directive:
from: swagger-document
where: $.definitions.PhoneNumberSearchResult.properties.error.x-ms-enum
transform: >
$["name"] = "PhoneNumberSearchResultError";
```

### Change a generic error to more specific name
``` yaml
directive:
from: swagger-document
where: $.parameters.Endpoint
debug: true
transform: >
$["format"] = "";
```