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
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,53 @@
}
}
},
"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/validateAddress": {
"post": {
"tags": [
"BillingAccounts"
],
"x-ms-examples": {
"BillingAccountValidateAddress": {
"$ref": "./examples/BillingAccountValidateAddress.json"
},
"BillingAccountValidateAddressInvalid": {
"$ref": "./examples/BillingAccountValidateAddressInvalid.json"
}
},
"operationId": "BillingAccountsValidateAddress_Post",
"description": "Validates the address.",
"parameters": [
{
"$ref": "#/parameters/apiVersionParameter"
},
{
"$ref": "#/parameters/billingAccountNameParameter"
},
{
"name": "address",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Address"
}
}
],
"responses": {
"200": {
"description": "OK. The request has succeeded.",
"schema": {
"$ref": "#/definitions/ValidateAddressResponse"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default": {
"get": {
"tags": [
Expand Down Expand Up @@ -3275,6 +3322,39 @@
}
}
},
"ValidateAddressResponse": {
"type":"object",
"description" :" Result of the address validation",
"properties" : {
"status": {
"description": "status of the address validation.",
"$ref": "#/definitions/AddressValidationStatus"
},
"suggestedAddresses": {
"description": "list of suggested addresses.",
"type": "array",
"items": {
"$ref": "#/definitions/Address"
}
},
"validationMessage" : {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is validation error message part of the request body. If the validation on an address fails, shouldnt it return an error with the details part of the error body which complies with the ARM RPC error contract

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validation error message is not part of request body. If AV fails, it returns a message in ValidationMessage property which is a part of Response object.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry i meant response body itself. What i meant is -> if POST /validateAddress fails to validate an address, shouldnt the response should be a failure? In the current model, the response will be a successful response, with the validation failure in the response body.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, yes, it always responds with 200, we internally call into other service which always returns 200, with validation results in response body. We apply some business logic and return 200.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks for confirming.

"description": "Validation error message.",
"type": "string"
}
}
},
"AddressValidationStatus": {
"type": "string",
"description": "Status of the address validation response.",
"enum": [
"Valid",
"Invalid"
],
"x-ms-enum": {
"name": "addressValidationStatus",
"modelAsString": true
}
},
"InitiateTransferProperties": {
"type": "object",
"description": "Request parameters to initiate transfer.",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"parameters": {
"api-version": "2018-11-01-preview",
"billingAccountName": "00000000-0000-0000-0000-000000000000",
"address": {
"addressLine1": "555 110th Ave NE",
"city": "bellevue",
"region": "wa",
"postalCode": "98004",
"country": "us"
}
},
"responses": {
"200": {
"body": {
"status": "Valid",
"suggestedAddresses": [
{
"country": "US",
"region": "WA",
"city": "Bellevue",
"addressLine1": "555 110th Ave NE",
"postalCode": "98004-5124"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"parameters": {
"api-version": "2018-11-01-preview",
"billingAccountName": "00000000-0000-0000-0000-000000000000",
"address": {
"addressLine1": "55 110th Ave NE",
"city": "bellevue",
"region": "wa",
"postalCode": "98004",
"country": "us"
}
},
"responses": {
"200": {
"body": {
"status": "Invalid",
"suggestedAddresses": [
{
"country": "US",
"region": "WA",
"city": "Bellevue",
"addressLine1": "100 110th Ave NE",
"postalCode": "98004"
},
{
"country": "US",
"region": "WA",
"city": "Bellevue",
"addressLine1": "102 110th Ave NE",
"postalCode": "98004-5804"
},
{
"country": "US",
"region": "WA",
"city": "Bellevue",
"addressLine1": "104 110th Ave NE",
"postalCode": "98004-5804"
}
],
"validationMessage" : "Invalid address"
}
}
}
}