Explicitly define enum type as string in schema

Many attribute in the request schema are defined with
allowed enum values. But schema does not specify those
enum as string type.

enum in json schema is defined in such a way that it
allows any type not just string so defining each enum type
as string explicitly makes schema more readable and consistent
with other API schema.

Note- this does not change any behavior or does not fix any issue.
This is just for consistency with other schema definition and readability.

Change-Id: I4f6fe5e418c624e0dcbcfb3b6bca64ab3e5c96fe
This commit is contained in:
ghanshyam 2017-04-13 01:58:02 +00:00
parent 3cc34c2aa3
commit 16032ceeca
3 changed files with 8 additions and 1 deletions

View File

@ -95,9 +95,11 @@ create_v26 = {
'type': 'object',
'properties': {
'protocol': {
'type': 'string',
'enum': ['vnc', 'spice', 'rdp', 'serial'],
},
'type': {
'type': 'string',
'enum': ['novnc', 'xvpvnc', 'rdp-html5',
'spice-html5', 'serial'],
},
@ -117,9 +119,11 @@ create_v28 = {
'type': 'object',
'properties': {
'protocol': {
'type': 'string',
'enum': ['vnc', 'spice', 'rdp', 'serial', 'mks'],
},
'type': {
'type': 'string',
'enum': ['novnc', 'xvpvnc', 'rdp-html5',
'spice-html5', 'serial', 'webmks'],
},

View File

@ -32,7 +32,9 @@ create = {
# probably change the type from array to string with a
# microversion at some point but it's very low priority.
'type': 'array',
'items': [{'enum': ['anti-affinity', 'affinity']}],
'items': [{
'type': 'string',
'enum': ['anti-affinity', 'affinity']}],
'uniqueItems': True,
'additionalItems': False,
}

View File

@ -236,6 +236,7 @@ reboot = {
'type': 'object',
'properties': {
'type': {
'type': 'string',
'enum': ['HARD', 'Hard', 'hard', 'SOFT', 'Soft', 'soft']
}
},