From 348f499ff5eb361da3cc73a7fa250eabe17f9af4 Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Fri, 6 Jul 2018 16:44:41 +0100 Subject: [PATCH] Expand schema for error.codes to reflect reality Add '_' as a valid character in error.codes, because that's what's present in the wild. The schema is updated to include a pattern check, and one of the examples is changed to demonstrate the use of the new char. Change-Id: I6bcfd5d411b2b9c540546f92859647333114a8f8 --- guidelines/errors-example.json | 2 +- guidelines/errors-schema.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/guidelines/errors-example.json b/guidelines/errors-example.json index b88acfc..b9d2b8e 100644 --- a/guidelines/errors-example.json +++ b/guidelines/errors-example.json @@ -2,7 +2,7 @@ "errors": [ { "request_id": "1dc92f06-8ede-4fb4-8921-b507601fb59d", - "code": "orchestration.create-failed", + "code": "orchestration.create_failed", "status": 418, "title": "The Stack could not be created", "detail": "The Stack could not be created because of error(s) in other parts of the system.", diff --git a/guidelines/errors-schema.json b/guidelines/errors-schema.json index 48aba7a..370f63a 100644 --- a/guidelines/errors-schema.json +++ b/guidelines/errors-schema.json @@ -17,7 +17,8 @@ }, "code": { "type": "string", - "description": "A service-specific error code. The general form of the code is service-type.error-code. service-type MUST be the service type as defined by the service types authority at http://specs.openstack.org/openstack/service-types-authority. error-code is defined by service project team and MUST only consist of lowercase alpha, numeric, '.', and '-' characters." + "pattern": "^[a-z0-9._-]+$", + "description": "A service-specific error code. The general form of the code is service-type.error-code. service-type MUST be the service type as defined by the service types authority at http://specs.openstack.org/openstack/service-types-authority. error-code is defined by service project team and MUST only consist of lowercase alpha, numeric, '.', '_', and '-' characters." }, "status": { "type": "integer",