1# from issue https://github.com/geany/geany/issues/612 2 3import colander 4 5class DeviceSchema(colander.MappingSchema): 6 resourceType = colander.SchemaNode( 7 colander.String(), 8 description='ResourceType informs the parser which resource type this is', 9 missing='Device', 10 default='Device', 11 validator=colander.Function(lambda x: x == 'Device', msg="resourceType can't be changed") 12 ) 13 identifier = colander.SchemaNode( 14 colander.String(), 15 description='Instance id from manufacturer, owner and others', 16 missing=colander.drop, 17 default=colander.drop, 18 ) 19 type = colander.SchemaNode( 20 colander.String(), 21 description="What kind of device this is", 22 missing=colander.required, 23 ) 24 manufacturer = colander.SchemaNode( 25 colander.String(), 26 description='Name of device manufacturer', 27 missing=colander.drop, 28 ) 29