Skip to content

Commit

Permalink
Added mapped property support
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Apr 2, 2022
1 parent fb15313 commit cc84847
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 47 deletions.
2 changes: 1 addition & 1 deletion fastybird_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
Metadata loader and validator and sets of useful enums
"""

__version__ = "0.49.0"
__version__ = "0.50.0"
1 change: 1 addition & 0 deletions fastybird_metadata/devices_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class PropertyType(ExtendedEnum):

DYNAMIC: str = "dynamic"
STATIC: str = "static"
MAPPED: str = "mapped"

# -----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name" : "@fastybird/metadata",
"version" : "0.49.0",
"version" : "0.50.0",
"description" : "FastyBird metadata reader & validator for modules, plugins & etc. used by FastyBird applications",
"keywords" : [
"fastybird",
Expand Down
1 change: 1 addition & 0 deletions public/lib/types/devices-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ButtonPayload, DataType, SwitchPayload } from '@/lib/types/types'
export enum PropertyType {
DYNAMIC = 'dynamic',
STATIC = 'static',
MAPPED = 'mapped',
}

export enum ConnectionState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
"type" : "string",
"enum" : [
"static",
"dynamic"
"dynamic",
"mapped"
]
},
"datatype" : {
Expand Down Expand Up @@ -233,29 +234,74 @@
]
},
"else" : {
"properties" : {
"value" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
},
"default" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
"if" : {
"properties" : {
"type" : {
"const" : "dynamic"
}
}
},
"required" : [
"id",
"type",
"identifier",
"settable",
"queryable",
"data_type",
"unit",
"format",
"invalid",
"number_of_decimals",
"value",
"default",
"channel",
"children"
]
"then" : {
"properties" : {
"value" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
},
"default" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
}
},
"required" : [
"id",
"type",
"identifier",
"settable",
"queryable",
"data_type",
"unit",
"format",
"invalid",
"number_of_decimals",
"value",
"default",
"channel",
"children"
]
},
"else" : {
"properties" : {
"actual_value" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
},
"previous_value" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
},
"expected_value" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
},
"pending" : {
"type" : "boolean"
},
"value" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
},
"default" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
}
},
"required" : [
"id",
"type",
"identifier",
"settable",
"queryable",
"data_type",
"unit",
"format",
"invalid",
"number_of_decimals",
"channel",
"children"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,28 +224,73 @@
]
},
"else" : {
"properties" : {
"value" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
},
"default" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
"if" : {
"properties" : {
"type" : {
"const" : "dynamic"
}
}
},
"required" : [
"id",
"type",
"identifier",
"settable",
"queryable",
"data_type",
"unit",
"format",
"invalid",
"number_of_decimals",
"value",
"default",
"connector"
]
"then" : {
"properties" : {
"value" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
},
"default" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
}
},
"required" : [
"id",
"type",
"identifier",
"settable",
"queryable",
"data_type",
"unit",
"format",
"invalid",
"number_of_decimals",
"value",
"default",
"connector"
]
},
"else" : {
"properties" : {
"actual_value" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
},
"previous_value" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
},
"expected_value" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
},
"pending" : {
"type" : "boolean"
},
"value" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
},
"default" : {
"$ref" : "#/definitions/types/string_number_boolean_null"
}
},
"required" : [
"id",
"type",
"identifier",
"settable",
"queryable",
"data_type",
"unit",
"format",
"invalid",
"number_of_decimals",
"channel",
"children"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
"type" : "string",
"enum" : [
"static",
"dynamic"
"dynamic",
"mapped"
]
},
"datatype" : {
Expand Down
1 change: 1 addition & 0 deletions src/Types/PropertyTypeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class PropertyTypeType extends Consistence\Enum\Enum
*/
public const TYPE_STATIC = 'static';
public const TYPE_DYNAMIC = 'dynamic';
public const TYPE_MAPPED = 'mapped';

/**
* @return string
Expand Down

0 comments on commit cc84847

Please sign in to comment.