From fd7a96f3d383d1e304b1ade1efa871fd23e4fca5 Mon Sep 17 00:00:00 2001 From: najian Date: Fri, 30 Sep 2022 10:11:56 +0800 Subject: [PATCH] fix live validation correctness WRITEONLY_PROPERTY_NOT_ALLOWED_IN_RESPONSEDaprSecretsCollection (#20843) Issue: ListSecrets action is intended to return secret, but the swagger used to define as write only model. Fix: new a readonly model for listSecrets response Co-authored-by: Nan Jiang --- .../2022-06-01-preview/CommonDefinitions.json | 19 ++++++++++++++- ...nvironmentsDaprComponents_ListSecrets.json | 6 +++-- .../stable/2022-03-01/DaprComponents.json | 23 ++++++++++++++++--- .../examples/DaprComponents_ListSecrets.json | 6 +++-- 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/specification/app/resource-manager/Microsoft.App/preview/2022-06-01-preview/CommonDefinitions.json b/specification/app/resource-manager/Microsoft.App/preview/2022-06-01-preview/CommonDefinitions.json index e5578818b9d3..ce5e1829c609 100644 --- a/specification/app/resource-manager/Microsoft.App/preview/2022-06-01-preview/CommonDefinitions.json +++ b/specification/app/resource-manager/Microsoft.App/preview/2022-06-01-preview/CommonDefinitions.json @@ -747,7 +747,7 @@ } }, "DaprSecretsCollection": { - "description": "Dapr component Secrets Collection ARM resource.", + "description": "Dapr component Secrets Collection for ListSecrets Action.", "required": [ "value" ], @@ -765,6 +765,23 @@ } } }, + "DaprSecret": { + "description": "Dapr component Secret for ListSecrets Action", + "type": "object", + "properties": { + "name": { + "description": "Secret Name.", + "type": "string", + "readOnly": true + }, + "value": { + "description": "Secret Value.", + "type": "string", + "x-ms-secret": true, + "readOnly": true + } + } + }, "ExtendedLocation": { "type": "object", "description": "The complex type of the extended location.", diff --git a/specification/app/resource-manager/Microsoft.App/preview/2022-06-01-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json b/specification/app/resource-manager/Microsoft.App/preview/2022-06-01-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json index 6af435646ced..78de527ad2ba 100644 --- a/specification/app/resource-manager/Microsoft.App/preview/2022-06-01-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json +++ b/specification/app/resource-manager/Microsoft.App/preview/2022-06-01-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json @@ -12,10 +12,12 @@ "body": { "value": [ { - "name": "secret1" + "name": "secret1", + "value": "value1" }, { - "name": "secret2" + "name": "secret2", + "value": "value2" } ] } diff --git a/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/DaprComponents.json b/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/DaprComponents.json index ecf44dc771a9..be08f3636ea0 100644 --- a/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/DaprComponents.json +++ b/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/DaprComponents.json @@ -388,23 +388,40 @@ } }, "DaprSecretsCollection": { - "description": "Dapr component Secrets Collection ARM resource.", + "description": "Dapr component Secrets Collection for ListSecrets Action", "required": [ "value" ], "type": "object", "properties": { "value": { - "description": "Collection of secrets used by a Dapr component", + "description": "Collection of secrets for ListSecrets Action", "type": "array", "items": { - "$ref": "./CommonDefinitions.json#/definitions/Secret" + "$ref": "#/definitions/DaprSecret" }, "x-ms-identifiers": [ "name" ] } } + }, + "DaprSecret": { + "description": "Dapr component Secret for ListSecrets Action", + "type": "object", + "properties": { + "name": { + "description": "Secret Name.", + "type": "string", + "readOnly": true + }, + "value": { + "description": "Secret Value.", + "type": "string", + "x-ms-secret": true, + "readOnly": true + } + } } }, "securityDefinitions": { diff --git a/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/DaprComponents_ListSecrets.json b/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/DaprComponents_ListSecrets.json index e6588ea518fd..d9253068a31c 100644 --- a/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/DaprComponents_ListSecrets.json +++ b/specification/app/resource-manager/Microsoft.App/stable/2022-03-01/examples/DaprComponents_ListSecrets.json @@ -12,10 +12,12 @@ "body": { "value": [ { - "name": "secret1" + "name": "secret1", + "value": "value1" }, { - "name": "secret2" + "name": "secret2", + "value": "value2" } ] }