Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Replace JSON schema generator (#2081)

Koen5f57a76ec7c9
diff --git a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorAgentLink.java b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorAgentLink.java
index 8c8d37926..2975714e3 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorAgentLink.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorAgentLink.java
@@ -19,17 +19,10 @@
*/
package org.openremote.agent.protocol.simulator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
-import net.fortuna.ical4j.model.Recur;
import org.openremote.model.asset.agent.AgentLink;
-import org.openremote.model.calendar.CalendarEvent;
import org.openremote.model.simulator.SimulatorReplayDatapoint;
-import java.time.*;
-import java.time.chrono.ChronoLocalDateTime;
-import java.util.Date;
-import java.util.List;
import java.util.Optional;
public class SimulatorAgentLink extends AgentLink<SimulatorAgentLink> {
@@ -41,7 +34,6 @@ public class SimulatorAgentLink extends AgentLink<SimulatorAgentLink> {
protected SimulatorReplayDatapoint[] replayData;
// TODO: consider implementing @JsonSchemaFormat("calendar-event") to reuse the `or-rule-validity` component.
- // Current generator cannot handle injecting custom type and description at the same time
@JsonPropertyDescription("When defined overwrites the possible dataset length and when it is replayed." +
" This could be once when only a start- (and end) date are defined," +
" or a recurring event following the RFC 5545 RRULE format." +
diff --git a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java
index d0b4e0ec5..c7c3cf3e8 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java
@@ -25,8 +25,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.util.StdConverter;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaFormat;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaInject;
import net.fortuna.ical4j.model.Recur;
import org.openremote.agent.protocol.AbstractProtocol;
import org.openremote.model.Container;
@@ -38,6 +36,7 @@ import org.openremote.model.datapoint.ValueDatapoint;
import org.openremote.model.simulator.SimulatorReplayDatapoint;
import org.openremote.model.syslog.SyslogCategory;
import org.openremote.model.util.JSONSchemaUtil;
+import org.openremote.model.util.JSONSchemaUtil.*;
import org.openremote.model.value.AbstractNameValueHolder;
import java.io.Serializable;
@@ -276,16 +275,16 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulato
@JsonPropertyDescription("Set a start date, if not provided, starts immediately." +
" When the replay datapoint timestamp is 0 it will insert it at 00:00.")
@JsonSchemaFormat("date-time")
- @JsonSchemaInject(jsonSupplierViaLookup = JSONSchemaUtil.SCHEMA_SUPPLIER_NAME_STRING_TYPE)
+ @JsonSchemaTypeRemap(type = String.class)
protected Date start;
@JsonPropertyDescription("Not implemented, within the recurrence rule you can specify an end date.")
@JsonSchemaFormat("date-time")
- @JsonSchemaInject(jsonSupplierViaLookup = JSONSchemaUtil.SCHEMA_SUPPLIER_NAME_STRING_TYPE)
+ @JsonSchemaTypeRemap(type = String.class)
protected Date end;
@JsonPropertyDescription("The recurrence schedule follows the RFC 5545 RRULE format.")
- @JsonSchemaInject(merge = false, jsonSupplierViaLookup = JSONSchemaUtil.SCHEMA_SUPPLIER_NAME_STRING_TYPE)
+ @JsonSchemaTypeRemap(type = String.class)
@JsonSerialize(converter = RecurStringConverter.class)
protected Recur<LocalDateTime> recurrence;
diff --git a/gradle.properties b/gradle.properties
index 01014f29d..aca8fc6d2 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -69,3 +69,4 @@ micrometerVersion=1.15.3
jdomVersion = 2.0.6.1
jSchVersion = 2.27.2
bouncyCastleVersion = 1.81
+victoolsJsonSchemaGeneratorVersion = 4.38.0
diff --git a/model/build.gradle b/model/build.gradle
index b6d03ef26..93dc4c467 100644
--- a/model/build.gradle
+++ b/model/build.gradle
@@ -31,10 +31,10 @@ dependencies {
api "io.swagger.core.v3:swagger-annotations:$swaggerVersion"
- // Custom build until PR is merged from https://github.com/richturner/mbknor-jackson-jsonSchema
- api "com.github.richturner:mbknor-jackson-jsonschema:1.0.40-JAKARTA"
- //api "com.kjetland:mbknor-jackson-jsonschema_2.12:1.0.39"
- api "org.scala-lang:scala-library:2.12.10"
+ api "com.github.victools:jsonschema-generator:$victoolsJsonSchemaGeneratorVersion"
+ api "com.github.victools:jsonschema-module-jackson:$victoolsJsonSchemaGeneratorVersion"
+ api "com.github.victools:jsonschema-module-jakarta-validation:$victoolsJsonSchemaGeneratorVersion"
+
api "io.github.classgraph:classgraph:$classgraphVersion"
api "io.micrometer:micrometer-core:$micrometerVersion"
api "com.devskiller.friendly-id:friendly-id:$friendlyIdVersion"
@@ -43,6 +43,8 @@ dependencies {
api "fr.neolegal:exp4j:$exp4jVersion"
dependencies {
+ testImplementation 'org.skyscreamer:jsonassert:1.5.3'
+ testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.13.4'
testImplementation 'org.mockito:mockito-core:5.19.0'
testRuntimeOnly 'org.glassfish:jakarta.el:4.0.2'
diff --git a/model/libs/mbknor-jackson-jsonschema_2.12-1.0.40-SNAPSHOT.jar b/model/libs/mbknor-jackson-jsonschema_2.12-1.0.40-SNAPSHOT.jar
deleted file mode 100644
index 354f8a582..000000000
Binary files a/model/libs/mbknor-jackson-jsonschema_2.12-1.0.40-SNAPSHOT.jar and /dev/null differ
diff --git a/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java b/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java
index d238b2486..9ed30ad80 100644
--- a/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java
+++ b/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java
@@ -19,14 +19,11 @@
*/
package org.openremote.model.asset.agent;
-import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaFormat;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaInject;
import org.openremote.model.attribute.Attribute;
import org.openremote.model.query.filter.ValuePredicate;
-import org.openremote.model.util.JSONSchemaUtil;
+import org.openremote.model.util.JSONSchemaUtil.*;
import org.openremote.model.util.TsIgnoreTypeParams;
import org.openremote.model.util.ValueUtil;
import org.openremote.model.value.ValueFilter;
@@ -46,31 +43,31 @@ public abstract class AgentLink<T extends AgentLink<?>> implements Serializable
@JsonSchemaFormat("or-agent-id")
protected String id;
- @JsonPropertyDescription("Defines ValueFilters to apply to an incoming value before it is written to a" +
+ @JsonSchemaDescription("Defines ValueFilters to apply to an incoming value before it is written to a" +
" protocol linked attribute; this is particularly useful for generic protocols. The message should pass through" +
" the filters in array order")
protected ValueFilter[] valueFilters;
- @JsonPropertyDescription("Defines a value converter map to allow for basic value type conversion; the incoming value" +
+ @JsonSchemaDescription("Defines a value converter map to allow for basic value type conversion; the incoming value" +
" will be converted to JSON and if this string matches a key in the converter then the value of that key will be" +
" pushed through to the attribute. An example use case is an API that returns 'ACTIVE'/'DISABLED' strings but" +
" you want to connect this to a Boolean attribute")
- @JsonSchemaInject(merge = false, jsonSupplierViaLookup = JSONSchemaUtil.SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_ANY_KEY_ANY_TYPE)
+ @JsonSchemaSupplier(supplier = SchemaNodeMapper.SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_ANY_KEY_ANY_TYPE)
protected Map<String, Object> valueConverter;
- @JsonSchemaInject(merge = false, jsonSupplierViaLookup = JSONSchemaUtil.SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_ANY_KEY_ANY_TYPE)
- @JsonPropertyDescription("Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion")
+ @JsonSchemaDescription("Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion")
+ @JsonSchemaSupplier(supplier = SchemaNodeMapper.SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_ANY_KEY_ANY_TYPE)
protected Map<String, Object> writeValueConverter;
- @JsonPropertyDescription("String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic" +
+ @JsonSchemaDescription("String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic" +
" value and/or time injection with formatting (see documentation for details) into the string or alternatively" +
" write the string through to the protocol as is (static string)")
@JsonSchemaFormat("or-multiline")
protected String writeValue;
- @JsonPropertyDescription("The predicate to apply to incoming messages to determine if the message is intended for the" +
+ @JsonSchemaDescription("The predicate to apply to incoming messages to determine if the message is intended for the" +
" linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to" +
" enable attributes to be updated by the linked agent.")
protected ValuePredicate messageMatchPredicate;
- @JsonPropertyDescription("ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate")
+ @JsonSchemaDescription("ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate")
protected ValueFilter[] messageMatchFilters;
- @JsonPropertyDescription("Don't expect a response from the protocol just update the attribute immediately on write")
+ @JsonSchemaDescription("Don't expect a response from the protocol just update the attribute immediately on write")
protected Boolean updateOnWrite;
// For Hydrators
diff --git a/model/src/main/java/org/openremote/model/calendar/CalendarEvent.java b/model/src/main/java/org/openremote/model/calendar/CalendarEvent.java
index 99c21254e..9acf0d6ed 100644
--- a/model/src/main/java/org/openremote/model/calendar/CalendarEvent.java
+++ b/model/src/main/java/org/openremote/model/calendar/CalendarEvent.java
@@ -21,15 +21,10 @@ package org.openremote.model.calendar;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.fasterxml.jackson.databind.util.StdConverter;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaFormat;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaInject;
import net.fortuna.ical4j.model.Recur;
import org.openremote.model.asset.Asset;
-import org.openremote.model.util.JSONSchemaUtil;
import org.openremote.model.util.Pair;
import java.io.Serializable;
diff --git a/model/src/main/java/org/openremote/model/query/filter/ArrayPredicate.java b/model/src/main/java/org/openremote/model/query/filter/ArrayPredicate.java
index 8634f6f43..3be8e8bbb 100644
--- a/model/src/main/java/org/openremote/model/query/filter/ArrayPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/ArrayPredicate.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
+import org.openremote.model.util.JSONSchemaUtil.*;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.openremote.model.util.ValueUtil;
diff --git a/model/src/main/java/org/openremote/model/query/filter/BooleanPredicate.java b/model/src/main/java/org/openremote/model/query/filter/BooleanPredicate.java
index 69f2fd951..1b1a6da97 100644
--- a/model/src/main/java/org/openremote/model/query/filter/BooleanPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/BooleanPredicate.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
+import org.openremote.model.util.JSONSchemaUtil.*;
import org.openremote.model.util.ValueUtil;
import java.util.function.Predicate;
diff --git a/model/src/main/java/org/openremote/model/query/filter/CalendarEventPredicate.java b/model/src/main/java/org/openremote/model/query/filter/CalendarEventPredicate.java
index b921aece6..ee53a44bc 100644
--- a/model/src/main/java/org/openremote/model/query/filter/CalendarEventPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/CalendarEventPredicate.java
@@ -19,10 +19,9 @@
*/
package org.openremote.model.query.filter;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
+import org.openremote.model.util.JSONSchemaUtil.*;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
import org.openremote.model.calendar.CalendarEvent;
import org.openremote.model.util.Pair;
import org.openremote.model.util.ValueUtil;
diff --git a/model/src/main/java/org/openremote/model/query/filter/DateTimePredicate.java b/model/src/main/java/org/openremote/model/query/filter/DateTimePredicate.java
index b8914f983..71a38dda7 100644
--- a/model/src/main/java/org/openremote/model/query/filter/DateTimePredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/DateTimePredicate.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
+import org.openremote.model.util.JSONSchemaUtil.*;
import org.openremote.model.query.AssetQuery;
import org.openremote.model.util.Pair;
import org.openremote.model.util.TimeUtil;
diff --git a/model/src/main/java/org/openremote/model/query/filter/NumberPredicate.java b/model/src/main/java/org/openremote/model/query/filter/NumberPredicate.java
index 9bcb7b1ed..760a57a20 100644
--- a/model/src/main/java/org/openremote/model/query/filter/NumberPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/NumberPredicate.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
+import org.openremote.model.util.JSONSchemaUtil.*;
import org.openremote.model.query.AssetQuery;
import org.openremote.model.util.NumberComparator;
import org.openremote.model.util.ValueUtil;
diff --git a/model/src/main/java/org/openremote/model/query/filter/RadialGeofencePredicate.java b/model/src/main/java/org/openremote/model/query/filter/RadialGeofencePredicate.java
index bcdb0885e..e6f1c03ba 100644
--- a/model/src/main/java/org/openremote/model/query/filter/RadialGeofencePredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/RadialGeofencePredicate.java
@@ -19,10 +19,9 @@
*/
package org.openremote.model.query.filter;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
+import org.openremote.model.util.JSONSchemaUtil.*;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
import org.locationtech.jts.geom.Coordinate;
import org.geotools.referencing.GeodeticCalculator;
import org.openremote.model.geo.GeoJSONPoint;
diff --git a/model/src/main/java/org/openremote/model/query/filter/RectangularGeofencePredicate.java b/model/src/main/java/org/openremote/model/query/filter/RectangularGeofencePredicate.java
index 5cc0db0f4..d3625825a 100644
--- a/model/src/main/java/org/openremote/model/query/filter/RectangularGeofencePredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/RectangularGeofencePredicate.java
@@ -21,8 +21,7 @@ package org.openremote.model.query.filter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
+import org.openremote.model.util.JSONSchemaUtil.*;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Envelope;
import org.openremote.model.geo.GeoJSONPoint;
diff --git a/model/src/main/java/org/openremote/model/query/filter/StringPredicate.java b/model/src/main/java/org/openremote/model/query/filter/StringPredicate.java
index 8884d5f24..e9eb4f74e 100644
--- a/model/src/main/java/org/openremote/model/query/filter/StringPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/StringPredicate.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
+import org.openremote.model.util.JSONSchemaUtil.*;
import org.openremote.model.query.AssetQuery;
import org.openremote.model.util.ValueUtil;
import org.openremote.model.value.NameHolder;
diff --git a/model/src/main/java/org/openremote/model/query/filter/ValueAnyPredicate.java b/model/src/main/java/org/openremote/model/query/filter/ValueAnyPredicate.java
index 40717cdea..ec599403b 100644
--- a/model/src/main/java/org/openremote/model/query/filter/ValueAnyPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/ValueAnyPredicate.java
@@ -19,8 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
+import org.openremote.model.util.JSONSchemaUtil.*;
import java.util.function.Predicate;
import java.util.function.Supplier;
diff --git a/model/src/main/java/org/openremote/model/query/filter/ValueEmptyPredicate.java b/model/src/main/java/org/openremote/model/query/filter/ValueEmptyPredicate.java
index 0a866d76e..7e91eec71 100644
--- a/model/src/main/java/org/openremote/model/query/filter/ValueEmptyPredicate.java
+++ b/model/src/main/java/org/openremote/model/query/filter/ValueEmptyPredicate.java
@@ -19,8 +19,7 @@
*/
package org.openremote.model.query.filter;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
+import org.openremote.model.util.JSONSchemaUtil.*;
import java.util.Objects;
import java.util.function.Predicate;
diff --git a/model/src/main/java/org/openremote/model/simulator/SimulatorReplayDatapoint.java b/model/src/main/java/org/openremote/model/simulator/SimulatorReplayDatapoint.java
index b5639d6d5..789d8a91a 100644
--- a/model/src/main/java/org/openremote/model/simulator/SimulatorReplayDatapoint.java
+++ b/model/src/main/java/org/openremote/model/simulator/SimulatorReplayDatapoint.java
@@ -19,7 +19,7 @@
*/
package org.openremote.model.simulator;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
+import org.openremote.model.util.JSONSchemaUtil.JsonSchemaTitle;
import org.openremote.model.datapoint.ValueDatapoint;
import java.io.Serializable;
diff --git a/model/src/main/java/org/openremote/model/util/JSONSchemaUtil.java b/model/src/main/java/org/openremote/model/util/JSONSchemaUtil.java
index 4bb537fc2..502c98f01 100644
--- a/model/src/main/java/org/openremote/model/util/JSONSchemaUtil.java
+++ b/model/src/main/java/org/openremote/model/util/JSONSchemaUtil.java
@@ -20,118 +20,640 @@
package org.openremote.model.util;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.fasterxml.jackson.databind.node.TextNode;
-import com.kjetland.jackson.jsonSchema.JsonSchemaConfig;
-import com.kjetland.jackson.jsonSchema.JsonSchemaDraft;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaInject;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Optional;
+import com.fasterxml.classmate.ResolvedType;
+import com.fasterxml.jackson.annotation.*;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.*;
+import com.fasterxml.jackson.databind.jsonFormatVisitors.*;
+import com.fasterxml.jackson.databind.node.*;
+import com.github.victools.jsonschema.generator.*;
+import com.github.victools.jsonschema.generator.Module;
+import com.github.victools.jsonschema.generator.impl.DefinitionKey;
+import com.github.victools.jsonschema.generator.impl.module.SimpleTypeModule;
+import com.github.victools.jsonschema.generator.naming.DefaultSchemaDefinitionNamingStrategy;
+import com.github.victools.jsonschema.module.jackson.JacksonModule;
+import com.github.victools.jsonschema.module.jackson.JacksonOption;
+import com.github.victools.jsonschema.module.jackson.JsonSubTypesResolver;
+import com.github.victools.jsonschema.module.jakarta.validation.JakartaValidationModule;
+import com.github.victools.jsonschema.module.jakarta.validation.JakartaValidationOption;
+import org.reflections.Reflections;
+
+import java.lang.annotation.*;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
public class JSONSchemaUtil {
- @JsonSchemaInject(jsonSupplierViaLookup = JSONSchemaUtil.SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_ANY_KEY_ANY_TYPE)
- static class PatternPropertiesAnyKeyAnyType {}
- @JsonSchemaInject(jsonSupplierViaLookup = JSONSchemaUtil.SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_SIMPLE_KEY_ANY_TYPE)
- static class PatternPropertiesSimpleKeyAnyType {}
- @JsonSchemaInject(jsonSupplierViaLookup = JSONSchemaUtil.SCHEMA_SUPPLIER_NAME_ANY_TYPE)
- static class AnyType {}
- @JsonSchemaInject(jsonSupplierViaLookup = JSONSchemaUtil.SCHEMA_SUPPLIER_NAME_STRING_TYPE)
- static class StringType {}
-
- private JSONSchemaUtil() {}
-
- public static final String SCHEMA_SUPPLIER_NAME_ANY_TYPE = "anyType";
- public static final String SCHEMA_SUPPLIER_NAME_STRING_TYPE = "stringType";
- public static final String SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_ANY_KEY_ANY_TYPE = "patternPropertiesAnyKeyAnyType";
- public static final String SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_SIMPLE_KEY_ANY_TYPE = "patternPropertiesSimpleKeyAnyType";
- public static final String PATTERN_PROPERTIES_MATCH_ANY = ".+";
- public static final String PATTERN_PROPERTIES_MATCH_SIMPLE = "^[a-zA-Z][a-zA-Z0-9]*";
- public static final String TYPE_NULL = "null";
- public static final String TYPE_NUMBER = "number";
- public static final String TYPE_INTEGER = "integer";
- public static final String TYPE_BOOLEAN = "boolean";
- public static final String TYPE_STRING = "string";
- public static final String TYPE_ARRAY = "array";
- public static final String TYPE_OBJECT = "object";
- public static final String[] TYPES_ALL = new String[]{
- TYPE_NULL,
- TYPE_NUMBER,
- TYPE_INTEGER,
- TYPE_BOOLEAN,
- TYPE_STRING,
- TYPE_ARRAY,
- TYPE_OBJECT
- };
-
- public static JsonNode getSchemaPatternPropertiesAnyKeyAnyType() {
- return getSchemaPatternProperties(PATTERN_PROPERTIES_MATCH_ANY, TYPES_ALL);
+ public static class SchemaNodeMapper {
+
+ public static class AnyType {}
+
+ public static final String SCHEMA_SUPPLIER_NAME_ANY_TYPE = "anyType";
+ public static final String SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_ANY_KEY_ANY_TYPE = "patternPropertiesAnyKeyAnyType";
+ public static final String SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_SIMPLE_KEY_ANY_TYPE = "patternPropertiesSimpleKeyAnyType";
+ public static final String PATTERN_PROPERTIES_MATCH_ANY = ".+";
+ public static final String PATTERN_PROPERTIES_MATCH_SIMPLE = "^[a-zA-Z][a-zA-Z0-9]*";
+ public static final String TYPE_NULL = "null";
+ public static final String TYPE_NUMBER = "number";
+ public static final String TYPE_INTEGER = "integer";
+ public static final String TYPE_BOOLEAN = "boolean";
+ public static final String TYPE_STRING = "string";
+ public static final String TYPE_ARRAY = "array";
+ public static final String TYPE_OBJECT = "object";
+ public static final String[] TYPES_ALL = new String[]{
+ TYPE_NULL,
+ TYPE_NUMBER,
+ TYPE_INTEGER,
+ TYPE_BOOLEAN,
+ TYPE_STRING,
+ TYPE_ARRAY,
+ TYPE_OBJECT
+ };
+
+ private static final JsonNodeFactory NF = JsonNodeFactory.instance;
+
+ public static ObjectNode getSchemaPatternProperties(String keyPattern, String... types) {
+ ObjectNode node = NF.objectNode();
+ node.put("type", "object");
+ ObjectNode patternNode = node.putObject("patternProperties").putObject(keyPattern);
+ patternNode.set("type", getTypesNode(Arrays.asList(types)));
+ return node;
+ }
+
+ public static ObjectNode getSchemaPatternPropertiesAnyKeyAnyType() {
+ return getSchemaPatternProperties(PATTERN_PROPERTIES_MATCH_ANY, TYPES_ALL);
+ }
+
+ public static ObjectNode getSchemaPatternPropertiesSimpleKeyAnyType() {
+ return getSchemaPatternProperties(PATTERN_PROPERTIES_MATCH_SIMPLE, TYPES_ALL);
+ }
+
+ public static JsonNode getTypesNode(List<String> types) {
+ if (types.size() == 1) {
+ return NF.textNode(types.getFirst());
+ }
+ ArrayNode arr = NF.arrayNode();
+ types.forEach(arr::add);
+ return arr;
+ }
+
+ public static ObjectNode getSchemaType(String... types) {
+ ObjectNode node = NF.objectNode();
+ node.put("title", "Any Type");
+ node.set("type", getTypesNode(Arrays.asList(types)));
+ node.put("additionalProperties", true);
+ return node;
+ }
+
+ public static ObjectNode getSuppliedNode(FieldScope fieldScope, JsonSchemaSupplier annotation) throws RuntimeException {
+ try {
+ switch (annotation.getClass().getMethod("supplier").invoke(annotation).toString()) {
+ case SchemaNodeMapper.SCHEMA_SUPPLIER_NAME_ANY_TYPE:
+ return SchemaNodeMapper.getSchemaType(SchemaNodeMapper.TYPES_ALL);
+ case SchemaNodeMapper.SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_ANY_KEY_ANY_TYPE:
+ return SchemaNodeMapper.getSchemaPatternPropertiesAnyKeyAnyType();
+ case SchemaNodeMapper.SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_SIMPLE_KEY_ANY_TYPE:
+ return SchemaNodeMapper.getSchemaPatternPropertiesSimpleKeyAnyType();
+ }
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to apply " + annotation.getClass().getSimpleName(), e);
+ }
+ return null;
+ }
+ }
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE, ElementType.FIELD})
+ public @interface JsonSchemaTitle {
+ String keyword() default "title";
+ String value();
+ /* Whether to put the title on the root of the schema even when the class is wrapped in an array. */
+ boolean container() default true;
+ }
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE, ElementType.FIELD})
+ public @interface JsonSchemaDescription {
+ String keyword() default "description";
+ String value();
+ boolean container() default true;
}
- public static JsonNode getSchemaPatternPropertiesSimpleKeyAnyType() {
- return getSchemaPatternProperties(PATTERN_PROPERTIES_MATCH_SIMPLE, TYPES_ALL);
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE, ElementType.FIELD})
+ public @interface JsonSchemaFormat {
+ String keyword() default "format";
+ String value();
+ boolean container() default true;
}
- public static JsonNode getSchemaPatternPropertiesAnyType(String keyPattern) {
- return getSchemaPatternProperties(keyPattern, TYPES_ALL);
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE, ElementType.FIELD})
+ public @interface JsonSchemaDefault {
+ String keyword() default "default";
+ String value();
+ boolean container() default true;
}
- public static JsonNode getSchemaPatternProperties(String keyPattern, String...types) {
- ObjectNode node = ValueUtil.JSON.createObjectNode();
- node.put("type", "object");
- ObjectNode patternNode = node.putObject("patternProperties").putObject(keyPattern);
- patternNode.set("type", getSchemaType(false, types));
- return node;
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE, ElementType.FIELD})
+ public @interface JsonSchemaExamples {
+ String keyword() default "examples";
+ String[] value();
+ boolean container() default true;
}
- public static JsonNode getSchemaType(boolean wrapped, String...types) {
- JsonNode typesNode;
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE, ElementType.FIELD})
+ public @interface JsonSchemaTypeRemap {
+ Class<?> type();
+ }
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.TYPE, ElementType.FIELD})
+ public @interface JsonSchemaSupplier {
+ String supplier();
+ }
+
+ private static void setFormat(ObjectNode node, String format) {
+ node.put("format", format);
+ }
+
+ public static class CustomModule implements Module {
+
+ private final JacksonResolvers jacksonResolvers = new JacksonResolvers();
+ private static final ConcurrentHashMap<Class<?>, List<ResolvedType>> subtypeCache = new ConcurrentHashMap<>();
+ private static final Reflections reflections = new Reflections("org.openremote");
+
+ @Override
+ public void applyToConfigBuilder(SchemaGeneratorConfigBuilder builder) {
+ // Set title on root of schema
+ // TODO: resolve titles for all custom types
+ JSONSchemaTitleProvider titleProvider = new JSONSchemaTitleProvider();
+ builder.forTypesInGeneral()
+ .withCustomDefinitionProvider(titleProvider)
+ .withTypeAttributeOverride(titleProvider);
+
+ // Remap Byte to type integer, see https://github.com/victools/jsonschema-generator/blob/995a71eaf7a9a05cc2e335f8a7821b4a9019fa1b/CHANGELOG.md?plain=1#L530
+ builder.with(new SimpleTypeModule().withIntegerType(Byte.class));
+
+ // Apply additionalProperties true to all object values that haven't already set additionalProperties
+ builder.forTypesInGeneral().withTypeAttributeOverride((attrs, typeScope, context) -> {
+ if (attrs.has("type") && !attrs.has("additionalProperties") && Objects.equals(attrs.get("type").textValue(), "object")) {
+ attrs.put("additionalProperties", Boolean.TRUE);
+ }
+ });
+
+ // General direct class type remapping
+ builder.forTypesInGeneral()
+ // TODO: consider using withTargetTypeOverridesResolver instead
+ .withDefinitionNamingStrategy(new DefaultSchemaDefinitionNamingStrategy() {
+ @Override
+ public String getDefinitionNameForKey(DefinitionKey key, SchemaGenerationContext generationContext) {
+ TypeContext typeContext = generationContext.getTypeContext();
+ ResolvedType type = key.getType();
+ Class<?> erasedType = type.getErasedType();
+ if (erasedType.equals(Object.class)) {
+ return typeContext.getSimpleTypeDescription(typeContext.resolve(SchemaNodeMapper.AnyType.class));
+ }
+ return typeContext.getSimpleTypeDescription(type);
+ }
+ })
+ .withCustomDefinitionProvider((resolvedType, context) -> {
+ Class<?> erasedType = resolvedType.getErasedType();
+ // Does not behave like before where this is the fallback if a class could not be resolved
+ if (erasedType.equals(Object.class)) {
+ return new CustomDefinition(SchemaNodeMapper.getSchemaType(SchemaNodeMapper.TYPES_ALL));
+ }
+ if (erasedType.equals(ObjectNode.class)) {
+ return new CustomDefinition(SchemaNodeMapper.getSchemaPatternPropertiesSimpleKeyAnyType());
+ }
+ // Value type parameter "Object" is not handled on HashMap<String,Object> by MAP_VALUES_AS_ADDITIONAL_PROPERTIES
+ // TODO: ideally we add a reference to the AnyType definition rather than always inlining
+ if (erasedType.getSuperclass() != null
+ && erasedType.getSuperclass().equals(HashMap.class)
+ && erasedType.getGenericSuperclass() instanceof ParameterizedType t
+ && t.getActualTypeArguments()[1].equals(Object.class)
+ ) {
+ return new CustomDefinition(JsonNodeFactory.instance.objectNode()
+ .put(context.getKeyword(SchemaKeyword.TAG_TYPE), "object")
+ .set(context.getKeyword(SchemaKeyword.TAG_ADDITIONAL_PROPERTIES), SchemaNodeMapper.getSchemaType(SchemaNodeMapper.TYPES_ALL))
+ );
+ }
+ return null;
+ });
+
+ // Field type remapping
+ builder.forFields()
+ // Handle Jackson annotations
+ .withReadOnlyCheck(jacksonResolvers::getReadOnlyCheck)
+ .withWriteOnlyCheck(jacksonResolvers::getWriteOnlyCheck)
+ .withPropertyNameOverrideResolver(jacksonResolvers::getPropertyNameOverrideBasedOnJsonPropertyAnnotation)
+ // Primitive types cannot be null, thus they are always required and handle Jackson required properties
+ .withRequiredCheck((f) -> f.getType().getErasedType().isPrimitive() || jacksonResolvers.getRequiredCheckBasedOnJsonPropertyAnnotation(f))
+ // direct class to class mapping through annotations
+ .withTargetTypeOverridesResolver(this::remapFieldType)
+ // remapping using supplier through annotations
+ .withCustomDefinitionProvider((fieldScope, context) -> {
+ // We ignore this custom definition provider to avoid infinite recursion
+ ObjectNode attrs = context.createStandardDefinition(fieldScope.getType(), builder.forTypesInGeneral().getCustomDefinitionProviders().getFirst());
+ // Apply supplied definition
+ JsonSchemaSupplier ann = fieldScope.getAnnotation(JsonSchemaSupplier.class);
+ if (ann != null) {
+ attrs = SchemaNodeMapper.getSuppliedNode(fieldScope, ann);
+ }
+ // Avoids annotation also being applied to the `items` in an array. See https://victools.github.io/jsonschema-generator/#generator-individual-configurations
+ if (!fieldScope.isFakeContainerItemScope()) {
+ ObjectMapper mapper = context.getGeneratorConfig().getObjectMapper();
+ applyFieldAnnotation(fieldScope, JsonSchemaTitle.class, attrs, mapper);
+ applyFieldAnnotation(fieldScope, JsonSchemaDescription.class, attrs, mapper);
+ applyFieldAnnotation(fieldScope, JsonSchemaFormat.class, attrs, mapper);
+ applyFieldAnnotation(fieldScope, JsonSchemaDefault.class, attrs, mapper);
+ applyFieldAnnotation(fieldScope, JsonSchemaExamples.class, attrs, mapper);
+ }
+ String description = jacksonResolvers.resolveDescription(fieldScope);
+ if (description != null) {
+ ObjectNode targetNode;
+ JsonNode allOfNode = attrs.get(context.getKeyword(SchemaKeyword.TAG_ALLOF));
+ if (allOfNode instanceof ArrayNode allOf && !allOf.isEmpty()) {
+ targetNode = (ObjectNode) allOf.get(0);
+ } else {
+ targetNode = attrs;
+ }
+ targetNode.put(context.getKeyword(SchemaKeyword.TAG_DESCRIPTION), description);
+ }
+ // TODO: handle allOf wrapping in JSON Forms instead
+ // Inline definitions in member scope to avoid $ref collisions
+ return new CustomPropertyDefinition(attrs, CustomDefinition.AttributeInclusion.YES);
+ });
+
+ // Class subtype resolver for abstract classes
+ builder.forTypesInGeneral()
+ .withCustomDefinitionProvider(new JsonSubTypesResolver(List.of(JacksonOption.ALWAYS_REF_SUBTYPES, JacksonOption.INLINE_TRANSFORMED_SUBTYPES)))
+ .withCustomDefinitionProvider((resolvedType, context) -> {
+ List<ResolvedType> subTypes = findSubtypes(resolvedType, context);
+ if (subTypes == null || subTypes.isEmpty()) {
+ return null;
+ }
+
+ ObjectNode definition = context.getGeneratorConfig().createObjectNode();
+ ArrayNode oneOfArray = definition.withArray(context.getKeyword(SchemaKeyword.TAG_ONEOF));
+
+ for (ResolvedType subType : subTypes) {
+ oneOfArray.add(context.createDefinitionReference(subType));
+ }
+
+ // Always inline the super class schema to avoid allOf wrapping, which cannot be cleaned up as
+ // JSON Schema draft-7 does not permit other properties alongside a $ref, see
+ // https://json-schema.org/draft-07/draft-handrews-json-schema-01#rfc.section.8.3
+ return new CustomDefinition(definition, CustomDefinition.DefinitionType.INLINE, CustomDefinition.AttributeInclusion.YES);
+ });
+
+ // Set the default keyword for subtypes so AJV in the frontend can tell jsonforms/core to consider the
+ // subtype schema valid
+ builder.forTypesInGeneral().withTypeAttributeOverride((attrs, typeScope, context) -> {
+ Class<?> erasedType = typeScope.getType().getErasedType();
+ if (erasedType.getSuperclass() == Object.class) {
+ return;
+ }
+ String key = null;
+ Class<?> current = erasedType;
+ while(current != null && current.getSuperclass() != Object.class && key == null) {
+ current = current.getSuperclass();
+ key = Optional.ofNullable(current)
+ .map(c -> c.getAnnotation(JsonTypeInfo.class))
+ .map(JsonTypeInfo::property).orElse(null);
+ }
+ addDefaultToDiscriminator(attrs, context, key);
+ });
+
+ // Effectively disable const generation (on the root of subtypes)
+ builder.forTypesInGeneral().withEnumResolver(typeScope -> null);
+
+ // Custom annotations injection
+ builder.forTypesInGeneral().withTypeAttributeOverride((attrs, typeScope, context) -> {
+ Class<?> erasedType = typeScope.getType().getErasedType();
+ ObjectMapper mapper = context.getGeneratorConfig().getObjectMapper();
+
+ ObjectNode targetNode;
- if (types.length == 1) {
- typesNode = new TextNode(types[0]);
- } else {
- ArrayNode arrNode = ValueUtil.JSON.createArrayNode();
- Arrays.stream(types).forEach(arrNode::add);
- typesNode = arrNode;
+ // If there is an allOf array, inject into the first object inside it to allow for cleanup with `Option.ALLOF_CLEANUP_AT_THE_END`
+ JsonNode allOfNode = attrs.get(context.getKeyword(SchemaKeyword.TAG_ALLOF));
+ if (allOfNode instanceof ArrayNode allOf && !allOf.isEmpty()) {
+ targetNode = (ObjectNode) allOf.get(0);
+ } else {
+ targetNode = attrs;
+ }
+
+ // These will be overwritten by member scope when colliding
+ applyTypeAnnotation(erasedType, JsonSchemaTitle.class, targetNode, mapper);
+ applyTypeAnnotation(erasedType, JsonSchemaDescription.class, targetNode, mapper);
+ applyTypeAnnotation(erasedType, JsonSchemaFormat.class, targetNode, mapper);
+ applyTypeAnnotation(erasedType, JsonSchemaDefault.class, targetNode, mapper);
+ applyTypeAnnotation(erasedType, JsonSchemaExamples.class, targetNode, mapper);
+ });
+
+ // Apply Jackson serializers
+ builder.forTypesInGeneral().withCustomDefinitionProvider((resolvedType, context) -> {
+ ObjectNode node = JsonNodeFactory.instance.objectNode();
+ ObjectMapper mapper = builder.getObjectMapper();
+ JavaType javaType = mapper.constructType(resolvedType.getErasedType());
+
+ try {
+ JsonFormatVisitorWrapper visitor = new JsonFormatVisitorWrapper.Base() {
+ @Override
+ public JsonStringFormatVisitor expectStringFormat(JavaType type) throws JsonMappingException {
+ node.put("type", "string");
+ return new JsonStringFormatVisitor() {
+ public void format(JsonValueFormat format) {
+ setFormat(node, format.toString());
+ }
+ public void enumTypes(Set<String> enums) {}
+ };
+ }
+
+ @Override
+ public JsonNumberFormatVisitor expectNumberFormat(JavaType type) throws JsonMappingException {
+ node.put("type", "number");
+ return new JsonNumberFormatVisitor() {
+ public void numberType(JsonParser.NumberType numberType) {}
+ public void format(JsonValueFormat format) {
+ setFormat(node, format.toString());
+ }
+ public void enumTypes(Set<String> enums) {}
+ };
+ }
+
+ @Override
+ public JsonIntegerFormatVisitor expectIntegerFormat(JavaType type) throws JsonMappingException {
+ node.put("type", "integer");
+ return new JsonIntegerFormatVisitor() {
+ public void numberType(JsonParser.NumberType numberType) {}
+ public void format(JsonValueFormat format) {
+ setFormat(node, format.toString());
+ }
+ public void enumTypes(Set<String> enums) {}
+ };
+ }
+
+ @Override
+ public JsonBooleanFormatVisitor expectBooleanFormat(JavaType type) throws JsonMappingException {
+ node.put("type", "boolean");
+ return new JsonBooleanFormatVisitor() {
+ public void format(JsonValueFormat format) {
+ setFormat(node, format.toString());
+ }
+ public void enumTypes(Set<String> enums) {}
+ };
+ }
+ };
+
+ // Let Jackson traverse the type and call the visitor
+ mapper.acceptJsonFormatVisitor(javaType, visitor);
+
+ if (node.has("type")) {
+ return new CustomDefinition(node, CustomDefinition.DefinitionType.INLINE, CustomDefinition.AttributeInclusion.NO);
+ }
+ } catch (Exception ignored) {}
+ return null;
+ });
+ }
+
+ private static class JacksonResolvers extends JacksonModule {
+ protected String resolveDescription(MemberScope<?, ?> member) {
+ return super.resolveDescription(member);
+ }
+ protected String getPropertyNameOverrideBasedOnJsonPropertyAnnotation(MemberScope<?, ?> member) {
+ return super.getPropertyNameOverrideBasedOnJsonPropertyAnnotation(member);
+ }
+ protected boolean getReadOnlyCheck(MemberScope<?, ?> member) {
+ return super.getRequiredCheckBasedOnJsonPropertyAnnotation(member);
+ }
+ protected boolean getWriteOnlyCheck(MemberScope<?, ?> member) {
+ return super.getRequiredCheckBasedOnJsonPropertyAnnotation(member);
+ }
+ protected boolean getRequiredCheckBasedOnJsonPropertyAnnotation(MemberScope<?, ?> member) {
+ return super.getRequiredCheckBasedOnJsonPropertyAnnotation(member);
+ }
+ }
+
+ private static class JSONSchemaTitleProvider implements CustomDefinitionProviderV2, TypeAttributeOverrideV2 {
+ private ResolvedType rootType;
+
+ @Override
+ public CustomDefinition provideCustomSchemaDefinition(ResolvedType javaType, SchemaGenerationContext context) {
+ if (this.rootType == null) {
+ this.rootType = javaType;
+ }
+ return null;
+ }
+
+ /**
+ * Matches <a href="https://github.com/mbknor/mbknor-jackson-jsonSchema/blob/e370f80d5dd20eb9396455ab2ddfd7083d0e25fb/src/main/scala/com/kjetland/jackson/jsonSchema/JsonSchemaGenerator.scala#L1355">
+ * mbknor-jackson-jsonSchema
+ * </a>
+ * @param attrs node to modify (the part that may be referenced multiple times)
+ * @param scope the type representation associated with the JSON Schema node
+ * @param context generation context
+ */
+ @Override
+ public void overrideTypeAttributes(ObjectNode attrs, TypeScope scope, SchemaGenerationContext context) {
+ if ((this.rootType == scope.getType() && !attrs.has(context.getKeyword(SchemaKeyword.TAG_TITLE))) ||
+ (!attrs.has(context.getKeyword(SchemaKeyword.TAG_TITLE))
+ && attrs.has(context.getKeyword(SchemaKeyword.TAG_TYPE))
+ && attrs.get(context.getKeyword(SchemaKeyword.TAG_TYPE)).textValue().equals("object"))
+ ) {
+ // Code found here: http://stackoverflow.com/questions/2559759/how-do-i-convert-camelcase-into-human-readable-names-in-java
+ String title = scope.getType().getErasedType().getSimpleName().replaceAll(
+ String.format("%s|%s|%s",
+ "(?<=[A-Z])(?=[A-Z][a-z])",
+ "(?<=[^A-Z])(?=[A-Z])",
+ "(?<=[A-Za-z])(?=[^A-Za-z])"
+ ),
+ " ");
+ // Make the first letter uppercase
+ attrs.put(context.getKeyword(SchemaKeyword.TAG_TITLE), title.substring(0,1).toUpperCase() + title.substring(1));
+ }
+ }
+
+ @Override
+ public void resetAfterSchemaGenerationFinished() {
+ this.rootType = null;
+ }
+ }
+
+ /**
+ * Find and modify the main subtype object under the {@code allOf} keyword of a subtype to add a {@code default}
+ * property alongside the {@code const} discriminator property.
+ * @param attrs The {@link ObjectNode} representation of the subtype
+ * @param context The schema generator {@link SchemaGenerationContext}
+ */
+ private void addDefaultToDiscriminator(ObjectNode attrs, SchemaGenerationContext context, String customTypeKey) {
+ String typeKey = context.getKeyword(SchemaKeyword.TAG_TYPE);
+ JsonNode allOfNode = attrs.get(context.getKeyword(SchemaKeyword.TAG_ALLOF));
+ if (!(allOfNode instanceof ArrayNode allOf)) {
+ JsonNode props = attrs.get(context.getKeyword(SchemaKeyword.TAG_PROPERTIES));
+ if (props instanceof ObjectNode propsObj) {
+ // Remove type property on type property for subtypes to enable definition merging
+ propsObj.remove(typeKey);
+ propsObj.remove(customTypeKey);
+ }
+ return;
+ }
+
+ for (JsonNode node : allOf) {
+ JsonNode props = node.get(context.getKeyword(SchemaKeyword.TAG_PROPERTIES));
+ if (!(props instanceof ObjectNode propsObj)) {
+ continue;
+ }
+
+ // Rename custom type key with normal type key
+ if (!propsObj.has(typeKey) && propsObj.has(customTypeKey)) {
+ propsObj.set(typeKey, propsObj.get(customTypeKey));
+ propsObj.remove(customTypeKey);
+ }
+
+ if (customTypeKey != null && node.get(context.getKeyword(SchemaKeyword.TAG_REQUIRED)) instanceof ArrayNode arr) {
+ for (int i = 0; i < arr.size(); i++) {
+ if (arr.get(i).textValue().equals(customTypeKey)) {
+ arr.remove(i);
+ arr.add(context.getKeyword(SchemaKeyword.TAG_TYPE));
+ };
+ }
+ }
+
+ JsonNode typeNode = propsObj.get(typeKey);
+ if (typeNode instanceof ObjectNode typeProp) {
+
+ String constKey = context.getKeyword(SchemaKeyword.TAG_CONST);
+ String defaultKey = context.getKeyword(SchemaKeyword.TAG_DEFAULT);
+ if (typeProp.has(constKey) && !typeProp.has(defaultKey)) {
+ typeProp.put(defaultKey, typeProp.get(constKey).asText());
+ }
+ }
+ }
+ }
+
+ private List<ResolvedType> remapFieldType(FieldScope fieldScope) {
+ JsonSchemaTypeRemap ann = fieldScope.getAnnotation(JsonSchemaTypeRemap.class);
+ if (ann != null) {
+ try {
+ return Collections.singletonList(fieldScope.getContext().resolve((Type) ann.getClass().getMethod("type").invoke(ann)));
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to apply " + ann.getClass().getSimpleName(), e);
+ }
+ }
+ return null;
+ }
+
+ private static <A extends Annotation> void applyTypeAnnotation(
+ Class<?> type,
+ Class<A> annotationClass,
+ ObjectNode schema,
+ ObjectMapper mapper
+ ) {
+ A annotation;
+
+ if (type.isArray() && type.getComponentType() != null) {
+ annotation = type.getComponentType().getDeclaredAnnotation(annotationClass);
+ } else {
+ annotation = type.getDeclaredAnnotation(annotationClass);
+ }
+
+ if (annotation != null) {
+ applyAnnotation(annotationClass, annotation, schema, mapper);
+ }
+ }
+
+ private static <A extends Annotation> void applyFieldAnnotation(
+ FieldScope fieldScope,
+ Class<A> annotationClass,
+ ObjectNode schema,
+ ObjectMapper mapper
+ ) {
+ A annotation = fieldScope.getAnnotation(annotationClass);
+ if (annotation != null) {
+ applyAnnotation(annotationClass, annotation, schema, mapper);
+ }
}
- return wrapped ? ValueUtil.JSON.createObjectNode().set("type", typesNode) : typesNode;
+ private static <A extends Annotation> void applyAnnotation(Class<?> annotationClass, A annotation, ObjectNode schema, ObjectMapper mapper) {
+ try {
+ String keyword = (String) annotationClass.getMethod("keyword").invoke(annotation);
+ Method valueMethod = annotationClass.getMethod("value");
+ Class<?> returnType = valueMethod.getReturnType();
+ Object value = valueMethod.invoke(annotation);
+
+ if (returnType.isArray()) {
+ ArrayNode arrayNode = schema.putArray(keyword);
+ for (Object element : (Object[]) value) {
+ arrayNode.add(parseJsonOrString(mapper, element.toString()));
+ }
+ } else {
+ schema.set(keyword, parseJsonOrString(mapper, value.toString()));
+ }
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to apply annotation " + annotationClass.getSimpleName(), e);
+ }
+ }
+
+ private static JsonNode parseJsonOrString(ObjectMapper mapper, String input) {
+ try {
+ return mapper.readTree(input);
+ } catch (Exception e) {
+ return new TextNode(input);
+ }
+ }
+
+ private static List<ResolvedType> findSubtypes(ResolvedType resolvedType, SchemaGenerationContext context) {
+ Class<?> rawType = resolvedType.getErasedType();
+
+ // Only attempt subtype discovery if @JsonTypeInfo is present
+ if (!rawType.isAnnotationPresent(JsonTypeInfo.class)) {
+ return null;
+ }
+
+ // Reuse Jackson Module JsonSubTypesResolver to get explicitly declared types
+ if (rawType.isAnnotationPresent(JsonSubTypes.class)) {
+ return new JsonSubTypesResolver().findSubtypes(resolvedType, context);
+ }
+
+ // Cached lookup
+ return subtypeCache.computeIfAbsent(rawType, baseType -> {
+ Set<Class<?>> found = reflections.getSubTypesOf(baseType)
+ .stream()
+ .filter(c -> !Modifier.isAbstract(c.getModifiers()))
+ .collect(Collectors.toSet());
+
+ return found.stream()
+ .map(sub -> context.getTypeContext().resolveSubtype(resolvedType, sub))
+ .collect(Collectors.toList());
+ });
+ }
}
- public static JsonSchemaConfig getJsonSchemaConfig() {
- return JsonSchemaConfig.create(
- false,
- Optional.empty(),
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- Collections.emptyMap(),
- false,
- Collections.emptySet(),
- Map.of(
- Object.class, AnyType.class,
- ObjectNode.class, PatternPropertiesSimpleKeyAnyType.class
- ),
- Map.of(
- SCHEMA_SUPPLIER_NAME_ANY_TYPE, () -> getSchemaType(true, TYPES_ALL),
- SCHEMA_SUPPLIER_NAME_STRING_TYPE, () -> getSchemaType(true, TYPE_STRING),
- SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_ANY_KEY_ANY_TYPE, JSONSchemaUtil::getSchemaPatternPropertiesAnyKeyAnyType,
- SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_SIMPLE_KEY_ANY_TYPE, JSONSchemaUtil::getSchemaPatternPropertiesSimpleKeyAnyType
- ),
- null,
- false,
- null,
- null,
- true
- ).withJsonSchemaDraft(JsonSchemaDraft.DRAFT_07);
+ public static SchemaGeneratorConfig getJsonSchemaConfig(ObjectMapper mapper) {
+ return new SchemaGeneratorConfigBuilder(mapper, SchemaVersion.DRAFT_7, new OptionPreset(
+ Option.SCHEMA_VERSION_INDICATOR,
+ Option.ADDITIONAL_FIXED_TYPES,
+ Option.FLATTENED_ENUMS,
+ Option.VALUES_FROM_CONSTANT_FIELDS,
+ Option.PUBLIC_NONSTATIC_FIELDS,
+ Option.NONPUBLIC_NONSTATIC_FIELDS_WITH_GETTERS,
+ Option.MAP_VALUES_AS_ADDITIONAL_PROPERTIES,
+ Option.ALLOF_CLEANUP_AT_THE_END,
+ Option.DUPLICATE_MEMBER_ATTRIBUTE_CLEANUP_AT_THE_END
+ ))
+ .with(new JakartaValidationModule(
+ JakartaValidationOption.NOT_NULLABLE_FIELD_IS_REQUIRED,
+ JakartaValidationOption.INCLUDE_PATTERN_EXPRESSIONS
+ ))
+ .with(new CustomModule())
+ .build();
}
}
diff --git a/model/src/main/java/org/openremote/model/util/ValueUtil.java b/model/src/main/java/org/openremote/model/util/ValueUtil.java
index a92e46445..efa73cefd 100644
--- a/model/src/main/java/org/openremote/model/util/ValueUtil.java
+++ b/model/src/main/java/org/openremote/model/util/ValueUtil.java
@@ -32,7 +32,7 @@ import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
-import com.kjetland.jackson.jsonSchema.JsonSchemaGenerator;
+import com.github.victools.jsonschema.generator.*;
import jakarta.persistence.Entity;
import jakarta.validation.ConstraintValidatorContext;
import jakarta.validation.ConstraintViolation;
@@ -159,7 +159,7 @@ public class ValueUtil {
protected static Map<String, MetaItemDescriptor<?>> metaItemDescriptors = new HashMap<>();
protected static Map<String, ValueDescriptor<?>> valueDescriptors = new HashMap<>();
protected static Validator validator;
- protected static JsonSchemaGenerator generator;
+ protected static SchemaGenerator generator;
public static ObjectMapper configureObjectMapper(ObjectMapper objectMapper) {
objectMapper
@@ -922,7 +922,7 @@ public class ValueUtil {
}
protected static void doSchemaInit() {
- generator = new JsonSchemaGenerator(JSON, JSONSchemaUtil.getJsonSchemaConfig());
+ generator = new SchemaGenerator(JSONSchemaUtil.getJsonSchemaConfig(JSON));
}
@@ -1029,7 +1029,7 @@ public class ValueUtil {
if (generator == null) {
return JSON.createObjectNode();
}
- return generator.generateJsonSchema(clazz);
+ return generator.generateSchema(clazz);
}
public static void initialiseAssetAttributes(Asset<?> asset) throws IllegalStateException {
diff --git a/model/src/main/java/org/openremote/model/value/ForecastConfigurationWeightedExponentialAverage.java b/model/src/main/java/org/openremote/model/value/ForecastConfigurationWeightedExponentialAverage.java
index ee7395e2a..d03ad05ed 100644
--- a/model/src/main/java/org/openremote/model/value/ForecastConfigurationWeightedExponentialAverage.java
+++ b/model/src/main/java/org/openremote/model/value/ForecastConfigurationWeightedExponentialAverage.java
@@ -40,6 +40,7 @@ public class ForecastConfigurationWeightedExponentialAverage extends ForecastCon
@NotNull
@JsonSerialize(using = ToStringSerializer.class)
@JsonDeserialize(converter = TimeUtil.PeriodAndDurationConverter.class)
+ // TODO: consider @JsonSchemaFormat("duration") requires new or-mwc-input type
protected TimeUtil.ExtendedPeriodAndDuration pastPeriod;
@NotNull
@Positive
@@ -47,6 +48,7 @@ public class ForecastConfigurationWeightedExponentialAverage extends ForecastCon
@NotNull
@JsonSerialize(using = ToStringSerializer.class)
@JsonDeserialize(converter = TimeUtil.PeriodAndDurationConverter.class)
+ // TODO: consider @JsonSchemaFormat("duration") requires new or-mwc-input type
protected TimeUtil.ExtendedPeriodAndDuration forecastPeriod;
@NotNull
@Positive
diff --git a/model/src/main/java/org/openremote/model/value/JsonPathFilter.java b/model/src/main/java/org/openremote/model/value/JsonPathFilter.java
index 34fa52e3e..d122b1fa0 100644
--- a/model/src/main/java/org/openremote/model/value/JsonPathFilter.java
+++ b/model/src/main/java/org/openremote/model/value/JsonPathFilter.java
@@ -29,7 +29,7 @@ import com.jayway.jsonpath.Option;
import com.jayway.jsonpath.ParseContext;
import com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider;
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
+import org.openremote.model.util.JSONSchemaUtil.JsonSchemaTitle;
import org.openremote.model.util.TextUtil;
import org.openremote.model.util.ValueUtil;
diff --git a/model/src/main/java/org/openremote/model/value/MathExpressionValueFilter.java b/model/src/main/java/org/openremote/model/value/MathExpressionValueFilter.java
index 0bcf3dcf6..abd6e39e3 100644
--- a/model/src/main/java/org/openremote/model/value/MathExpressionValueFilter.java
+++ b/model/src/main/java/org/openremote/model/value/MathExpressionValueFilter.java
@@ -4,9 +4,9 @@ import com.fasterxml.jackson.annotation.JsonClassDescription;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
import net.objecthunter.exp4j.Expression;
import net.objecthunter.exp4j.ExpressionBuilder;
+import org.openremote.model.util.JSONSchemaUtil.JsonSchemaTitle;
import org.openremote.model.util.ValueUtil;
import java.util.Optional;
diff --git a/model/src/main/java/org/openremote/model/value/RegexValueFilter.java b/model/src/main/java/org/openremote/model/value/RegexValueFilter.java
index fd2030da1..5847e48af 100644
--- a/model/src/main/java/org/openremote/model/value/RegexValueFilter.java
+++ b/model/src/main/java/org/openremote/model/value/RegexValueFilter.java
@@ -24,7 +24,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
+import org.openremote.model.util.JSONSchemaUtil.*;
import org.openremote.model.util.ValueUtil;
import java.util.Optional;
diff --git a/model/src/main/java/org/openremote/model/value/SubStringValueFilter.java b/model/src/main/java/org/openremote/model/value/SubStringValueFilter.java
index 72cdab862..0e8d36aca 100644
--- a/model/src/main/java/org/openremote/model/value/SubStringValueFilter.java
+++ b/model/src/main/java/org/openremote/model/value/SubStringValueFilter.java
@@ -23,7 +23,7 @@ import com.fasterxml.jackson.annotation.JsonClassDescription;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
+import org.openremote.model.util.JSONSchemaUtil.JsonSchemaTitle;
import org.openremote.model.util.ValueUtil;
import java.util.Optional;
diff --git a/model/src/main/java/org/openremote/model/value/ValueConstraint.java b/model/src/main/java/org/openremote/model/value/ValueConstraint.java
index dcbfa32c5..8c744e5fb 100644
--- a/model/src/main/java/org/openremote/model/value/ValueConstraint.java
+++ b/model/src/main/java/org/openremote/model/value/ValueConstraint.java
@@ -20,7 +20,8 @@
package org.openremote.model.value;
import com.fasterxml.jackson.annotation.*;
-import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaDescription;
+
+import org.openremote.model.util.JSONSchemaUtil.*;
import org.openremote.model.util.ValueUtil;
import java.io.Serializable;
diff --git a/model/src/test/java/org/openremote/model/util/JSONSchemaUtilTest.java b/model/src/test/java/org/openremote/model/util/JSONSchemaUtilTest.java
new file mode 100644
index 000000000..016e7e608
--- /dev/null
+++ b/model/src/test/java/org/openremote/model/util/JSONSchemaUtilTest.java
@@ -0,0 +1,480 @@
+package org.openremote.model.util;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyDescription;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.json.JSONException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+
+import org.openremote.model.util.JSONSchemaUtil.*;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.URL;
+import java.time.*;
+import java.util.Date;
+
+import static org.skyscreamer.jsonassert.JSONAssert.assertEquals;
+
+public class JSONSchemaUtilTest {
+
+ @BeforeEach
+ void setup() {
+ ValueUtil.doInitialise();
+ }
+
+ private static URL loadResource(String resourcePath) {
+ return JSONSchemaUtilTest.class.getResource("/org/openremote/model/util/" + resourcePath + ".json");
+ }
+
+ static class Title {}
+
+ @Test
+ public void shouldHaveTitle() throws JsonProcessingException, JSONException {
+ JsonNode expected = ValueUtil.JSON.readTree("""
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "object",
+ "title": "Title",
+ "additionalProperties": true
+ }"""
+ );
+
+ JsonNode actual = ValueUtil.getSchema(Title.class);
+ assertEquals(expected.toString(), actual.toString(), true);
+ }
+
+ @Test
+ public void shouldRemapByte() throws IOException, JSONException {
+ JsonNode expected = ValueUtil.JSON.readTree(loadResource(java.lang.Byte.class.getName()));
+ JsonNode actual = ValueUtil.getSchema(java.lang.Byte.class);
+ assertEquals(expected.toString(), actual.toString(), true);
+ }
+
+ static class AdditionalProperties {}
+
+ @Test
+ public void shouldHaveAdditionalPropertiesTrue() throws JsonProcessingException, JSONException {
+ JsonNode expected = ValueUtil.JSON.readTree("""
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "object",
+ "title": "Additional Properties",
+ "additionalProperties": true
+ }"""
+ );
+
+ JsonNode actual = ValueUtil.getSchema(AdditionalProperties.class);
+ assertEquals(expected.toString(), actual.toString(), true);
+ }
+
+ static class RemapTypes {
+ @JsonSchemaTypeRemap(type = String.class)
+ public boolean test1;
+ @JsonSchemaTypeRemap(type = boolean.class)
+ public String test2;
+ @JsonSchemaTypeRemap(type = Date.class)
+ public boolean test3;
+ @JsonSchemaSupplier(supplier = SchemaNodeMapper.SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_ANY_KEY_ANY_TYPE)
+ public Boolean test4;
+ }
+
+ @Test
+ public void shouldRemapTypes() throws JsonProcessingException, JSONException {
+ JsonNode expected = ValueUtil.JSON.readTree("""
+ {
+ "$schema":"http://json-schema.org/draft-07/schema#",
+ "type":"object",
+ "properties": {
+ "test1":{"type":"string"},
+ "test2":{"type":"boolean"},
+ "test3":{"type":"integer","format":"utc-millisec"},
+ "test4":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}}}
+ },
+ "required":["test1","test3"],
+ "title":"Remap Types",
+ "additionalProperties":true
+ }"""
+ );
+
+ JsonNode actual = ValueUtil.getSchema(RemapTypes.class);
+ assertEquals(expected.toString(), actual.toString(), false);
+ }
+
+ @ParameterizedTest
+ @ValueSource(classes = {
+ org.openremote.model.value.ValueType.BooleanMap.class,
+ org.openremote.model.value.ValueType.DoubleMap.class,
+ org.openremote.model.value.ValueType.IntegerMap.class,
+ org.openremote.model.value.ValueType.ObjectMap.class,
+ org.openremote.model.value.ValueType.StringMap.class,
+ org.openremote.model.value.ValueType.MultivaluedStringMap.class,
+ })
+ public void shouldHandleMapTypes() throws IOException, JSONException {
+ JsonNode expected = ValueUtil.JSON.readTree(loadResource(java.lang.Byte.class.getName()));
+ JsonNode actual = ValueUtil.getSchema(java.lang.Byte.class);
+ assertEquals(expected.toString(), actual.toString(), true);
+ }
+
+ static class JacksonAnnotations {
+ @JsonPropertyDescription("This property should have a description.")
+ public Boolean test1;
+ @JsonProperty("renamed")
+ public Boolean test2;
+ @JsonProperty(value = "renamed1", required = true)
+ public Boolean test3;
+ }
+
+ @Test
+ public void shouldHandleJacksonAnnotations() throws JsonProcessingException, JSONException {
+ JsonNode expected = ValueUtil.JSON.readTree("""
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "object",
+ "properties": {
+ "renamed": {
+ "type": "boolean"
+ },
+ "renamed1": {
+ "type": "boolean",
+ "readOnly": true,
+ "writeOnly": true
+ },
+ "test1": {
+ "type": "boolean",
+ "description": "This property should have a description."
+ }
+ },
+ "required": [ "renamed1" ],
+ "title": "Jackson Annotations",
+ "additionalProperties": true
+ }"""
+ );
+
+ JsonNode actual = ValueUtil.getSchema(JacksonAnnotations.class);
+ assertEquals(expected.toString(), actual.toString(), true);
+ }
+
+ static class Primitives {
+ public boolean test1;
+ public int test2;
+ public long test3;
+ public float test4;
+ public double test5;
+ public byte test6;
+ public char test7;
+ }
+
+ @Test
+ public void shouldHaveRequiredPrimitives() throws JsonProcessingException, JSONException {
+ JsonNode expected = ValueUtil.JSON.readTree("""
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "object",
+ "properties": {
+ "test1": { "type": "boolean" },
+ "test2": { "type": "integer" },
+ "test3": { "type": "integer" },
+ "test4": { "type": "number" },
+ "test5": { "type": "number" },
+ "test6": { "type": "integer" },
+ "test7": { "type": "string" }
+ },
+ "required": [
+ "test1",
+ "test2",
+ "test3",
+ "test4",
+ "test5",
+ "test6",
+ "test7"
+ ],
+ "title": "Primitives",
+ "additionalProperties": true
+ }"""
+ );
+
+ JsonNode actual = ValueUtil.getSchema(Primitives.class);
+ assertEquals(expected.toString(), actual.toString(), true);
+ }
+
+ static class AnnotationsForFields {
+ @JsonSchemaTitle("test")
+ @JsonSchemaDescription("test")
+ @JsonSchemaFormat("test")
+ @JsonSchemaDefault("false")
+ @JsonSchemaExamples({ "test" })
+ public Boolean all;
+ }
+
+ @Test
+ public void shouldApplyCustomAnnotationsForFields() throws JsonProcessingException, JSONException {
+ JsonNode expected = ValueUtil.JSON.readTree("""
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "object",
+ "properties": {
+ "all":{
+ "type":"boolean",
+ "title":"test",
+ "description":"test",
+ "default": false,
+ "format":"test",
+ "examples":["test"]
+ }
+ },
+ "title": "Annotations For Fields",
+ "additionalProperties": true
+ }"""
+ );
+
+ JsonNode actual = ValueUtil.getSchema(AnnotationsForFields.class);
+ assertEquals(expected.toString(), actual.toString(), true);
+ }
+
+ @JsonSchemaTitle("test")
+ @JsonSchemaDescription("test")
+ @JsonSchemaFormat("test")
+ @JsonSchemaDefault("{}")
+ @JsonSchemaExamples({ "test" })
+ static class AnnotationsForTypes {
+ }
+
+ @Test
+ public void shouldApplyCustomAnnotationsForTypes() throws JsonProcessingException, JSONException {
+ JsonNode expected = ValueUtil.JSON.readTree("""
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "object",
+ "title": "test",
+ "additionalProperties": true,
+ "description": "test",
+ "format": "test",
+ "default": {},
+ "examples": [
+ "test"
+ ]
+ }"""
+ );
+
+ JsonNode actual = ValueUtil.getSchema(AnnotationsForTypes.class);
+ assertEquals(expected.toString(), actual.toString(), true);
+ }
+
+ @JsonTypeInfo(property = "type", use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY)
+ @JsonSubTypes({
+ @JsonSubTypes.Type(TestAgentLinkAnnotationResolving.class),
+ @JsonSubTypes.Type(TestAgentLinkSuperclassAnnotationResolving.class),
+ })
+ abstract static class TestAgentLink<T extends TestAgentLink<?>> implements Serializable {
+
+ @JsonSchemaFormat("or-agent-id")
+ protected String id;
+
+ @JsonSerialize
+ protected String getType() {
+ return getClass().getSimpleName();
+ }
+ }
+ static class TestAgentLinkAnnotationResolving extends TestAgentLink<TestAgentLinkAnnotationResolving> { }
+ static class TestAgentLinkSuperclassAnnotationResolving extends TestAgentLinkAnnotationResolving { }
+
+ @Test
+ public void shouldHaveSubtypesWithDefaultTypeProperty() throws JsonProcessingException, JSONException {
+ JsonNode expected = ValueUtil.JSON.readTree("""
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "definitions": {
+ "TestAgentLinkAnnotationResolving": {
+ "title": "Test Agent Link Annotation Resolving",
+ "type": "object",
+ "additionalProperties": true,
+ "properties": {
+ "type": {
+ "const": "JSONSchemaUtilTest$TestAgentLinkAnnotationResolving",
+ "default": "JSONSchemaUtilTest$TestAgentLinkAnnotationResolving"
+ }
+ },
+ "required": [
+ "type"
+ ]
+ },
+ "TestAgentLinkSuperclassAnnotationResolving": {
+ "title": "Test Agent Link Superclass Annotation Resolving",
+ "type": "object",
+ "additionalProperties": true,
+ "properties": {
+ "type": {
+ "const": "JSONSchemaUtilTest$TestAgentLinkSuperclassAnnotationResolving",
+ "default": "JSONSchemaUtilTest$TestAgentLinkSuperclassAnnotationResolving"
+ }
+ },
+ "required": [
+ "type"
+ ]
+ }
+ },
+ "oneOf": [
+ { "$ref": "#/definitions/TestAgentLinkAnnotationResolving" },
+ { "$ref": "#/definitions/TestAgentLinkSuperclassAnnotationResolving" }
+ ],
+ "title": "Test Agent Link"
+ }"""
+ );
+
+ JsonNode actual = ValueUtil.getSchema(TestAgentLink.class);
+ assertEquals(expected.toString(), actual.toString(), true);
+ }
+
+ @JsonTypeInfo(property = "type", use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY)
+ abstract static class TestAgentLinkReflections<T extends TestAgentLinkReflections<?>> implements Serializable {
+
+ @JsonSchemaFormat("or-agent-id")
+ protected String id;
+
+ @JsonSerialize
+ protected String getType() {
+ return getClass().getSimpleName();
+ }
+ }
+ static class TestAgentLinkReflectionResolving extends TestAgentLinkReflections<TestAgentLinkReflectionResolving> { }
+
+ @Test
+ public void shouldResolveSubtypesReflections() throws JsonProcessingException, JSONException {
+ JsonNode expected = ValueUtil.JSON.readTree("""
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "definitions": {
+ "TestAgentLinkReflectionResolving": {
+ "title": "Test Agent Link Reflection Resolving",
+ "type": "object",
+ "additionalProperties": true,
+ "properties": {
+ "type": {
+ "const": "JSONSchemaUtilTest$TestAgentLinkReflectionResolving",
+ "default": "JSONSchemaUtilTest$TestAgentLinkReflectionResolving"
+ }
+ },
+ "required": [
+ "type"
+ ]
+ }
+ },
+ "title": "Test Agent Link Reflections",
+ "oneOf": [
+ { "$ref": "#/definitions/TestAgentLinkReflectionResolving" }
+ ],
+ "type": "object",
+ "properties": {
+ "type": {
+ "const": "JSONSchemaUtilTest$TestAgentLinkReflections"
+ }
+ },
+ "required": [
+ "type"
+ ]
+ }"""
+ );
+
+
+
+ JsonNode actual = ValueUtil.getSchema(TestAgentLinkReflections.class);
+ assertEquals(expected.toString(), actual.toString(), true);
+ }
+
+ static class JavaTimeJacksonModule {
+ public Duration duration;
+ public LocalDateTime localDateTime;
+ public LocalDate localDate;
+ public LocalTime localTime;
+ public MonthDay monthDay;
+ public OffsetTime offsetTime;
+ public Period period;
+ public Year year;
+ public YearMonth yearMonth;
+ public ZoneId zoneId;
+ public ZoneOffset zoneOffset;
+ // Instant variants
+ public Instant instant;
+ public OffsetDateTime offsetDateTime;
+ public ZonedDateTime zonedDateTime;
+ }
+
+ @Test
+ public void shouldApplyJacksonSerializers() throws JsonProcessingException, JSONException {
+ JsonNode expected = ValueUtil.JSON.readTree("""
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "object",
+ "properties": {
+ "duration": {
+ "type": "integer",
+ "format": "utc-millisec"
+ },
+ "instant": {
+ "type": "integer",
+ "format": "utc-millisec"
+ },
+ "localDate": { "type": "string" },
+ "localDateTime": { "type": "string" },
+ "localTime": { "type": "string" },
+ "monthDay": {
+ "title": "Month Day",
+ "type": "object",
+ "properties": {
+ "month": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "month"
+ ],
+ "additionalProperties": true
+ },
+ "offsetDateTime": {
+ "type": "integer",
+ "format": "utc-millisec"
+ },
+ "offsetTime": { "type": "string" },
+ "period": { "type": "string" },
+ "year": { "type": "integer" },
+ "yearMonth": {
+ "title": "Year Month",
+ "type": "object",
+ "properties": {
+ "month": {
+ "type": "integer"
+ },
+ "year": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "month",
+ "year"
+ ],
+ "additionalProperties": true
+ },
+ "zoneId": { "type": "string" },
+ "zoneOffset": { "type": "string" },
+ "zonedDateTime": {
+ "type": "integer",
+ "format": "utc-millisec"
+ }
+ },
+ "title": "Java Time Jackson Module",
+ "additionalProperties": true
+ }"""
+ );
+
+ JsonNode actual = ValueUtil.getSchema(JavaTimeJacksonModule.class);
+ assertEquals(expected.toString(), actual.toString(), true);
+ }
+}
diff --git a/model/src/test/resources/org/openremote/model/util/java.lang.Byte.json b/model/src/test/resources/org/openremote/model/util/java.lang.Byte.json
new file mode 100644
index 000000000..34d7f5ec4
--- /dev/null
+++ b/model/src/test/resources/org/openremote/model/util/java.lang.Byte.json
@@ -0,0 +1,5 @@
+{
+ "$schema" : "http://json-schema.org/draft-07/schema#",
+ "title" : "Byte",
+ "type" : "integer"
+}
\ No newline at end of file
diff --git a/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$BooleanMap.json b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$BooleanMap.json
new file mode 100644
index 000000000..ac5ca7a85
--- /dev/null
+++ b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$BooleanMap.json
@@ -0,0 +1,8 @@
+{
+ "$schema" : "http://json-schema.org/draft-07/schema#",
+ "title" : "Boolean Map",
+ "type" : "object",
+ "additionalProperties" : {
+ "type" : "boolean"
+ }
+}
\ No newline at end of file
diff --git a/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$DoubleMap.json b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$DoubleMap.json
new file mode 100644
index 000000000..0f14cf5bb
--- /dev/null
+++ b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$DoubleMap.json
@@ -0,0 +1,8 @@
+{
+ "$schema" : "http://json-schema.org/draft-07/schema#",
+ "title" : "Double Map",
+ "type" : "object",
+ "additionalProperties" : {
+ "type" : "number"
+ }
+}
\ No newline at end of file
diff --git a/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$IntegerMap.json b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$IntegerMap.json
new file mode 100644
index 000000000..e4a5fa559
--- /dev/null
+++ b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$IntegerMap.json
@@ -0,0 +1,8 @@
+{
+ "$schema" : "http://json-schema.org/draft-07/schema#",
+ "title" : "Integer Map",
+ "type" : "object",
+ "additionalProperties" : {
+ "type" : "integer"
+ }
+}
\ No newline at end of file
diff --git a/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$MultivaluedStringMap.json b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$MultivaluedStringMap.json
new file mode 100644
index 000000000..01246c33e
--- /dev/null
+++ b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$MultivaluedStringMap.json
@@ -0,0 +1,11 @@
+{
+ "$schema" : "http://json-schema.org/draft-07/schema#",
+ "title" : "Multivalued String Map",
+ "type" : "object",
+ "additionalProperties" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+}
\ No newline at end of file
diff --git a/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$ObjectMap.json b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$ObjectMap.json
new file mode 100644
index 000000000..794b3194a
--- /dev/null
+++ b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$ObjectMap.json
@@ -0,0 +1,9 @@
+{
+ "$schema" : "http://json-schema.org/draft-07/schema#",
+ "title" : "Object Map",
+ "type" : "object",
+ "additionalProperties" : {
+ "type" : [ "null", "number", "integer", "boolean", "string", "array", "object" ],
+ "additionalProperties" : true
+ }
+}
\ No newline at end of file
diff --git a/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$StringMap.json b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$StringMap.json
new file mode 100644
index 000000000..31b4984f7
--- /dev/null
+++ b/model/src/test/resources/org/openremote/model/util/org.openremote.model.value.ValueType$StringMap.json
@@ -0,0 +1,8 @@
+{
+ "$schema" : "http://json-schema.org/draft-07/schema#",
+ "title" : "String Map",
+ "type" : "object",
+ "additionalProperties" : {
+ "type" : "string"
+ }
+}
\ No newline at end of file
diff --git a/ui/component/or-attribute-input/src/index.ts b/ui/component/or-attribute-input/src/index.ts
index 6acebb23b..f5f95de30 100644
--- a/ui/component/or-attribute-input/src/index.ts
+++ b/ui/component/or-attribute-input/src/index.ts
@@ -173,7 +173,7 @@ export const jsonFormsInputTemplateProvider: (fallback: ValueInputProvider) => V
if (!schema) {
// TODO: Load agent link schema from AssetModelUtil - For now run AssetModelTest in debug and copy paste the result of def schema = ValueUtil.getSchema(AgentLink.class)
- schema = JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","title":"Agent Link","oneOf":[{"$ref":"#/definitions/SNMPAgentLink"},{"$ref":"#/definitions/DefaultAgentLink"},{"$ref":"#/definitions/HTTPAgentLink"},{"$ref":"#/definitions/MockAgentLink"},{"$ref":"#/definitions/WebsocketAgentLink"},{"$ref":"#/definitions/ZWaveAgentLink"},{"$ref":"#/definitions/ModbusAgentLink"},{"$ref":"#/definitions/StorageSimulatorAgentLink"},{"$ref":"#/definitions/BluetoothMeshAgentLink"},{"$ref":"#/definitions/MQTTAgentLink"},{"$ref":"#/definitions/KNXAgentLink"},{"$ref":"#/definitions/SimulatorAgentLink"},{"$ref":"#/definitions/MailAgentLink"},{"$ref":"#/definitions/VelbusAgentLink"}],"definitions":{"SNMPAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["SNMPAgentLink"],"default":"SNMPAgentLink"},"id":{"type":"string","format":"or-agent-id"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"oid":{"type":"string"}},"title":"SNMPAgentLink","required":["type","oid"]},"regex":{"type":"object","additionalProperties":true,"title":"Regex","properties":{"type":{"type":"string","enum":["regex"],"default":"regex"},"pattern":{"type":"string"},"matchGroup":{"type":"integer"},"matchIndex":{"type":"integer"}},"required":["type"]},"substring":{"type":"object","additionalProperties":true,"title":"Substring","properties":{"type":{"type":"string","enum":["substring"],"default":"substring"},"beginIndex":{"type":"integer"},"endIndex":{"type":"integer"}},"required":["type","beginIndex"]},"jsonPath":{"type":"object","additionalProperties":true,"title":"JSON Path","properties":{"type":{"type":"string","enum":["jsonPath"],"default":"jsonPath"},"path":{"type":"string"},"returnFirst":{"type":"boolean"},"returnLast":{"type":"boolean"}},"required":["type","path","returnFirst","returnLast"]},"mathExpression":{"type":"object","additionalProperties":true,"title":"Mathematical Expression","properties":{"type":{"type":"string","enum":["mathExpression"],"default":"mathExpression"},"expression":{"type":"string"}},"required":["type"]},"AnyType":{"type":["null","number","integer","boolean","string","array","object"],"additionalProperties":true,"properties":{}},"StringPredicate":{"type":"object","additionalProperties":true,"description":"Predicate for string values; will match based on configured options.","properties":{"predicateType":{"type":"string","enum":["string"],"default":"string"},"match":{"type":"string","enum":["EXACT","BEGIN","END","CONTAINS"]},"caseSensitive":{"type":"boolean"},"value":{"type":"string"},"negate":{"type":"boolean"}},"title":"string","required":["predicateType","caseSensitive","negate"]},"BooleanPredicate":{"type":"object","additionalProperties":true,"description":"Predicate for boolean values; will evaluate the value as a boolean and match against this predicates value, any value that is not a boolean will not match","properties":{"predicateType":{"type":"string","enum":["boolean"],"default":"boolean"},"value":{"type":"boolean"}},"title":"boolean","required":["predicateType","value"]},"DateTimePredicate":{"type":"object","additionalProperties":true,"description":"Predicate for date time values; provided values should be valid ISO 8601 datetime strings (e.g. yyyy-MM-dd\'T\'HH:mm:ssZ or yyyy-MM-dd\'T\'HH:mm:ss±HH:mm), offset and time are optional, if no offset information is supplied then UTC is assumed.","properties":{"predicateType":{"type":"string","enum":["datetime"],"default":"datetime"},"value":{"type":"string"},"rangeValue":{"type":"string"},"operator":{"type":"string","enum":["EQUALS","GREATER_THAN","GREATER_EQUALS","LESS_THAN","LESS_EQUALS","BETWEEN"]},"negate":{"type":"boolean"}},"title":"datetime","required":["predicateType","negate"]},"NumberPredicate":{"type":"object","additionalProperties":true,"description":"Predicate for number values; will match based on configured options.","properties":{"predicateType":{"type":"string","enum":["number"],"default":"number"},"value":{"type":"number"},"rangeValue":{"type":"number"},"operator":{"type":"string","enum":["EQUALS","GREATER_THAN","GREATER_EQUALS","LESS_THAN","LESS_EQUALS","BETWEEN"]},"negate":{"type":"boolean"}},"title":"number","required":["predicateType","negate"]},"RadialGeofencePredicate":{"type":"object","additionalProperties":true,"description":"Predicate for GEO JSON point values; will return true if the point is within the specified radius of the specified latitude and longitude unless negated.","title":"Radial geofence","properties":{"predicateType":{"type":"string","enum":["radial"],"default":"radial"},"radius":{"type":"integer"},"lat":{"type":"number"},"lng":{"type":"number"},"negated":{"type":"boolean"}},"required":["predicateType","radius","lat","lng","negated"]},"RectangularGeofencePredicate":{"type":"object","additionalProperties":true,"description":"Predicate for GEO JSON point values; will return true if the point is within the specified rectangle specified as latitude and longitude values of two corners unless negated.","title":"Rectangular geofence","properties":{"predicateType":{"type":"string","enum":["rect"],"default":"rect"},"latMin":{"type":"number"},"lngMin":{"type":"number"},"latMax":{"type":"number"},"lngMax":{"type":"number"},"negated":{"type":"boolean"}},"required":["predicateType","latMin","lngMin","latMax","lngMax","negated"]},"ArrayPredicate":{"type":"object","additionalProperties":true,"description":"Predicate for array values; will match based on configured options.","properties":{"predicateType":{"type":"string","enum":["array"],"default":"array"},"value":{"$ref":"#/definitions/AnyType"},"index":{"type":"integer"},"lengthEquals":{"type":"integer"},"lengthGreaterThan":{"type":"integer"},"lengthLessThan":{"type":"integer"},"negated":{"type":"boolean"}},"title":"array","required":["predicateType","negated"]},"ValueAnyPredicate":{"type":"object","additionalProperties":true,"description":"Predicate that matches any value including null.","title":"Any value","properties":{"predicateType":{"type":"string","enum":["value-any"],"default":"value-any"}},"required":["predicateType"]},"ValueEmptyPredicate":{"type":"object","additionalProperties":true,"description":"Predicate that matches any empty/null value; unless negated.","title":"Empty value","properties":{"predicateType":{"type":"string","enum":["value-empty"],"default":"value-empty"},"negate":{"type":"boolean"}},"required":["predicateType","negate"]},"CalendarEventPredicate":{"type":"object","additionalProperties":true,"description":"Predicate for calendar event values; will match based on whether the calendar event is active for the specified time.","title":"Calendar","properties":{"predicateType":{"type":"string","enum":["calendar-event"],"default":"calendar-event"},"timestamp":{"type":"integer","format":"utc-millisec"}},"required":["predicateType"]},"DefaultAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["DefaultAgentLink"],"default":"DefaultAgentLink"},"id":{"type":"string","format":"or-agent-id"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"}},"title":"DefaultAgentLink","required":["type"]},"HTTPAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["HTTPAgentLink"],"default":"HTTPAgentLink"},"id":{"type":"string","format":"or-agent-id"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"headers":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"description":"A JSON object of headers to be added to HTTP request; the key represents the name of the header and for each string value supplied a new header will be added with the key name and specified string value"},"queryParameters":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"description":"A JSON object of query parameters to be added to HTTP request URL; the key represents the name of the query parameter and for each string value supplied a new query parameter will be added with the key name and specified string value (e.g. \'https://..../?test=1&test=2\')"},"pollingMillis":{"type":"integer","description":"Indicates that this HTTP request is used to update the linked attribute; this value indicates how frequently the HTTP request is made in order to update the linked attribute value"},"pagingMode":{"type":"boolean","description":"Indicates that the HTTP server supports pagination using the standard Link header mechanism"},"path":{"type":"string","description":"The URL path to append to the agents Base URL when making requests for this linked attribute"},"method":{"type":"string","enum":["GET","POST","PUT","DELETE","OPTIONS","PATCH"],"description":"The HTTP method to use when making requests for this linked attribute"},"contentType":{"type":"string","description":"The content type header value to use when making requests for this linked attribute (shortcut alternative to using headers parameter)"},"pollingAttribute":{"type":"string","description":"Allows the polled response to be written to another attribute with the specified name on the same asset as the linked attribute"},"messageConvertBinary":{"type":"boolean","description":"Indicates that the HTTP response is binary and should be converted to binary string representation"},"messageConvertHex":{"type":"boolean","description":"Indicates that the HTTP response is binary and should be converted to hexadecimal string representation"}},"title":"HTTPAgentLink","required":["type","messageConvertBinary","messageConvertHex"]},"MockAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["MockAgentLink"],"default":"MockAgentLink"},"id":{"type":"string","format":"or-agent-id"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"requiredValue":{"type":"string"}},"title":"MockAgentLink","required":["type"]},"WebsocketAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["WebsocketAgentLink"],"default":"WebsocketAgentLink"},"id":{"type":"string","format":"or-agent-id"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"websocketSubscriptions":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/websocket"},{"$ref":"#/definitions/http"}]}}},"title":"WebsocketAgentLink","required":["type"]},"websocket":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["websocket"],"default":"websocket"},"body":{"$ref":"#/definitions/AnyType"}},"title":"websocket","required":["type"]},"http":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["http"],"default":"http"},"body":{"$ref":"#/definitions/AnyType"},"method":{"type":"string","enum":["GET","PUT","POST"]},"contentType":{"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"uri":{"type":"string"}},"title":"http","required":["type"]},"ZWaveAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["ZWaveAgentLink"],"default":"ZWaveAgentLink"},"id":{"type":"string","format":"or-agent-id"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"deviceNodeId":{"type":"integer"},"deviceEndpoint":{"type":"integer"},"deviceValue":{"type":"string"}},"title":"ZWaveAgentLink","required":["type"]},"ModbusAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["ModbusAgentLink"],"default":"ModbusAgentLink"},"id":{"type":"string","format":"or-agent-id"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"pollingMillis":{"type":"integer","description":"Poll interval in milliseconds"},"readMemoryArea":{"type":"string","enum":["COIL","DISCRETE","HOLDING","INPUT"],"description":"Memory area to read from during read request"},"readValueType":{"type":"string","enum":["BOOL","SINT","USINT","BYTE","INT","UINT","WORD","DINT","UDINT","DWORD","LINT","ULINT","LWORD","REAL","LREAL","CHAR","WCHAR"],"description":"Type to convert the returned data to. As specified by the PLC4X Modbus data types."},"readAddress":{"type":"integer","description":"Zero based address from which the value is read from"},"writeMemoryArea":{"type":"string","enum":["COIL","HOLDING"],"description":"Memory area to write to. \\"HOLDING\\" or \\"COIL\\" allowed."},"writeAddress":{"type":"integer","description":"Zero-based address to which the value sent is written to"},"readRegistersAmount":{"type":"integer","description":"Set amount of registers to read. If left empty or less than 1, will use the default size for the corresponding data-type."}},"title":"ModbusAgentLink","required":["type","pollingMillis","readMemoryArea","readValueType","readAddress"]},"StorageSimulatorAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["StorageSimulatorAgentLink"],"default":"StorageSimulatorAgentLink"},"id":{"type":"string","format":"or-agent-id"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"}},"title":"StorageSimulatorAgentLink","required":["type"]},"BluetoothMeshAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["BluetoothMeshAgentLink"],"default":"BluetoothMeshAgentLink"},"id":{"type":"string","format":"or-agent-id"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"appKeyIndex":{"type":"integer","minimum":0,"maximum":2147483647},"address":{"type":"string","pattern":"^([0-9A-Fa-f]{4})$"},"modelName":{"type":"string","pattern":"^.*\\\\S+.*$","minLength":1}},"title":"BluetoothMeshAgentLink","required":["type","appKeyIndex","modelName"]},"MQTTAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["MQTTAgentLink"],"default":"MQTTAgentLink"},"id":{"type":"string","format":"or-agent-id"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"subscriptionTopic":{"type":"string","description":"An MQTT topic to subscribe to, any received payload will be pushed into the attribute; use value filter(s) to extract values from string payloads and/or value converters to do simple value mapping, complex processing may require a rule or a custom MQTT agent"},"publishTopic":{"type":"string","description":"An MQTT topic to publish attribute events to, any received payload will be pushed into the attribute; use write value converter and/or write value to do any processing, complex processing may require a rule or a custom MQTT agent"},"qos":{"type":"integer","minimum":0,"maximum":2,"description":"QoS level to use for publish/subscribe (default is 0 if unset)"}},"title":"MQTTAgentLink","required":["type"]},"KNXAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["KNXAgentLink"],"default":"KNXAgentLink"},"id":{"type":"string","format":"or-agent-id"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"dpt":{"type":"string","pattern":"^\\\\d{1,3}\\\\.\\\\d{1,3}$"},"actionGroupAddress":{"type":"string","pattern":"^\\\\d{1,3}/\\\\d{1,3}/\\\\d{1,3}$"},"statusGroupAddress":{"type":"string","pattern":"^\\\\d{1,3}/\\\\d{1,3}/\\\\d{1,3}$"}},"title":"KNXAgentLink","required":["type","dpt"]},"SimulatorAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["SimulatorAgentLink"],"default":"SimulatorAgentLink"},"id":{"type":"string","format":"or-agent-id"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"replayData":{"type":"array","items":{"$ref":"#/definitions/SimulatorReplayDatapoint"},"description":"Used to store a dataset of values that should be replayed (i.e. written to the linked attribute) in a continuous loop based on a schedule (by default replays every 24h). Predicted datapoints can be added by configuring \'Store predicted datapoints\' which will insert the datapoints immediately as determined by the schedule."},"schedule":{"$ref":"#/definitions/Schedule","description":"When defined overwrites the possible dataset length and when it is replayed. This could be once when only a start- (and end) date are defined, or a recurring event following the RFC 5545 RRULE format. If not provided defaults to 24 hours. If the replay data contains datapoints scheduled after the default 24 hours or the recurrence rule the datapoints will be ignored."}},"title":"SimulatorAgentLink","required":["type"]},"SimulatorReplayDatapoint":{"type":"object","additionalProperties":true,"title":"Data point","properties":{"timestamp":{"type":"integer"},"value":{"$ref":"#/definitions/AnyType"}},"required":["timestamp"]},"Schedule":{"type":"object","additionalProperties":true,"properties":{"start":{"type":"string","format":"date-time","description":"Set a start date, if not provided, starts immediately. When the replay datapoint timestamp is 0 it will insert it at 00:00."},"end":{"type":"string","format":"date-time","description":"Not implemented, within the recurrence rule you can specify an end date."},"recurrence":{"type":"string"}}},"Recur(LocalDateTime)":{"type":"object","additionalProperties":true,"properties":{"frequency":{"type":"string","enum":["SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"]},"skip":{"type":"string","enum":["OMIT","BACKWARD","FORWARD"]},"until":{"$ref":"#/definitions/TemporalAdapter(LocalDateTime)"},"rscale":{"type":"string","enum":["JAPANESE","BUDDHIST","ROC","ISLAMIC","ISO8601","CHINESE","ETHIOPIC","HEBREW","GREGORIAN"]},"count":{"type":"integer"},"interval":{"type":"integer"},"secondList":{"type":"array","items":{"type":"integer"}},"minuteList":{"type":"array","items":{"type":"integer"}},"hourList":{"type":"array","items":{"type":"integer"}},"dayList":{"type":"array","items":{"$ref":"#/definitions/WeekDay"}},"monthDayList":{"type":"array","items":{"type":"integer"}},"yearDayList":{"type":"array","items":{"type":"integer"}},"weekNoList":{"type":"array","items":{"type":"integer"}},"monthList":{"type":"array","items":{"$ref":"#/definitions/Month"}},"setPosList":{"type":"array","items":{"type":"integer"}},"weekStartDay":{"$ref":"#/definitions/WeekDay"},"experimentalValues":{"type":"object","additionalProperties":{"type":"string"}},"calIncField":{"$ref":"#/definitions/TemporalUnit"}}},"TemporalAdapter(LocalDateTime)":{"type":"object","additionalProperties":true,"properties":{"valueString":{"type":"string"},"tzId":{"$ref":"#/definitions/TzId"}}},"TzId":{"type":"object","additionalProperties":true,"properties":{"name":{"type":"string"},"value":{"type":"string"}}},"WeekDay":{"type":"object","additionalProperties":true,"properties":{"day":{"type":"string","enum":["SU","MO","TU","WE","TH","FR","SA"]},"offset":{"type":"integer"}},"required":["offset"]},"Month":{"type":"object","additionalProperties":true,"properties":{"monthOfYear":{"type":"integer"},"leapMonth":{"type":"boolean"}},"required":["monthOfYear","leapMonth"]},"TemporalUnit":{"type":"object","additionalProperties":true,"properties":{"durationEstimated":{"type":"boolean"},"duration":{"type":"integer","format":"utc-millisec"},"timeBased":{"type":"boolean"},"dateBased":{"type":"boolean"}},"required":["durationEstimated","timeBased","dateBased"]},"MailAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["MailAgentLink"],"default":"MailAgentLink"},"id":{"type":"string","format":"or-agent-id"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"subjectMatchPredicate":{"$ref":"#/definitions/StringPredicate","description":"The predicate to apply to incoming mail message subjects to determine if the message is intended for the linked attribute. This must be defined to enable attributes to be updated by the linked agent."},"fromMatchPredicate":{"$ref":"#/definitions/StringPredicate","description":"The predicate to apply to incoming mail message from address(es) to determine if the message is intended for the linked attribute. This must be defined to enable attributes to be updated by the linked agent."},"useSubject":{"type":"boolean","description":"Use the subject as value instead of the body"}},"title":"MailAgentLink","required":["type"]},"VelbusAgentLink":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string","enum":["VelbusAgentLink"],"default":"VelbusAgentLink"},"id":{"type":"string","format":"or-agent-id"},"deviceAddress":{"type":"integer","minimum":1,"maximum":255},"deviceValueLink":{"type":"string","pattern":"^.*\\\\S+.*$","minLength":1},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}}},"writeValue":{"type":"string","format":"or-multiline","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/regex"},{"$ref":"#/definitions/substring"},{"$ref":"#/definitions/jsonPath"},{"$ref":"#/definitions/mathExpression"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"}},"title":"VelbusAgentLink","required":["type","deviceAddress","deviceValueLink"]}}}');
+ schema = JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","definitions":{"ArrayPredicate":{"type":"object","properties":{"index":{"type":"integer"},"lengthEquals":{"type":"integer"},"lengthGreaterThan":{"type":"integer"},"lengthLessThan":{"type":"integer"},"negated":{"type":"boolean"},"value":{"title":"Any Type","type":["null","number","integer","boolean","string","array","object"],"additionalProperties":true},"type":{"const":"array","default":"array"}},"required":["negated","type"],"title":"Array Predicate","additionalProperties":true,"description":"Predicate for array values; will match based on configured options."},"BluetoothMeshAgentLink":{"type":"object","properties":{"address":{"type":"string","pattern":"^([0-9A-Fa-f]{4})$"},"appKeyIndex":{"type":"integer","minimum":0,"maximum":2147483647},"id":{"type":"string","format":"or-agent-id"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"modelName":{"type":"string","minLength":1},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"BluetoothMeshAgentLink","default":"BluetoothMeshAgentLink"}},"required":["appKeyIndex","modelName","type"],"title":"Bluetooth Mesh Agent Link","additionalProperties":true},"BooleanPredicate":{"type":"object","properties":{"value":{"type":"boolean"},"type":{"const":"boolean","default":"boolean"}},"required":["value","type"],"title":"Boolean Predicate","additionalProperties":true,"description":"Predicate for boolean values; will evaluate the value as a boolean and match against this predicates value, any value that is not a boolean will not match"},"CalendarEventPredicate":{"type":"object","properties":{"timestamp":{"type":"integer","format":"utc-millisec"},"type":{"const":"calendar-event","default":"calendar-event"}},"title":"Calendar","additionalProperties":true,"description":"Predicate for calendar event values; will match based on whether the calendar event is active for the specified time.","required":["type"]},"DateTimePredicate":{"type":"object","properties":{"negate":{"type":"boolean"},"operator":{"type":"string"},"rangeValue":{"type":"string"},"value":{"type":"string"},"type":{"const":"datetime","default":"datetime"}},"required":["negate","type"],"title":"Date Time Predicate","additionalProperties":true,"description":"Predicate for date time values; provided values should be valid ISO 8601 datetime strings (e.g. yyyy-MM-dd\'T\'HH:mm:ssZ or yyyy-MM-dd\'T\'HH:mm:ss±HH:mm), offset and time are optional, if no offset information is supplied then UTC is assumed."},"DefaultAgentLink":{"type":"object","properties":{"id":{"type":"string","format":"or-agent-id"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"DefaultAgentLink","default":"DefaultAgentLink"}},"title":"Default Agent Link","additionalProperties":true},"HTTPAgentLink":{"type":"object","properties":{"contentType":{"type":"string","description":"The content type header value to use when making requests for this linked attribute (shortcut alternative to using headers parameter)"},"headers":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"title":"Map","description":"A JSON object of headers to be added to HTTP request; the key represents the name of the header and for each string value supplied a new header will be added with the key name and specified string value"},"id":{"type":"string","format":"or-agent-id"},"messageConvertBinary":{"type":"boolean","description":"Indicates that the HTTP response is binary and should be converted to binary string representation"},"messageConvertHex":{"type":"boolean","description":"Indicates that the HTTP response is binary and should be converted to hexadecimal string representation"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"method":{"type":"string","description":"The HTTP method to use when making requests for this linked attribute"},"pagingMode":{"type":"boolean","description":"Indicates that the HTTP server supports pagination using the standard Link header mechanism"},"path":{"type":"string","description":"The URL path to append to the agents Base URL when making requests for this linked attribute"},"pollingAttribute":{"type":"string","description":"Allows the polled response to be written to another attribute with the specified name on the same asset as the linked attribute"},"pollingMillis":{"type":"integer","description":"Indicates that this HTTP request is used to update the linked attribute; this value indicates how frequently the HTTP request is made in order to update the linked attribute value"},"queryParameters":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"title":"Map","description":"A JSON object of query parameters to be added to HTTP request URL; the key represents the name of the query parameter and for each string value supplied a new query parameter will be added with the key name and specified string value (e.g. \'https://..../?test=1&test=2\')"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"HTTPAgentLink","default":"HTTPAgentLink"}},"required":["messageConvertBinary","messageConvertHex","type"],"title":"HTTP Agent Link","additionalProperties":true},"JsonPathFilter":{"type":"object","properties":{"path":{"type":"string"},"returnFirst":{"type":"boolean"},"returnLast":{"type":"boolean"},"type":{"const":"jsonPath","default":"jsonPath"}},"required":["path","returnFirst","returnLast","type"],"title":"JSON Path","additionalProperties":true},"KNXAgentLink":{"type":"object","properties":{"actionGroupAddress":{"type":"string","pattern":"^\\\\d{1,3}/\\\\d{1,3}/\\\\d{1,3}$"},"dpt":{"type":"string","pattern":"^\\\\d{1,3}\\\\.\\\\d{1,3}$"},"id":{"type":"string","format":"or-agent-id"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"statusGroupAddress":{"type":"string","pattern":"^\\\\d{1,3}/\\\\d{1,3}/\\\\d{1,3}$"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"KNXAgentLink","default":"KNXAgentLink"}},"required":["dpt","type"],"title":"KNX Agent Link","additionalProperties":true},"MQTTAgentLink":{"type":"object","properties":{"id":{"type":"string","format":"or-agent-id"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"publishTopic":{"type":"string","description":"An MQTT topic to publish attribute events to, any received payload will be pushed into the attribute; use write value converter and/or write value to do any processing, complex processing may require a rule or a custom MQTT agent"},"qos":{"type":"integer","description":"QoS level to use for publish/subscribe (default is 0 if unset)","minimum":0,"maximum":2},"subscriptionTopic":{"type":"string","description":"An MQTT topic to subscribe to, any received payload will be pushed into the attribute; use value filter(s) to extract values from string payloads and/or value converters to do simple value mapping, complex processing may require a rule or a custom MQTT agent"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"MQTTAgentLink","default":"MQTTAgentLink"}},"title":"MQTT Agent Link","additionalProperties":true,"required":["type"]},"MailAgentLink":{"type":"object","properties":{"fromMatchPredicate":{"type":"object","properties":{"caseSensitive":{"type":"boolean"},"match":{"type":"string"},"negate":{"type":"boolean"},"value":{"type":"string"},"type":{"const":"string","default":"string"}},"required":["caseSensitive","negate","type"],"title":"String Predicate","additionalProperties":true,"description":"The predicate to apply to incoming mail message from address(es) to determine if the message is intended for the linked attribute. This must be defined to enable attributes to be updated by the linked agent."},"id":{"type":"string","format":"or-agent-id"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"subjectMatchPredicate":{"type":"object","properties":{"caseSensitive":{"type":"boolean"},"match":{"type":"string"},"negate":{"type":"boolean"},"value":{"type":"string"},"type":{"const":"string","default":"string"}},"required":["caseSensitive","negate","type"],"title":"String Predicate","additionalProperties":true,"description":"The predicate to apply to incoming mail message subjects to determine if the message is intended for the linked attribute. This must be defined to enable attributes to be updated by the linked agent."},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"useSubject":{"type":"boolean","description":"Use the subject as value instead of the body"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"MailAgentLink","default":"MailAgentLink"}},"title":"Mail Agent Link","additionalProperties":true,"required":["type"]},"MathExpressionValueFilter":{"type":"object","properties":{"expression":{"type":"string"},"type":{"const":"mathExpression","default":"mathExpression"}},"title":"Mathematical Expression","additionalProperties":true,"required":["type"]},"MockAgentLink":{"type":"object","properties":{"id":{"type":"string","format":"or-agent-id"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"requiredValue":{"type":"string"},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"MockAgentLink","default":"MockAgentLink"}},"title":"Mock Agent Link","additionalProperties":true,"required":["type"]},"ModbusAgentLink":{"type":"object","properties":{"id":{"type":"string","format":"or-agent-id"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"pollingMillis":{"type":"integer","description":"Poll interval in milliseconds","readOnly":true,"writeOnly":true},"readAddress":{"type":"integer","description":"Zero based address from which the value is read from","readOnly":true,"writeOnly":true},"readMemoryArea":{"type":"string","description":"Memory area to read from during read request","readOnly":true,"writeOnly":true},"readRegistersAmount":{"type":"integer","description":"Set amount of registers to read. If left empty or less than 1, will use the default size for the corresponding data-type."},"readValueType":{"type":"string","description":"Type to convert the returned data to. As specified by the PLC4X Modbus data types.","readOnly":true,"writeOnly":true},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"writeAddress":{"type":"integer","description":"Zero-based address to which the value sent is written to"},"writeMemoryArea":{"type":"string","description":"Memory area to write to. \\"HOLDING\\" or \\"COIL\\" allowed."},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"ModbusAgentLink","default":"ModbusAgentLink"}},"required":["pollingMillis","readAddress","readMemoryArea","readValueType","type"],"title":"Modbus Agent Link","additionalProperties":true},"NumberPredicate":{"type":"object","properties":{"negate":{"type":"boolean"},"operator":{"type":"string"},"rangeValue":{"type":"number"},"value":{"type":"number"},"type":{"const":"number","default":"number"}},"required":["negate","type"],"title":"Number Predicate","additionalProperties":true,"description":"Predicate for number values; will match based on configured options."},"RadialGeofencePredicate":{"type":"object","properties":{"lat":{"type":"number"},"lng":{"type":"number"},"negated":{"type":"boolean"},"radius":{"type":"integer"},"type":{"const":"radial","default":"radial"}},"required":["lat","lng","negated","radius","type"],"title":"Radial geofence","additionalProperties":true,"description":"Predicate for GEO JSON point values; will return true if the point is within the specified radius of the specified latitude and longitude unless negated."},"RectangularGeofencePredicate":{"type":"object","properties":{"latMax":{"type":"number"},"latMin":{"type":"number"},"lngMax":{"type":"number"},"lngMin":{"type":"number"},"negated":{"type":"boolean"},"type":{"const":"rect","default":"rect"}},"required":["latMax","latMin","lngMax","lngMin","negated","type"],"title":"Rectangular geofence","additionalProperties":true,"description":"Predicate for GEO JSON point values; will return true if the point is within the specified rectangle specified as latitude and longitude values of two corners unless negated."},"RegexValueFilter":{"type":"object","properties":{"matchGroup":{"type":"integer"},"matchIndex":{"type":"integer"},"pattern":{"type":"string"},"type":{"const":"regex","default":"regex"}},"title":"Regex","additionalProperties":true,"required":["type"]},"SNMPAgentLink":{"type":"object","properties":{"id":{"type":"string","format":"or-agent-id"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"SNMPAgentLink","default":"SNMPAgentLink"}},"title":"SNMP Agent Link","additionalProperties":true,"required":["type"]},"SimulatorAgentLink":{"type":"object","properties":{"id":{"type":"string","format":"or-agent-id"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"replayData":{"type":"array","items":{"type":"object","properties":{"timestamp":{"type":"integer"},"value":{"title":"Any Type","type":["null","number","integer","boolean","string","array","object"],"additionalProperties":true}},"required":["timestamp"],"title":"Data point","additionalProperties":true},"title":"Data point","description":"Used to store a dataset of values that should be replayed (i.e. written to the linked attribute) in a continuous loop based on a schedule (by default replays every 24h). Predicted datapoints can be added by configuring \'Store predicted datapoints\' which will insert the datapoints immediately as determined by the schedule."},"schedule":{"type":"object","properties":{"end":{"type":"string","format":"date-time","description":"Not implemented, within the recurrence rule you can specify an end date."},"recurrence":{"type":"string","description":"The recurrence schedule follows the RFC 5545 RRULE format."},"start":{"type":"string","format":"date-time","description":"Set a start date, if not provided, starts immediately. When the replay datapoint timestamp is 0 it will insert it at 00:00."}},"title":"Schedule","additionalProperties":true,"description":"When defined overwrites the possible dataset length and when it is replayed. This could be once when only a start- (and end) date are defined, or a recurring event following the RFC 5545 RRULE format. If not provided defaults to 24 hours. If the replay data contains datapoints scheduled after the default 24 hours or the recurrence rule the datapoints will be ignored."},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"SimulatorAgentLink","default":"SimulatorAgentLink"}},"title":"Simulator Agent Link","additionalProperties":true,"required":["type"]},"StorageSimulatorAgentLink":{"type":"object","properties":{"id":{"type":"string","format":"or-agent-id"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"StorageSimulatorAgentLink","default":"StorageSimulatorAgentLink"}},"title":"Storage Simulator Agent Link","additionalProperties":true,"required":["type"]},"StringPredicate":{"type":"object","properties":{"caseSensitive":{"type":"boolean"},"match":{"type":"string"},"negate":{"type":"boolean"},"value":{"type":"string"},"type":{"const":"string","default":"string"}},"required":["caseSensitive","negate","type"],"title":"String Predicate","additionalProperties":true,"description":"Predicate for string values; will match based on configured options."},"SubStringValueFilter":{"type":"object","properties":{"beginIndex":{"type":"integer"},"endIndex":{"type":"integer"},"type":{"const":"substring","default":"substring"}},"required":["beginIndex","type"],"title":"Substring","additionalProperties":true},"ValueAnyPredicate":{"type":"object","title":"Any value","additionalProperties":true,"description":"Predicate that matches any value including null.","properties":{"type":{"const":"value-any","default":"value-any"}},"required":["type"]},"ValueEmptyPredicate":{"type":"object","properties":{"negate":{"type":"boolean"},"type":{"const":"value-empty","default":"value-empty"}},"required":["negate","type"],"title":"Empty value","additionalProperties":true,"description":"Predicate that matches any empty/null value; unless negated."},"VelbusAgentLink":{"type":"object","properties":{"deviceAddress":{"type":"integer","minimum":1,"maximum":255},"deviceValueLink":{"type":"string","minLength":1},"id":{"type":"string","format":"or-agent-id"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"VelbusAgentLink","default":"VelbusAgentLink"}},"required":["deviceAddress","deviceValueLink","type"],"title":"Velbus Agent Link","additionalProperties":true},"WebsocketAgentLink":{"type":"object","properties":{"id":{"type":"string","format":"or-agent-id"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"websocketSubscriptions":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/WebsocketSubscriptionImpl"},{"$ref":"#/definitions/WebsocketHTTPSubscription"}]},"description":"Array of WebsocketSubscriptions that should be executed when the linked attribute is linked; the subscriptions are executed in the order specified in the array."},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"WebsocketAgentLink","default":"WebsocketAgentLink"}},"title":"Websocket Agent Link","additionalProperties":true,"required":["type"]},"WebsocketHTTPSubscription":{"type":"object","properties":{"body":{"title":"Any Type","type":["null","number","integer","boolean","string","array","object"],"additionalProperties":true},"contentType":{"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"title":"Multivalued String Map"},"method":{"type":"string"},"uri":{"type":"string"},"type":{"const":"http","default":"http"}},"title":"Websocket HTTP Subscription","additionalProperties":true,"required":["type"]},"WebsocketSubscriptionImpl":{"type":"object","properties":{"body":{"title":"Any Type","type":["null","number","integer","boolean","string","array","object"],"additionalProperties":true},"type":{"const":"websocket","default":"websocket"}},"title":"Websocket Subscription Impl","additionalProperties":true},"ZWaveAgentLink":{"type":"object","properties":{"deviceEndpoint":{"type":"integer"},"deviceNodeId":{"type":"integer"},"deviceValue":{"type":"string"},"id":{"type":"string","format":"or-agent-id"},"messageMatchFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate"},"messageMatchPredicate":{"oneOf":[{"$ref":"#/definitions/StringPredicate"},{"$ref":"#/definitions/BooleanPredicate"},{"$ref":"#/definitions/DateTimePredicate"},{"$ref":"#/definitions/NumberPredicate"},{"$ref":"#/definitions/RadialGeofencePredicate"},{"$ref":"#/definitions/RectangularGeofencePredicate"},{"$ref":"#/definitions/ArrayPredicate"},{"$ref":"#/definitions/ValueAnyPredicate"},{"$ref":"#/definitions/ValueEmptyPredicate"},{"$ref":"#/definitions/CalendarEventPredicate"}],"description":"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent."},"updateOnWrite":{"type":"boolean","description":"Don\'t expect a response from the protocol just update the attribute immediately on write"},"valueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Defines a value converter map to allow for basic value type conversion; the incoming value will be converted to JSON and if this string matches a key in the converter then the value of that key will be pushed through to the attribute. An example use case is an API that returns \'ACTIVE\'/\'DISABLED\' strings but you want to connect this to a Boolean attribute"},"valueFilters":{"type":"array","items":{"oneOf":[{"$ref":"#/definitions/RegexValueFilter"},{"$ref":"#/definitions/SubStringValueFilter"},{"$ref":"#/definitions/JsonPathFilter"},{"$ref":"#/definitions/MathExpressionValueFilter"}]},"description":"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order"},"writeValue":{"type":"string","description":"String to be used for attribute writes and can contain dynamic placeholders to allow dyanmic value and/or time injection with formatting (see documentation for details) into the string or alternatively write the string through to the protocol as is (static string)","format":"or-multiline"},"writeValueConverter":{"type":"object","patternProperties":{".+":{"type":["null","number","integer","boolean","string","array","object"]}},"description":"Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion"},"type":{"const":"ZWaveAgentLink","default":"ZWaveAgentLink"}},"title":"Z Wave Agent Link","additionalProperties":true,"required":["type"]}},"title":"Agent Link","oneOf":[{"$ref":"#/definitions/MockAgentLink"},{"$ref":"#/definitions/StorageSimulatorAgentLink"},{"$ref":"#/definitions/MQTTAgentLink"},{"$ref":"#/definitions/WebsocketAgentLink"},{"$ref":"#/definitions/KNXAgentLink"},{"$ref":"#/definitions/VelbusAgentLink"},{"$ref":"#/definitions/SimulatorAgentLink"},{"$ref":"#/definitions/DefaultAgentLink"},{"$ref":"#/definitions/BluetoothMeshAgentLink"},{"$ref":"#/definitions/SNMPAgentLink"},{"$ref":"#/definitions/ModbusAgentLink"},{"$ref":"#/definitions/MailAgentLink"},{"$ref":"#/definitions/HTTPAgentLink"},{"$ref":"#/definitions/ZWaveAgentLink"}],"type":"object","properties":{"type":{"const":"AgentLink"}},"required":["type"]}');
}
loadedAgents = await loadAgents();