UNPKG

@microsoft.azure/autorest.testserver

Version:
161 lines (160 loc) 4.57 kB
{ "swagger": "2.0", "info": { "title": "Error with Secrets", "description": "Tests whether loggers/tracers redact secrets and PII within error responses.", "version": "1.0.0" }, "host": "localhost:3000", "schemes": ["http"], "produces": ["application/json"], "securityDefinitions": { "SharedKey": { "type": "apiKey", "name": "Authorization", "in": "header" } }, "paths": { "/secrets/:create": { "post": { "operationId": "CreateSecret", "description": "Creates a secret.", "security": [ { "SharedKey": [] } ], "responses": { "200": { "description": "This method will always return an error.", "schema": { "$ref": "#/definitions/SecretResponse" } }, "default": { "description": "An error occurred.", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } }, "/secrets/error": { "get": { "operationId": "GetErrorWithSecrets", "description": "Gets an error response containing secrets and PII.", "responses": { "204": { "description": "This method will always return an error." }, "default": { "description": "An error occurred.", "schema": { "$ref": "#/definitions/ErrorResponse" } } } } } }, "definitions": { "SecretResponse": { "type": "object", "description": "A secret.", "required": ["key", "value"], "properties": { "key": { "type": "string", "description": "The secret key." }, "value": { "type": "string", "description": "The secret value." } } }, "ErrorResponse": { "type": "object", "description": "Error response.", "additionalProperties": true, "required": ["error"], "properties": { "error": { "description": "The error object.", "$ref": "#/definitions/Error" } } }, "Error": { "type": "object", "description": "The error object.", "additionalProperties": true, "required": ["code", "message"], "properties": { "code": { "description": "One of a server-defined set of error codes.", "$ref": "#/definitions/ErrorCode" }, "message": { "type": "string", "description": "A human-readable representation of the error." }, "target": { "type": "string", "description": "The target of the error." }, "details": { "type": "array", "description": "An array of details about specific errors that led to this reported error.", "items": { "$ref": "#/definitions/Error" } }, "innererror": { "description": "An object containing more specific information than the current object about the error.", "$ref": "#/definitions/InnerError" } } }, "InnerError": { "type": "object", "description": "An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", "additionalProperties": true, "required": ["code", "message"], "properties": { "code": { "description": "One of a server-defined set of error codes.", "$ref": "#/definitions/InnerErrorCode" }, "message": { "type": "string", "description": "Error message." }, "innererror": { "description": "An object containing more specific information than the current object about the error.", "$ref": "#/definitions/InnerError" } } }, "ErrorCode": { "type": "string", "description": "Human-readable error code.", "x-ms-enum": { "name": "ErrorCode", "modelAsString": true }, "enum": ["BadParameter", "Unauthorized"] }, "InnerErrorCode": { "type": "string", "description": "Human-readable error code.", "x-ms-enum": { "name": "InnerErrorCode", "modelAsString": true }, "enum": ["MissingSharedKey", "UnauthorizedSharedKey"] } } }