From 9144c3ab14d426158127f3ffbf165353de7964fb Mon Sep 17 00:00:00 2001 From: Dominik Messinger Date: Tue, 2 Feb 2021 15:56:38 -0800 Subject: [PATCH 1/4] Add stable version of common model swagger for Azure Communication Services --- .../stable/2021-03-07/common.json | 154 ++++++++++++++++++ .../communication/data-plane/readme.md | 1 + 2 files changed, 155 insertions(+) create mode 100644 specification/communication/data-plane/Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json diff --git a/specification/communication/data-plane/Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json b/specification/communication/data-plane/Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json new file mode 100644 index 000000000000..3fc4d137ef96 --- /dev/null +++ b/specification/communication/data-plane/Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json @@ -0,0 +1,154 @@ +{ + "swagger": "2.0", + "info": { + "title": "Communication", + "description": "Communication Services API common types.", + "version": "2020-11-19-preview1" + }, + "paths": {}, + "definitions": { + "CommunicationErrorResponse": { + "description": "The Communication Services error.", + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "description": "The Communication Services error.", + "$ref": "#/definitions/CommunicationError" + } + } + }, + "CommunicationError": { + "description": "The Communication Services error.", + "type": "object", + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "string", + "description": "The error code." + }, + "message": { + "type": "string", + "description": "The error message." + }, + "target": { + "type": "string", + "readOnly": true, + "description": "The error target." + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/CommunicationError" + }, + "readOnly": true, + "description": "Further details about specific errors that led to this error." + }, + "innererror": { + "x-ms-client-name": "innerError", + "readOnly": true, + "$ref": "#/definitions/CommunicationError", + "description": "The inner error if any." + } + } + }, + "CommunicationCloudEnvironmentModel": { + "description": "The cloud that the identifier belongs to.", + "type": "string", + "enum": [ + "public", + "dod", + "gcch" + ], + "x-ms-enum": { + "name": "CommunicationCloudEnvironmentModel", + "modelAsString": true + } + }, + "CommunicationIdentifierModel": { + "description": "Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user.", + "type": "object", + "properties": { + "rawId": { + "type": "string", + "description": "Raw Id of the identifier. Optional in requests, required in responses." + }, + "communicationUser": { + "$ref": "#/definitions/CommunicationUserIdentifierModel", + "description": "The communication user." + }, + "phoneNumber": { + "$ref": "#/definitions/PhoneNumberIdentifierModel", + "description": "The phone number." + }, + "microsoftTeamsUser": { + "type": "string", + "description": "The Microsoft Teams user." + } + } + }, + "CommunicationUserIdentifierModel": { + "description": "A user that got created with an Azure Communication Services resource.", + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The Id of the communication user." + } + } + }, + "PhoneNumberIdentifierModel": { + "description": "A phone number.", + "type": "object", + "required": [ + "value" + ], + "properties": { + "value": { + "type": "string", + "description": "The phone number in E.164 format." + } + } + }, + "MicrosoftTeamsUserIdentifierModel": { + "description": "A Microsoft Teams user.", + "type": "object", + "required": [ + "userId" + ], + "properties": { + "userId": { + "type": "string", + "description": "The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user." + }, + "isAnonymous": { + "type": "boolean", + "description": "True if the Microsoft Teams user is anonymous." + }, + "cloud": { + "$ref": "#/definitions/CommunicationCloudEnvironmentModel", + "description": "The cloud that the Microsoft Teams user belongs to." + } + } + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow.", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + } +} diff --git a/specification/communication/data-plane/readme.md b/specification/communication/data-plane/readme.md index ece0fd81a290..11d70c822082 100644 --- a/specification/communication/data-plane/readme.md +++ b/specification/communication/data-plane/readme.md @@ -84,6 +84,7 @@ These settings apply only when `--tag=package-2021-03-07` is specified on the co ```yaml $(tag) == 'package-2021-03-07' input-file: - Microsoft.CommunicationServicesIdentity/stable/2021-03-07/CommunicationIdentity.json + - Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json ``` ### Tag: package-2021-02-22-preview1 From 45a9abbcbd21967ddea638ae4201c76e0e6287e7 Mon Sep 17 00:00:00 2001 From: Dominik Messinger Date: Tue, 2 Feb 2021 16:09:37 -0800 Subject: [PATCH 2/4] address comments --- .../stable/2021-03-07/common.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/specification/communication/data-plane/Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json b/specification/communication/data-plane/Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json index 3fc4d137ef96..8de2fc8e1d67 100644 --- a/specification/communication/data-plane/Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json +++ b/specification/communication/data-plane/Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json @@ -3,7 +3,7 @@ "info": { "title": "Communication", "description": "Communication Services API common types.", - "version": "2020-11-19-preview1" + "version": "2021-03-07" }, "paths": {}, "definitions": { @@ -71,7 +71,7 @@ } }, "CommunicationIdentifierModel": { - "description": "Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user.", + "description": "Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set.", "type": "object", "properties": { "rawId": { @@ -83,11 +83,11 @@ "description": "The communication user." }, "phoneNumber": { - "$ref": "#/definitions/PhoneNumberIdentifierModel", + "$ref": "#/definitions/PhoneNumberIdentifierModel", "description": "The phone number." }, "microsoftTeamsUser": { - "type": "string", + "$ref": "#/definitions/MicrosoftTeamsUserIdentifierModel", "description": "The Microsoft Teams user." } } @@ -131,11 +131,11 @@ }, "isAnonymous": { "type": "boolean", - "description": "True if the Microsoft Teams user is anonymous." + "description": "True if the Microsoft Teams user is anonymous. By default false if missing." }, "cloud": { "$ref": "#/definitions/CommunicationCloudEnvironmentModel", - "description": "The cloud that the Microsoft Teams user belongs to." + "description": "The cloud that the Microsoft Teams user belongs to. By default 'public' if missing." } } } From 1919da5aff785751ea361db6eac14b5836f01254 Mon Sep 17 00:00:00 2001 From: Dominik Messinger Date: Tue, 2 Feb 2021 16:14:32 -0800 Subject: [PATCH 3/4] fix title in readme --- specification/communication/data-plane/readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/specification/communication/data-plane/readme.md b/specification/communication/data-plane/readme.md index 11d70c822082..e90b4e6e29b9 100644 --- a/specification/communication/data-plane/readme.md +++ b/specification/communication/data-plane/readme.md @@ -85,6 +85,8 @@ These settings apply only when `--tag=package-2021-03-07` is specified on the co input-file: - Microsoft.CommunicationServicesIdentity/stable/2021-03-07/CommunicationIdentity.json - Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json +title: + Azure Communication Services ``` ### Tag: package-2021-02-22-preview1 From 0407a34c229ed952911f263bafd85dfdcf93dbdd Mon Sep 17 00:00:00 2001 From: Dominik Messinger Date: Wed, 3 Feb 2021 19:52:13 -0800 Subject: [PATCH 4/4] reference common error models in identity swagger --- .../2021-03-07/CommunicationIdentity.json | 54 ++----------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/stable/2021-03-07/CommunicationIdentity.json b/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/stable/2021-03-07/CommunicationIdentity.json index 813c89f96596..e227da9f4637 100644 --- a/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/stable/2021-03-07/CommunicationIdentity.json +++ b/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/stable/2021-03-07/CommunicationIdentity.json @@ -35,7 +35,7 @@ "default": { "description": "Error", "schema": { - "$ref": "#/definitions/CommunicationErrorResponse" + "$ref": "../../../Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse" } }, "201": { @@ -78,7 +78,7 @@ "default": { "description": "Error", "schema": { - "$ref": "#/definitions/CommunicationErrorResponse" + "$ref": "../../../Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse" } }, "204": { @@ -118,7 +118,7 @@ "default": { "description": "Error", "schema": { - "$ref": "#/definitions/CommunicationErrorResponse" + "$ref": "../../../Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse" } }, "204": { @@ -170,7 +170,7 @@ "default": { "description": "Error", "schema": { - "$ref": "#/definitions/CommunicationErrorResponse" + "$ref": "../../../Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse" } }, "200": { @@ -213,52 +213,6 @@ } } }, - "CommunicationError": { - "description": "The Communication Services error.", - "required": [ - "code", - "message" - ], - "type": "object", - "properties": { - "code": { - "description": "The error code.", - "type": "string" - }, - "message": { - "description": "The error message.", - "type": "string" - }, - "target": { - "description": "The error target.", - "type": "string", - "readOnly": true - }, - "details": { - "description": "Further details about specific errors that led to this error.", - "type": "array", - "items": { - "$ref": "#/definitions/CommunicationError" - }, - "readOnly": true - }, - "innerError": { - "$ref": "#/definitions/CommunicationError" - } - } - }, - "CommunicationErrorResponse": { - "description": "The Communication Services error.", - "required": [ - "error" - ], - "type": "object", - "properties": { - "error": { - "$ref": "#/definitions/CommunicationError" - } - } - }, "CommunicationIdentity": { "description": "A communication identity.", "required": [