Add configuration to device schema
parent
3077e46dc5
commit
446778e445
|
@ -18,8 +18,13 @@ class DeviceSchema(Schema):
|
|||
device_type_id = fields.Integer(load_only=True, missing=1)
|
||||
|
||||
|
||||
class DeviceWithConfigurationSchema(DeviceSchema):
|
||||
configuration = fields.Raw(dump_only=True)
|
||||
|
||||
|
||||
class DeviceWrapperSchema(Schema):
|
||||
device = fields.Nested(DeviceSchema, required=True, location='json')
|
||||
device = fields.Nested(DeviceWithConfigurationSchema,
|
||||
required=True, location='json')
|
||||
|
||||
|
||||
class DevicesWrapperSchema(Schema):
|
||||
|
|
|
@ -17,5 +17,5 @@ responses:
|
|||
- device
|
||||
properties:
|
||||
device:
|
||||
$ref: '#/definitions/Device'
|
||||
$ref: '#/definitions/DeviceWithConfig'
|
||||
|
||||
|
|
|
@ -56,6 +56,11 @@ definitions:
|
|||
type: string
|
||||
description: Descriptive message
|
||||
|
||||
configuration:
|
||||
type: string
|
||||
description: Configuration
|
||||
default: {}
|
||||
|
||||
Credentials:
|
||||
type: object
|
||||
required:
|
||||
|
@ -122,6 +127,23 @@ definitions:
|
|||
device_type:
|
||||
$ref: '#/definitions/DeviceType'
|
||||
|
||||
DeviceWithConfig:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
- device_type
|
||||
- configuration
|
||||
properties:
|
||||
id:
|
||||
$ref: '#/definitions/id'
|
||||
name:
|
||||
$ref: '#/definitions/devicename'
|
||||
device_type:
|
||||
$ref: '#/definitions/DeviceType'
|
||||
configuration:
|
||||
$ref: '#/definitions/configuration'
|
||||
|
||||
DeviceCreation:
|
||||
type: object
|
||||
required:
|
||||
|
|
Loading…
Reference in New Issue