Merge "Implements resource attribute bool"
This commit is contained in:
commit
b4555a348b
|
@ -321,7 +321,8 @@
|
|||
"myid": {"type": "uuid"},
|
||||
"display_name": {"type": "string", "required": true},
|
||||
"prefix": {"type": "string", "required": false, "max_length": 8, "min_length": 3},
|
||||
"size": {"type": "number", "min": 5, "max": 32.8}
|
||||
"size": {"type": "number", "min": 5, "max": 32.8},
|
||||
"enabled": {"type": "bool", "required": false}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,3 +81,7 @@ class UUIDSchema(resource_type.UUIDSchema):
|
|||
|
||||
class NumberSchema(resource_type.NumberSchema):
|
||||
satype = sqlalchemy.Float(53)
|
||||
|
||||
|
||||
class BoolSchema(resource_type.BoolSchema):
|
||||
satype = sqlalchemy.Boolean
|
||||
|
|
|
@ -138,6 +138,11 @@ class NumberSchema(CommonAttributeSchema):
|
|||
return d
|
||||
|
||||
|
||||
class BoolSchema(CommonAttributeSchema):
|
||||
typename = "bool"
|
||||
schema_ext = bool
|
||||
|
||||
|
||||
class ResourceTypeAttributes(list):
|
||||
def jsonify(self):
|
||||
d = {}
|
||||
|
|
|
@ -77,6 +77,9 @@ tests:
|
|||
type: number
|
||||
required: false
|
||||
min: -2.3
|
||||
bool:
|
||||
type: bool
|
||||
required: false
|
||||
status: 201
|
||||
response_json_paths:
|
||||
$.name: my_custom_resource
|
||||
|
@ -104,6 +107,9 @@ tests:
|
|||
required: false
|
||||
min: -2.3
|
||||
max:
|
||||
bool:
|
||||
type: bool
|
||||
required: false
|
||||
|
||||
response_headers:
|
||||
location: $SCHEME://$NETLOC/v1/resource_type/my_custom_resource
|
||||
|
|
|
@ -87,6 +87,7 @@ gnocchi.indexer.sqlalchemy.resource_type_attribute =
|
|||
string = gnocchi.indexer.sqlalchemy_extension:StringSchema
|
||||
uuid = gnocchi.indexer.sqlalchemy_extension:UUIDSchema
|
||||
number = gnocchi.indexer.sqlalchemy_extension:NumberSchema
|
||||
bool = gnocchi.indexer.sqlalchemy_extension:BoolSchema
|
||||
|
||||
gnocchi.indexer.resources =
|
||||
generic = gnocchi.indexer.sqlalchemy_base:Resource
|
||||
|
|
Loading…
Reference in New Issue