Skip to content

Commit 75a0ee7

Browse files
authored
feat: Add EnumSchema to System.log schema (#1263)
1 parent aa3c0c2 commit 75a0ee7

File tree

4 files changed

+77
-8
lines changed

4 files changed

+77
-8
lines changed

ext/hivemq-edge-openapi-2025.19-SNAPSHOT.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6793,10 +6793,10 @@ components:
67936793
description: The metadata associated with the function
67946794
schema:
67956795
$ref: '#/components/schemas/JsonNode'
6796-
description: the full JSON-Schema describimng the function and its arguments
6796+
description: the full JSON-Schema describing the function and its arguments
67976797
uiSchema:
67986798
$ref: '#/components/schemas/JsonNode'
6799-
description: An optional UI Schema to customise the rendering of the configuraton form
6799+
description: An optional UI Schema to customise the rendering of the configuration form
68006800
required:
68016801
- functionId
68026802
- metadata

hivemq-edge-openapi/openapi/components/schemas/FunctionSpecs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ properties:
99
description: The metadata associated with the function
1010
schema:
1111
$ref: ./JsonNode.yaml
12-
description: the full JSON-Schema describimng the function and its arguments
12+
description: the full JSON-Schema describing the function and its arguments
1313
uiSchema:
1414
$ref: ./JsonNode.yaml
15-
description: An optional UI Schema to customise the rendering of the configuraton form
15+
description: An optional UI Schema to customise the rendering of the configuration form
1616
required:
1717
- functionId
1818
- metadata
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright 2019-present HiveMQ GmbH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.hivemq.util;
18+
19+
import com.fasterxml.jackson.databind.ObjectMapper;
20+
import com.fasterxml.jackson.databind.SerializationFeature;
21+
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
22+
import org.jetbrains.annotations.NotNull;
23+
24+
public final class ObjectMapperBuilder {
25+
private boolean indentOutput;
26+
private boolean javaTimeModule;
27+
private boolean failOnEmptyBeans;
28+
29+
private ObjectMapperBuilder() {
30+
indentOutput = false;
31+
javaTimeModule = false;
32+
failOnEmptyBeans = false;
33+
}
34+
35+
public static @NotNull ObjectMapperBuilder builder() {
36+
return new ObjectMapperBuilder();
37+
}
38+
39+
public @NotNull ObjectMapperBuilder enableIndentOutput() {
40+
indentOutput = true;
41+
return this;
42+
}
43+
44+
public @NotNull ObjectMapperBuilder enableJavaTimeModule() {
45+
javaTimeModule = true;
46+
return this;
47+
}
48+
49+
public @NotNull ObjectMapperBuilder enableFailOnEmptyBeans() {
50+
failOnEmptyBeans = true;
51+
return this;
52+
}
53+
54+
public @NotNull ObjectMapper build() {
55+
final ObjectMapper objectMapper = new ObjectMapper();
56+
if (indentOutput) {
57+
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
58+
} else {
59+
objectMapper.disable(SerializationFeature.INDENT_OUTPUT);
60+
}
61+
if (javaTimeModule) {
62+
objectMapper.registerModule(new JavaTimeModule());
63+
}
64+
if (failOnEmptyBeans) {
65+
objectMapper.enable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
66+
} else {
67+
objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
68+
}
69+
return objectMapper;
70+
}
71+
}

hivemq-edge/src/main/java/com/hivemq/util/ObjectMapperUtil.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@
1717
package com.hivemq.util;
1818

1919
import com.fasterxml.jackson.databind.ObjectMapper;
20-
import com.fasterxml.jackson.databind.SerializationFeature;
21-
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
2220

2321
public final class ObjectMapperUtil {
2422
public final static ObjectMapper NO_PRETTY_PRINT_WITH_JAVA_TIME =
25-
new ObjectMapper().registerModule(new JavaTimeModule()).disable(SerializationFeature.INDENT_OUTPUT);
23+
ObjectMapperBuilder.builder().enableJavaTimeModule().build();
2624

2725
public final static ObjectMapper PRETTY_PRINT_WITH_JAVA_TIME =
28-
new ObjectMapper().registerModule(new JavaTimeModule()).enable(SerializationFeature.INDENT_OUTPUT);
26+
ObjectMapperBuilder.builder().enableJavaTimeModule().enableIndentOutput().build();
2927

3028
private ObjectMapperUtil() {
3129
}

0 commit comments

Comments
 (0)