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)
|
device_type_id = fields.Integer(load_only=True, missing=1)
|
||||||
|
|
||||||
|
|
||||||
|
class DeviceWithConfigurationSchema(DeviceSchema):
|
||||||
|
configuration = fields.Raw(dump_only=True)
|
||||||
|
|
||||||
|
|
||||||
class DeviceWrapperSchema(Schema):
|
class DeviceWrapperSchema(Schema):
|
||||||
device = fields.Nested(DeviceSchema, required=True, location='json')
|
device = fields.Nested(DeviceWithConfigurationSchema,
|
||||||
|
required=True, location='json')
|
||||||
|
|
||||||
|
|
||||||
class DevicesWrapperSchema(Schema):
|
class DevicesWrapperSchema(Schema):
|
||||||
|
|
|
@ -17,5 +17,5 @@ responses:
|
||||||
- device
|
- device
|
||||||
properties:
|
properties:
|
||||||
device:
|
device:
|
||||||
$ref: '#/definitions/Device'
|
$ref: '#/definitions/DeviceWithConfig'
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,11 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
description: Descriptive message
|
description: Descriptive message
|
||||||
|
|
||||||
|
configuration:
|
||||||
|
type: string
|
||||||
|
description: Configuration
|
||||||
|
default: {}
|
||||||
|
|
||||||
Credentials:
|
Credentials:
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
|
@ -122,6 +127,23 @@ definitions:
|
||||||
device_type:
|
device_type:
|
||||||
$ref: '#/definitions/DeviceType'
|
$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:
|
DeviceCreation:
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
|
|
Loading…
Reference in New Issue