Add configuration to device schema

master
esensar 2018-09-20 00:23:22 +02:00
parent 3077e46dc5
commit 446778e445
3 changed files with 29 additions and 2 deletions

View File

@ -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):

View File

@ -17,5 +17,5 @@ responses:
- device
properties:
device:
$ref: '#/definitions/Device'
$ref: '#/definitions/DeviceWithConfig'

View File

@ -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: