Skip to content

Commit ecbf0bd

Browse files
committed
Address missing types
1 parent 69b13da commit ecbf0bd

File tree

4 files changed

+48
-41
lines changed

4 files changed

+48
-41
lines changed

docs/domains/Domain.md

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ DomainSpec is a description of a domain.
1919
| adminServer | [Admin Server](#admin-server) | Configuration for the admin server. |
2020
| clusters | array of [Cluster](#cluster) | Configuration for the clusters. |
2121
| configOverrides | string | The name of the config map for optional WebLogic configuration overrides. |
22-
| configOverrideSecrets | array of | A list of names of the secrets for optional WebLogic configuration overrides. |
22+
| configOverrideSecrets | array of string | A list of names of the secrets for optional WebLogic configuration overrides. |
2323
| domainHome | string | The folder for the Weblogic Domain. Not required. Defaults to /shared/domains/domains/domainUID if domainHomeInImage is false Defaults to /u01/oracle/user_projects/domains/ if domainHomeInImage is true |
2424
| domainHomeInImage | boolean | True if this domain's home is defined in the docker image for the domain. Defaults to true. |
2525
| domainUID | string | Domain unique identifier. Must be unique across the Kubernetes cluster. Not required. Defaults to the value of metadata.name |
@@ -49,7 +49,7 @@ DomainStatus represents information about the status of a domain. Status may tra
4949
| reason | string | A brief CamelCase message indicating details about why the domain is in this state. |
5050
| 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. |
5151
| servers | array of [Server Status](#server-status) | Status of WebLogic servers in this domain. |
52-
| startTime | | 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. |
52+
| startTime | DateTime | 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. |
5353

5454
### Admin Server
5555

@@ -99,12 +99,12 @@ ServerPod describes the configuration for a Kubernetes pod for a server.
9999

100100
| Name | Type | Description |
101101
| --- | --- | --- |
102-
| annotations | | The annotations to be attached to generated resources. |
102+
| annotations | Map | The annotations to be attached to generated resources. |
103103
| containerSecurityContext | [Security Context](k8s1.9.0.md#security-context) | Container-level security attributes. Will override any matching pod-level attributes. |
104104
| env | array of [Env Var](k8s1.9.0.md#env-var) | A list of environment variables to add to a server |
105-
| labels | | The labels to be attached to generated resources. The label names must not start with 'weblogic.'. |
105+
| labels | Map | The labels to be attached to generated resources. The label names must not start with 'weblogic.'. |
106106
| livenessProbe | [Probe Tuning](#probe-tuning) | Settings for the liveness probe associated with a server. |
107-
| nodeSelector | | Selector which must match a node's labels for the pod to be scheduled on that node. |
107+
| nodeSelector | Map | Selector which must match a node's labels for the pod to be scheduled on that node. |
108108
| podSecurityContext | [Pod Security Context](k8s1.9.0.md#pod-security-context) | Pod-level security attributes. |
109109
| readinessProbe | [Probe Tuning](#probe-tuning) | Settings for the readiness probe associated with a server. |
110110
| resources | [Resource Requirements](k8s1.9.0.md#resource-requirements) | Memory and cpu minimum requirements and limits for the server. |
@@ -115,15 +115,15 @@ ServerPod describes the configuration for a Kubernetes pod for a server.
115115

116116
| Name | Type | Description |
117117
| --- | --- | --- |
118-
| annotations | | The annotations to be attached to generated resources. |
119-
| labels | | The labels to be attached to generated resources. The label names must not start with 'weblogic.'. |
118+
| annotations | Map | The annotations to be attached to generated resources. |
119+
| labels | Map | The labels to be attached to generated resources. The label names must not start with 'weblogic.'. |
120120

121121
### Domain Condition
122122

123123
| Name | Type | Description |
124124
| --- | --- | --- |
125-
| lastProbeTime | | Last time we probed the condition. |
126-
| lastTransitionTime | | Last time the condition transitioned from one status to another. |
125+
| lastProbeTime | DateTime | Last time we probed the condition. |
126+
| lastTransitionTime | DateTime | Last time the condition transitioned from one status to another. |
127127
| message | string | Human-readable message indicating details about last transition. |
128128
| reason | string | Unique, one-word, CamelCase reason for the condition's last transition. |
129129
| status | string | Status is the status of the condition. Can be True, False, Unknown. Required |
@@ -139,22 +139,12 @@ ServerPod describes the configuration for a Kubernetes pod for a server.
139139
| serverName | string | WebLogic server name. Required |
140140
| state | string | Current state of this WebLogic server. Required |
141141

142-
### Date Time
143-
144-
| Name | Type | Description |
145-
| --- | --- | --- |
146-
147142
### Admin Service
148143

149144
| Name | Type | Description |
150145
| --- | --- | --- |
151146
| channels | array of [Channel](#channel) | Specifies which of the admin server's WebLogic channels should be exposed outside the Kubernetes cluster via a node port service, along with the node port for each channel. If not specified, the admin server's node port service will not be created. |
152147

153-
### Map
154-
155-
| Name | Type | Description |
156-
| --- | --- | --- |
157-
158148
### Probe Tuning
159149

160150
| Name | Type | Description |
@@ -167,7 +157,7 @@ ServerPod describes the configuration for a Kubernetes pod for a server.
167157

168158
| Name | Type | Description |
169159
| --- | --- | --- |
170-
| activationTime | | RFC 3339 date and time at which the server started. |
160+
| activationTime | DateTime | RFC 3339 date and time at which the server started. |
171161
| overallHealth | string | Server health of this WebLogic server. |
172162
| subsystems | array of [Subsystem Health](#subsystem-health) | Status of unhealthy subsystems, if any. |
173163

@@ -186,4 +176,4 @@ Describes a single channel used by the admin server.
186176
| --- | --- | --- |
187177
| health | string | Server health of this WebLogic server. Required |
188178
| subsystemName | string | Name of subsystem providing symptom information. Required |
189-
| symptoms | array of | Symptoms provided by the reporting subsystem. |
179+
| symptoms | array of string | Symptoms provided by the reporting subsystem. |

docs/domains/k8s1.9.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ObjectMeta is metadata that all persisted resources must have, which includes al
1414
| creationTimestamp | [Time](#time) | CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.<br/><br/>Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata |
1515
| deletionGracePeriodSeconds | | Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only. |
1616
| deletionTimestamp | [Time](#time) | DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.<br/><br/>Populated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata |
17-
| finalizers | array of | Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. |
17+
| finalizers | array of string | Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. |
1818
| generateName | string | GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.<br/><br/>If this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).<br/><br/>Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#idempotency |
1919
| generation | | A sequence number representing a specific generation of the desired state. Populated by the system. Read-only. |
2020
| initializers | [Initializers](#initializers) | An initializer is a controller which enforces some system invariant at object creation time. This field is a list of initializers that have not yet acted on this object. If nil or empty, this object has been completely initialized. Otherwise, the object is considered uninitialized and is hidden (in list/watch and get calls) from clients that haven't explicitly asked to observe uninitialized objects.<br/><br/>When an object is created, the system will populate this list with the current set of initializers. Only privileged users may set or modify this list. Once it is empty, it may not be modified further by any user. |

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

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.io.IOException;
88
import java.net.URL;
99
import java.util.ArrayList;
10+
import java.util.Arrays;
1011
import java.util.HashMap;
1112
import java.util.HashSet;
1213
import java.util.List;
@@ -146,16 +147,20 @@ String getString() {
146147
case "string":
147148
return specifiedType;
148149
case "array":
149-
return "array of " + getReference();
150+
Type subType = getItems();
151+
return "array of " + subType.getString();
150152
default:
151153
return getReference();
152154
}
153155
}
154156

157+
private Type getItems() {
158+
return new Type((Map<String, Object>) fieldMap.get("items"));
159+
}
160+
155161
private String getReference() {
156162
Reference reference = createReference(getReferenceString());
157-
if (!reference.shouldGenerateReference()) return "";
158-
return String.format("[%s](%s)", reference.getStructureName(), reference.getLink());
163+
return reference.getString();
159164
}
160165

161166
private String getReferenceString() {
@@ -186,6 +191,10 @@ private Reference(String typeName) {
186191
this.typeName = typeName;
187192
}
188193

194+
String getString() {
195+
return String.format("[%s](%s)", getStructureName(), getLink());
196+
}
197+
189198
String getTypeName() {
190199
return typeName;
191200
}
@@ -199,8 +208,6 @@ private String getStructureName() {
199208
return toStructureName(typeName);
200209
}
201210

202-
abstract boolean shouldGenerateReference();
203-
204211
abstract boolean isLocal();
205212
}
206213

@@ -215,8 +222,8 @@ boolean isLocal() {
215222
}
216223

217224
@Override
218-
boolean shouldGenerateReference() {
219-
return false;
225+
String getString() {
226+
return "";
220227
}
221228
}
222229

@@ -225,11 +232,13 @@ private static String toLocalTypeName(String ref) {
225232
return typeName.substring(typeName.lastIndexOf(".") + 1);
226233
}
227234

235+
private static List NON_REFERENCE_TYPES = Arrays.asList("Map", "DateTime");
236+
228237
private class LocalReference extends Reference {
229238

230239
LocalReference(String ref) {
231240
super(toLocalTypeName(ref));
232-
addReferenceIfNeeded(getTypeName());
241+
if (isReferenceType()) addReferenceIfNeeded(getTypeName());
233242
}
234243

235244
@Override
@@ -238,8 +247,13 @@ boolean isLocal() {
238247
}
239248

240249
@Override
241-
boolean shouldGenerateReference() {
242-
return !(getTypeName().equals("DateTime")) && !(getTypeName().equals("Map"));
250+
String getString() {
251+
if (isReferenceType()) return super.getString();
252+
else return getTypeName();
253+
}
254+
255+
private boolean isReferenceType() {
256+
return !NON_REFERENCE_TYPES.contains(getTypeName());
243257
}
244258
}
245259

@@ -261,11 +275,6 @@ boolean isLocal() {
261275
return false;
262276
}
263277

264-
@Override
265-
boolean shouldGenerateReference() {
266-
return true;
267-
}
268-
269278
@Override
270279
String getLink() {
271280
return getKubernetesSchemaLink() + super.getLink();

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.io.IOException;
1313
import java.lang.reflect.Field;
1414
import java.util.HashMap;
15+
import java.util.List;
1516
import java.util.Map;
1617
import org.joda.time.DateTime;
1718
import org.junit.Test;
@@ -50,7 +51,7 @@ private Map<String, Object> generateSchemaForField(Field field) {
5051
@Test
5152
public void whenPropertyTypeIsDateTime_doNotGenerateReference() throws NoSuchFieldException {
5253
String markdown = generateForProperty(getClass().getDeclaredField("dateTime"));
53-
assertThat(markdown, containsString(tableEntry("dateTime", "")));
54+
assertThat(markdown, containsString(tableEntry("dateTime", "DateTime", "")));
5455
}
5556

5657
@SuppressWarnings("unused")
@@ -59,12 +60,21 @@ public void whenPropertyTypeIsDateTime_doNotGenerateReference() throws NoSuchFie
5960
@Test
6061
public void whenPropertyTypeIsMap_doNotGenerateReference() throws NoSuchFieldException {
6162
String markdown = generateForProperty(getClass().getDeclaredField("notes"));
62-
assertThat(markdown, containsString(tableEntry("notes", "")));
63+
assertThat(markdown, containsString(tableEntry("notes", "Map", "")));
6364
}
6465

6566
@SuppressWarnings("unused")
6667
private Map<String, String> notes;
6768

69+
@Test
70+
public void whenPropertyTypeIsArrayOfStrings_generateType() throws NoSuchFieldException {
71+
String markdown = generateForProperty(getClass().getDeclaredField("myList"));
72+
assertThat(markdown, containsString(tableEntry("myList", "array of string", "")));
73+
}
74+
75+
@SuppressWarnings("unused")
76+
private List<String> myList;
77+
6878
@Test
6979
public void whenPropertyTypeIsReferenceWithDescription_includeBoth() throws NoSuchFieldException {
7080
String markdown = generateForProperty(getClass().getDeclaredField("simpleUsage"));
@@ -283,6 +293,4 @@ public void whenExternalSchemaSpecified_generateMarkdownForItsDependencies() thr
283293
generator.getKubernetesSchemaMarkdown(),
284294
containsString(String.join("\n", "### Env Var Source")));
285295
}
286-
287-
// todo description for objects
288296
}

0 commit comments

Comments
 (0)