v2 - "readOnly" key should be used in schemas
If it has a value of boolean true, this keyword indicates that the instance property SHOULD NOT be changed, and attempts by a user agent to modify the value of this property are expected to be rejected by a server. The value of this keyword MUST be a boolean. The default value is false. Further link for reference: http://json-schema.org/latest/json-schema-hypermedia.html#anchor15 Closes-Bug: #1521581 Depends-On: I279fba4099667d193609a31259057b897380d6f0 Change-Id: I96717506259c0d28500b8747369c47029b1dd9b6
This commit is contained in:
@@ -112,7 +112,8 @@ class TestUtils(testtools.TestCase):
|
||||
def schema_getter(_type='string', enum=False):
|
||||
prop = {
|
||||
'type': ['null', _type],
|
||||
'description': 'Test schema (READ-ONLY)',
|
||||
'readOnly': True,
|
||||
'description': 'Test schema',
|
||||
}
|
||||
|
||||
if enum:
|
||||
|
@@ -96,7 +96,8 @@ schema_fixture = {
|
||||
"type": "string"
|
||||
},
|
||||
"checksum": {
|
||||
"description": "md5 hash of image contents. (READ-ONLY)",
|
||||
"readOnly": True,
|
||||
"description": "md5 hash of image contents.",
|
||||
"maxLength": 32,
|
||||
"type": [
|
||||
"null",
|
||||
@@ -121,12 +122,14 @@ schema_fixture = {
|
||||
]
|
||||
},
|
||||
"created_at": {
|
||||
"description": "Date and time of image registration (READ-ONLY)",
|
||||
"readOnly": True,
|
||||
"description": "Date and time of image registration",
|
||||
"type": "string"
|
||||
},
|
||||
"direct_url": {
|
||||
"readOnly": True,
|
||||
"description": "URL to access the image file kept in external "
|
||||
"store (READ-ONLY)",
|
||||
"store",
|
||||
"type": "string"
|
||||
},
|
||||
"disk_format": {
|
||||
@@ -149,7 +152,8 @@ schema_fixture = {
|
||||
]
|
||||
},
|
||||
"file": {
|
||||
"description": "(READ-ONLY)",
|
||||
"readOnly": True,
|
||||
"description": "An image file url",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
@@ -253,22 +257,26 @@ schema_fixture = {
|
||||
]
|
||||
},
|
||||
"schema": {
|
||||
"description": "(READ-ONLY)",
|
||||
"readOnly": True,
|
||||
"description": "An image schema url",
|
||||
"type": "string"
|
||||
},
|
||||
"self": {
|
||||
"description": "(READ-ONLY)",
|
||||
"readOnly": True,
|
||||
"description": "An image self url",
|
||||
"type": "string"
|
||||
},
|
||||
"size": {
|
||||
"description": "Size of image file in bytes (READ-ONLY)",
|
||||
"readOnly": True,
|
||||
"description": "Size of image file in bytes",
|
||||
"type": [
|
||||
"null",
|
||||
"integer"
|
||||
]
|
||||
},
|
||||
"status": {
|
||||
"description": "Status of the image (READ-ONLY)",
|
||||
"readOnly": True,
|
||||
"description": "Status of the image",
|
||||
"enum": [
|
||||
"queued",
|
||||
"saving",
|
||||
@@ -288,12 +296,14 @@ schema_fixture = {
|
||||
"type": "array"
|
||||
},
|
||||
"updated_at": {
|
||||
"readOnly": True,
|
||||
"description": "Date and time of the last image "
|
||||
"modification (READ-ONLY)",
|
||||
"modification",
|
||||
"type": "string"
|
||||
},
|
||||
"virtual_size": {
|
||||
"description": "Virtual size of image in bytes (READ-ONLY)",
|
||||
"readOnly": True,
|
||||
"description": "Virtual size of image in bytes",
|
||||
"type": [
|
||||
"null",
|
||||
"integer"
|
||||
|
@@ -444,8 +444,9 @@ schema_fixtures = {
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string",
|
||||
"readOnly": True,
|
||||
"description": "Date and time of the last namespace "
|
||||
"modification (READ-ONLY)",
|
||||
"modification",
|
||||
"format": "date-time"
|
||||
},
|
||||
"visibility": {
|
||||
@@ -512,8 +513,8 @@ schema_fixtures = {
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"description": "Date and time of namespace creation "
|
||||
"(READ-ONLY)",
|
||||
"readOnly": True,
|
||||
"description": "Date and time of namespace creation ",
|
||||
"format": "date-time"
|
||||
},
|
||||
"namespace": {
|
||||
|
@@ -222,8 +222,8 @@ schema_fixtures = {
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"description": "Date and time of object creation "
|
||||
"(READ-ONLY)",
|
||||
"readOnly": True,
|
||||
"description": "Date and time of object creation ",
|
||||
"format": "date-time"
|
||||
},
|
||||
"description": {
|
||||
@@ -246,8 +246,9 @@ schema_fixtures = {
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string",
|
||||
"readOnly": True,
|
||||
"description": "Date and time of the last object "
|
||||
"modification (READ-ONLY)",
|
||||
"modification",
|
||||
"format": "date-time"
|
||||
},
|
||||
}
|
||||
|
@@ -127,15 +127,16 @@ schema_fixtures = {
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"readOnly": True,
|
||||
"description": "Date and time of resource type "
|
||||
"association (READ-ONLY)",
|
||||
"association",
|
||||
"format": "date-time"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string",
|
||||
"readOnly": True,
|
||||
"description": "Date and time of the last resource "
|
||||
"type association modification "
|
||||
"(READ-ONLY)",
|
||||
"type association modification ",
|
||||
"format": "date-time"
|
||||
},
|
||||
}
|
||||
|
@@ -111,14 +111,15 @@ schema_fixtures = {
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"description": ("Date and time of tag creation"
|
||||
" (READ-ONLY)"),
|
||||
"readOnly": True,
|
||||
"description": ("Date and time of tag creation"),
|
||||
"format": "date-time"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string",
|
||||
"readOnly": True,
|
||||
"description": ("Date and time of the last tag"
|
||||
" modification (READ-ONLY)"),
|
||||
" modification"),
|
||||
"format": "date-time"
|
||||
},
|
||||
'properties': {}
|
||||
|
@@ -86,7 +86,8 @@ _BASE_SCHEMA = {
|
||||
},
|
||||
"file": {
|
||||
"type": "string",
|
||||
"description": "(READ-ONLY)"
|
||||
"readOnly": True,
|
||||
"description": ("An image file url")
|
||||
},
|
||||
"owner": {
|
||||
"type": "string",
|
||||
@@ -102,7 +103,8 @@ _BASE_SCHEMA = {
|
||||
},
|
||||
"size": {
|
||||
"type": "integer",
|
||||
"description": "Size of image file in bytes (READ-ONLY)"
|
||||
"readOnly": True,
|
||||
"description": "Size of image file in bytes"
|
||||
},
|
||||
"os_distro": {
|
||||
"type": "string",
|
||||
@@ -111,7 +113,8 @@ _BASE_SCHEMA = {
|
||||
},
|
||||
"self": {
|
||||
"type": "string",
|
||||
"description": "(READ-ONLY)"
|
||||
"readOnly": True,
|
||||
"description": ("An image self url")
|
||||
},
|
||||
"disk_format": {
|
||||
"enum": [
|
||||
@@ -135,12 +138,14 @@ _BASE_SCHEMA = {
|
||||
},
|
||||
"direct_url": {
|
||||
"type": "string",
|
||||
"readOnly": True,
|
||||
"description": ("URL to access the image file kept in "
|
||||
"external store (READ-ONLY)")
|
||||
"external store")
|
||||
},
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"description": "(READ-ONLY)"
|
||||
"readOnly": True,
|
||||
"description": ("An image schema url")
|
||||
},
|
||||
"status": {
|
||||
"enum": [
|
||||
@@ -152,7 +157,8 @@ _BASE_SCHEMA = {
|
||||
"pending_delete"
|
||||
],
|
||||
"type": "string",
|
||||
"description": "Status of the image (READ-ONLY)"
|
||||
"readOnly": True,
|
||||
"description": "Status of the image"
|
||||
},
|
||||
"tags": {
|
||||
"items": {
|
||||
@@ -181,8 +187,9 @@ _BASE_SCHEMA = {
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string",
|
||||
"readOnly": True,
|
||||
"description": ("Date and time of the last "
|
||||
"image modification (READ-ONLY)")
|
||||
"image modification")
|
||||
},
|
||||
"min_disk": {
|
||||
"type": "integer",
|
||||
@@ -191,7 +198,8 @@ _BASE_SCHEMA = {
|
||||
},
|
||||
"virtual_size": {
|
||||
"type": "integer",
|
||||
"description": "Virtual size of image in bytes (READ-ONLY)"
|
||||
"readOnly": True,
|
||||
"description": "Virtual size of image in bytes"
|
||||
},
|
||||
"instance_uuid": {
|
||||
"type": "string",
|
||||
@@ -207,12 +215,14 @@ _BASE_SCHEMA = {
|
||||
},
|
||||
"checksum": {
|
||||
"type": "string",
|
||||
"description": "md5 hash of image contents. (READ-ONLY)",
|
||||
"readOnly": True,
|
||||
"description": "md5 hash of image contents.",
|
||||
"maxLength": 32
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"description": "Date and time of image registration (READ-ONLY)"
|
||||
"readOnly": True,
|
||||
"description": "Date and time of image registration "
|
||||
},
|
||||
"protected": {
|
||||
"type": "boolean",
|
||||
|
Reference in New Issue
Block a user