Skip to content

Commit 72e3938

Browse files
committed
Don't generate schema elements for volatile fields
1 parent c991dc6 commit 72e3938

File tree

5 files changed

+17
-16
lines changed

5 files changed

+17
-16
lines changed

docs/domains/Domain.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,6 @@
302302
"type": "number",
303303
"minimum": 0
304304
},
305-
"modified": {
306-
"type": "boolean"
307-
},
308305
"startTime": {
309306
"description": "RFC 3339 date and time at which the operator started the domain. This will be when the operator begins processing and will precede when the various servers or clusters are available.",
310307
"$ref": "#/definitions/DateTime"
@@ -320,10 +317,7 @@
320317
"description": "A human readable message indicating details about why the domain is in this condition.",
321318
"type": "string"
322319
}
323-
},
324-
"required": [
325-
"modified"
326-
]
320+
}
327321
},
328322
"KubernetesResource": {
329323
"type": "object",

docs/domains/Domain.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ DomainStatus represents information about the status of a domain. Status may tra
4646
| --- | --- | --- |
4747
| conditions | array of [Domain Condition](#domain-condition) | Current service state of domain. |
4848
| message | string | A human readable message indicating details about why the domain is in this condition. |
49-
| modified | boolean | |
5049
| reason | string | A brief CamelCase message indicating details about why the domain is in this state. |
5150
| replicas | number | The number of running managed servers in the WebLogic cluster if there is only one cluster in the domain and where the cluster does not explicitly configure its replicas in a cluster specification. |
5251
| servers | array of [Server Status](#server-status) | Status of WebLogic servers in this domain. |

docs/domains/index.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,9 +1222,6 @@
12221222
"type": "number",
12231223
"minimum": 0.0
12241224
},
1225-
"modified": {
1226-
"type": "boolean"
1227-
},
12281225
"startTime": {
12291226
"description": "RFC 3339 date and time at which the operator started the domain. This will be when the operator begins processing and will precede when the various servers or clusters are available.",
12301227
"$ref": "#/definitions/DateTime"
@@ -1240,10 +1237,7 @@
12401237
"description": "A human readable message indicating details about why the domain is in this condition.",
12411238
"type": "string"
12421239
}
1243-
},
1244-
"required": [
1245-
"modified"
1246-
]
1240+
}
12471241
},
12481242
"KubernetesResource": {
12491243
"type": "object",

json-schema/src/main/java/oracle/kubernetes/json/SchemaGenerator.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,17 @@ void generateFieldIn(Map<String, Object> map, Field field) {
186186
}
187187

188188
private boolean includeInSchema(Field field) {
189-
return !isStatic(field) && !ignoreAsDeprecated(field);
189+
return !isStatic(field) && !isVolatile(field) && !ignoreAsDeprecated(field);
190190
}
191191

192192
private boolean isStatic(Field field) {
193193
return Modifier.isStatic(field.getModifiers());
194194
}
195195

196+
private boolean isVolatile(Field field) {
197+
return Modifier.isVolatile(field.getModifiers());
198+
}
199+
196200
private boolean ignoreAsDeprecated(Field field) {
197201
return !includeDeprecated && field.getAnnotation(Deprecated.class) != null;
198202
}

json-schema/src/test/java/oracle/kubernetes/json/SchemaGeneratorTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ public void generateSchemaForIntArray() throws NoSuchFieldException {
9090
@SuppressWarnings("unused")
9191
private int[] intArray;
9292

93+
@Test
94+
public void doNotGenerateSchemaForVolatileFields() throws NoSuchFieldException {
95+
Object schema = generateForField(getClass().getDeclaredField("ignoreMe"));
96+
97+
assertThat(schema, hasNoJsonPath("$.ignoreMe"));
98+
}
99+
100+
@SuppressWarnings("unused")
101+
private volatile boolean ignoreMe;
102+
93103
@Test
94104
public void generateSchemaForEnum() throws NoSuchFieldException {
95105
Object schema = generateForField(getClass().getDeclaredField("colors"));

0 commit comments

Comments
 (0)