This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 3eaee549be TODO-275: CRTP-convert the jsonschema bean family (10.0.0
breaking change)
3eaee549be is described below
commit 3eaee549be66794cbaaf1f6720caf5f1193e8aad
Author: James Bognar <[email protected]>
AuthorDate: Tue Jul 21 12:59:31 2026 -0400
TODO-275: CRTP-convert the jsonschema bean family (10.0.0 breaking change)
Generified JsonSchema and JsonSchemaProperty into self-typed CRTP roots
(JsonSchema<SELF extends JsonSchema<SELF>>, JsonSchemaProperty<SELF extends
JsonSchemaProperty<SELF>>), mirroring the shipped
BasicHttpEntity/BasicResource
conversions (TODO-271/274). The ~185 covariant setter-narrowing overrides on
JsonSchemaProperty, JsonSchemaPropertySimpleArray, and JsonSchemaRef were
removed; fluent setters now return the leaf type for free via inheritance.
Raw-type references reactor-wide were swept to the <?> wildcard where needed
to keep unchecked-raw warnings off. Tests updated for the diamond-form
direct
instantiation (new JsonSchema<>()) accepted by the spike gate; marshalling
(JSON/XML/HTML round-trips) is byte-identical to pre-conversion behavior.
Family 1 of 4 in the TODO-272 CRTP-boilerplate discovery's conversion order
(jsonschema -> atom -> html5 -> SerializerWriter).
Co-authored-by: Cursor <[email protected]>
---
.../apache/juneau/bean/jsonschema/JsonSchema.java | 398 +++++++++++----------
.../juneau/bean/jsonschema/JsonSchemaArray.java | 6 +-
.../bean/jsonschema/JsonSchemaBeanGenerator.java | 8 +-
.../juneau/bean/jsonschema/JsonSchemaMap.java | 8 +-
.../juneau/bean/jsonschema/JsonSchemaProperty.java | 392 +-------------------
.../jsonschema/JsonSchemaPropertySimpleArray.java | 369 +------------------
.../juneau/bean/jsonschema/JsonSchemaRef.java | 386 +-------------------
.../bean/jsonschema/JsonSchemaValidator.java | 24 +-
.../juneau/bean/jsonschema/JsonSchemaMap_Test.java | 6 +-
.../JsonSchemaPropertySimpleArray_Test.java | 3 +-
.../bean/jsonschema/JsonSchemaProperty_Test.java | 42 ++-
.../juneau/bean/jsonschema/JsonSchemaRef_Test.java | 7 +-
.../bean/jsonschema/JsonSchemaValidator_Test.java | 4 +-
.../juneau/bean/jsonschema/JsonSchema_Test.java | 4 +-
.../juneau/bean/jsonschema/JsonSchema_Test.java | 4 +-
15 files changed, 281 insertions(+), 1380 deletions(-)
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchema.java
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchema.java
index c8362ed3ab..18900a890e 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchema.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchema.java
@@ -196,12 +196,15 @@ import org.apache.juneau.marshall.swap.*;
* <li class='link'><a
href="https://json-schema.org/draft/2020-12/json-schema-validation.html">JSON
Schema 2020-12 Validation</a>
* <li class='link'><a class="doclink"
href="https://juneau.apache.org/docs/topics/JuneauBeanJsonSchema">juneau-bean-jsonschema</a>
* </ul>
+ *
+ * @param <SELF> The self type for fluent setters.
*/
@Marshalled(typeName = "schema")
@SuppressWarnings({
- "java:S116" // Field names follow OpenAPI/JSON Schema spec
+ "java:S116", // Field names follow OpenAPI/JSON Schema spec
+ "java:S119" // 'SELF' (CRTP self-type) is intentional and clearer than
a single-letter name.
})
-public class JsonSchema {
+public class JsonSchema<SELF extends JsonSchema<SELF>> {
/**
* Used during parsing to convert the
<property>additionalItems</property> property to the correct class type.
@@ -321,14 +324,14 @@ public class JsonSchema {
private String description;
private JsonType typeJsonType; // JsonType
representation of type
private JsonTypeArray typeJsonTypeArray; // JsonTypeArray
representation of type
- private Map<String,JsonSchema> definitions; // Retained for
backward compatibility
- private Map<String,JsonSchema> defs; // Draft
2020-12: $defs
- private Map<String,JsonSchema> properties;
- private Map<String,JsonSchema> patternProperties;
- private Map<String,JsonSchema> dependencies; // Retained for
backward compatibility
- private Map<String,JsonSchema> dependentSchemas; // Draft 2019-09+
+ private Map<String,JsonSchema<?>> definitions; // Retained
for backward compatibility
+ private Map<String,JsonSchema<?>> defs; // Draft
2020-12: $defs
+ private Map<String,JsonSchema<?>> properties;
+ private Map<String,JsonSchema<?>> patternProperties;
+ private Map<String,JsonSchema<?>> dependencies; // Retained
for backward compatibility
+ private Map<String,JsonSchema<?>> dependentSchemas; // Draft
2019-09+
private Map<String,List<String>> dependentRequired; // Draft 2019-09+
- private JsonSchema itemsSchema; // JsonSchema
representation of items
+ private JsonSchema<?> itemsSchema; // JsonSchema
representation of items
private JsonSchemaArray itemsSchemaArray; //
JsonSchemaArray representation of items
private JsonSchemaArray prefixItems; // Draft
2020-12: replaces tuple validation
private Number multipleOf;
@@ -341,7 +344,7 @@ public class JsonSchema {
private String pattern;
private Boolean additionalItemsBoolean; // Boolean
representation of additionalItems
private JsonSchemaArray additionalItemsSchemaArray; //
JsonSchemaArray representation of additionalItems
- private JsonSchema unevaluatedItems; // Draft 2019-09+
+ private JsonSchema<?> unevaluatedItems; // Draft
2019-09+
private Integer maxItems;
private Integer minItems;
private Boolean uniqueItems;
@@ -349,18 +352,18 @@ public class JsonSchema {
private Integer minProperties;
private List<String> required;
private Boolean additionalPropertiesBoolean; // Boolean
representation of additionalProperties
- private JsonSchema additionalPropertiesSchema; // JsonSchema
representation of additionalProperties
- private JsonSchema unevaluatedProperties; // Draft 2019-09+
+ private JsonSchema<?> additionalPropertiesSchema; // JsonSchema
representation of additionalProperties
+ private JsonSchema<?> unevaluatedProperties; // Draft
2019-09+
private List<Object> enum_; // Changed to
Object to support any type
private Object const_; // Draft 06+
private List<Object> examples; // Draft 06+
- private List<JsonSchema> allOf;
- private List<JsonSchema> anyOf;
- private List<JsonSchema> oneOf;
- private JsonSchema not;
- private JsonSchema if_; // Draft 07+
- private JsonSchema then_; // Draft 07+
- private JsonSchema else_; // Draft 07+
+ private List<JsonSchema<?>> allOf;
+ private List<JsonSchema<?>> anyOf;
+ private List<JsonSchema<?>> oneOf;
+ private JsonSchema<?> not;
+ private JsonSchema<?> if_; // Draft 07+
+ private JsonSchema<?> then_; // Draft 07+
+ private JsonSchema<?> else_; // Draft 07+
private Boolean readOnly; // Draft 07+
private Boolean writeOnly; // Draft 07+
private String format; //
Annotation-level keyword
@@ -374,7 +377,7 @@ public class JsonSchema {
private JsonSchemaMap schemaMap;
- private JsonSchema master = this;
+ private JsonSchema<?> master = this;
// @formatter:on
/**
@@ -382,13 +385,18 @@ public class JsonSchema {
*/
public JsonSchema() { /* Empty constructor. */ }
+ @SuppressWarnings("unchecked")
+ private SELF self() {
+ return (SELF) this;
+ }
+
/**
* Generates a {@link JsonSchema} bean from the specified type using
{@link JsonSchemaBeanGenerator#DEFAULT}.
*
* @param type The type to generate a schema for. Must not be
<jk>null</jk>.
* @return The generated schema bean, or <jk>null</jk> if a schema
could not be generated for the type.
*/
- public static JsonSchema of(Type type) {
+ public static JsonSchema<?> of(Type type) {
return JsonSchemaBeanGenerator.DEFAULT.generate(type);
}
@@ -398,7 +406,7 @@ public class JsonSchema {
* @param type The class to generate a schema for. Must not be
<jk>null</jk>.
* @return The generated schema bean, or <jk>null</jk> if a schema
could not be generated for the class.
*/
- public static JsonSchema of(Class<?> type) {
+ public static JsonSchema<?> of(Class<?> type) {
return JsonSchemaBeanGenerator.DEFAULT.generate(type);
}
@@ -409,12 +417,12 @@ public class JsonSchema {
* The list of items to append to the
<property>additionalItems</property> property on this bean.
* @return This object.
*/
- public JsonSchema addAdditionalItems(JsonSchema...value) {
+ public SELF addAdditionalItems(JsonSchema<?>...value) {
if (this.additionalItemsSchemaArray == null)
this.additionalItemsSchemaArray = new JsonSchemaArray();
this.additionalItemsSchemaArray.addAll(value);
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -423,10 +431,10 @@ public class JsonSchema {
* @param value The list of items to append to the
<property>allOf</property> property on this bean.
* @return This object.
*/
- public JsonSchema addAllOf(JsonSchema...value) {
+ public SELF addAllOf(JsonSchema<?>...value) {
setMasterOn(value);
this.allOf = addAll(this.allOf, value);
- return this;
+ return self();
}
/**
@@ -435,13 +443,13 @@ public class JsonSchema {
* @param value The list of items to append to the
<property>anyOf</property> property on this bean.
* @return This object.
*/
- public JsonSchema addAnyOf(JsonSchema...value) {
+ public SELF addAnyOf(JsonSchema<?>...value) {
if (this.anyOf == null)
this.anyOf = new LinkedList<>();
setMasterOn(value);
for (var s : value)
this.anyOf.add(s);
- return this;
+ return self();
}
/**
@@ -451,12 +459,12 @@ public class JsonSchema {
* @param value The value in the defs map entry. Can be <jk>null</jk>.
* @return This object.
*/
- public JsonSchema addDef(String name, JsonSchema value) {
+ public SELF addDef(String name, JsonSchema<?> value) {
if (this.defs == null)
this.defs = map();
this.defs.put(name, value);
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -466,12 +474,12 @@ public class JsonSchema {
* @param value The value in the definitions map entry. Can be
<jk>null</jk>.
* @return This object.
*/
- public JsonSchema addDefinition(String name, JsonSchema value) {
+ public SELF addDefinition(String name, JsonSchema<?> value) {
if (this.definitions == null)
this.definitions = map();
this.definitions.put(name, value);
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -481,12 +489,12 @@ public class JsonSchema {
* @param value The value of the entry in the dependencies map. Can be
<jk>null</jk>.
* @return This object.
*/
- public JsonSchema addDependency(String name, JsonSchema value) {
+ public SELF addDependency(String name, JsonSchema<?> value) {
if (this.dependencies == null)
this.dependencies = map();
this.dependencies.put(name, value);
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -496,11 +504,11 @@ public class JsonSchema {
* @param value The value of the entry in the dependentRequired map.
Can be <jk>null</jk>.
* @return This object.
*/
- public JsonSchema addDependentRequired(String name, List<String> value)
{
+ public SELF addDependentRequired(String name, List<String> value) {
if (this.dependentRequired == null)
this.dependentRequired = map();
this.dependentRequired.put(name, value);
- return this;
+ return self();
}
/**
@@ -510,12 +518,12 @@ public class JsonSchema {
* @param value The value of the entry in the dependentSchemas map.
Can be <jk>null</jk>.
* @return This object.
*/
- public JsonSchema addDependentSchema(String name, JsonSchema value) {
+ public SELF addDependentSchema(String name, JsonSchema<?> value) {
if (this.dependentSchemas == null)
this.dependentSchemas = map();
this.dependentSchemas.put(name, value);
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -524,12 +532,12 @@ public class JsonSchema {
* @param value The list of items to append to the
<property>enum</property> property on this bean.
* @return This object.
*/
- public JsonSchema addEnum(Object...value) {
+ public SELF addEnum(Object...value) {
if (this.enum_ == null)
this.enum_ = new LinkedList<>();
for (var e : value)
this.enum_.add(e);
- return this;
+ return self();
}
/**
@@ -538,12 +546,12 @@ public class JsonSchema {
* @param value The list of items to append to the
<property>examples</property> property on this bean.
* @return This object.
*/
- public JsonSchema addExamples(Object...value) {
+ public SELF addExamples(Object...value) {
if (this.examples == null)
this.examples = new LinkedList<>();
for (var e : value)
this.examples.add(e);
- return this;
+ return self();
}
/**
@@ -552,12 +560,12 @@ public class JsonSchema {
* @param value The list of items to append to the
<property>items</property> property on this bean.
* @return This object.
*/
- public JsonSchema addItems(JsonSchema...value) {
+ public SELF addItems(JsonSchema<?>...value) {
if (this.itemsSchemaArray == null)
this.itemsSchemaArray = new JsonSchemaArray();
this.itemsSchemaArray.addAll(value);
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -566,13 +574,13 @@ public class JsonSchema {
* @param value The list of items to append to the
<property>oneOf</property> property on this bean.
* @return This object.
*/
- public JsonSchema addOneOf(JsonSchema...value) {
+ public SELF addOneOf(JsonSchema<?>...value) {
if (this.oneOf == null)
this.oneOf = new LinkedList<>();
setMasterOn(value);
for (var s : value)
this.oneOf.add(s);
- return this;
+ return self();
}
/**
@@ -585,7 +593,7 @@ public class JsonSchema {
* @return This object.
* @throws BeanRuntimeException If property is found without a set
<property>name</property> property.
*/
- public JsonSchema addPatternProperties(JsonSchemaProperty...value) {
+ public SELF addPatternProperties(JsonSchemaProperty<?>...value) {
if (this.patternProperties == null)
this.patternProperties = map();
for (var p : value) {
@@ -594,7 +602,7 @@ public class JsonSchema {
setMasterOn(p);
this.patternProperties.put(p.getName(), p);
}
- return this;
+ return self();
}
/**
@@ -603,12 +611,12 @@ public class JsonSchema {
* @param value The list of items to append to the
<property>prefixItems</property> property on this bean.
* @return This object.
*/
- public JsonSchema addPrefixItems(JsonSchema...value) {
+ public SELF addPrefixItems(JsonSchema<?>...value) {
if (this.prefixItems == null)
this.prefixItems = new JsonSchemaArray();
this.prefixItems.addAll(value);
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -621,7 +629,7 @@ public class JsonSchema {
* @return This object.
* @throws BeanRuntimeException If property is found without a set
<property>name</property> property.
*/
- public JsonSchema addProperties(JsonSchema...value) {
+ public SELF addProperties(JsonSchema<?>...value) {
if (this.properties == null)
this.properties = map();
for (var p : value) {
@@ -630,7 +638,7 @@ public class JsonSchema {
setMasterOn(p);
this.properties.put(p.getName(), p);
}
- return this;
+ return self();
}
/**
@@ -639,12 +647,12 @@ public class JsonSchema {
* @param value The list of items to append to the
<property>required</property> property on this bean.
* @return This object.
*/
- public JsonSchema addRequired(JsonSchemaProperty...value) {
+ public SELF addRequired(JsonSchemaProperty<?>...value) {
if (this.required == null)
this.required = new LinkedList<>();
for (var p : value)
this.required.add(p.getName());
- return this;
+ return self();
}
/**
@@ -653,11 +661,11 @@ public class JsonSchema {
* @param value The list of items to append to the
<property>required</property> property on this bean.
* @return This object.
*/
- public JsonSchema addRequired(List<String> value) {
+ public SELF addRequired(List<String> value) {
if (this.required == null)
this.required = new LinkedList<>();
value.forEach(x -> this.required.add(x));
- return this;
+ return self();
}
/**
@@ -666,12 +674,12 @@ public class JsonSchema {
* @param value The list of items to append to the
<property>required</property> property on this bean.
* @return This object.
*/
- public JsonSchema addRequired(String...value) {
+ public SELF addRequired(String...value) {
if (this.required == null)
this.required = new LinkedList<>();
for (var r : value)
this.required.add(r);
- return this;
+ return self();
}
/**
@@ -680,11 +688,11 @@ public class JsonSchema {
* @param value The list of items to append to the
<property>type</property> property on this bean.
* @return This object.
*/
- public JsonSchema addTypes(JsonType...value) {
+ public SELF addTypes(JsonType...value) {
if (this.typeJsonTypeArray == null)
this.typeJsonTypeArray = new JsonTypeArray();
this.typeJsonTypeArray.addAll(value);
- return this;
+ return self();
}
/**
@@ -724,7 +732,7 @@ public class JsonSchema {
* @return The currently set value, or <jk>null</jk> if the property is
not set, or is set as a {@link Boolean}.
*/
@BeanIgnore
- public List<JsonSchema> getAdditionalItemsAsSchemaArray() { return
u(additionalItemsSchemaArray); }
+ public List<JsonSchema<?>> getAdditionalItemsAsSchemaArray() { return
u(additionalItemsSchemaArray); }
/**
* Bean property getter: <property>additionalProperties</property>.
@@ -763,21 +771,21 @@ public class JsonSchema {
* @return The currently set value, or <jk>null</jk> if the property is
not set, or is set as a {@link Boolean}.
*/
@BeanIgnore
- public JsonSchema getAdditionalPropertiesAsSchema() { return
additionalPropertiesSchema; }
+ public JsonSchema<?> getAdditionalPropertiesAsSchema() { return
additionalPropertiesSchema; }
/**
* Bean property getter: <property>allOf</property>.
*
* @return The value of the <property>allOf</property> property on this
bean, or <jk>null</jk> if it is not set.
*/
- public List<JsonSchema> getAllOf() { return u(allOf); }
+ public List<JsonSchema<?>> getAllOf() { return u(allOf); }
/**
* Bean property getter: <property>anyOf</property>.
*
* @return The value of the <property>anyOf</property> property on this
bean, or <jk>null</jk> if it is not set.
*/
- public List<JsonSchema> getAnyOf() { return u(anyOf); }
+ public List<JsonSchema<?>> getAnyOf() { return u(anyOf); }
/**
* Bean property getter: <property>const</property>.
@@ -840,7 +848,7 @@ public class JsonSchema {
* @return
* The value of the <property>definitions</property> property on
this bean, or <jk>null</jk> if it is not set.
*/
- public Map<String,JsonSchema> getDefinitions() {
+ public Map<String,JsonSchema<?>> getDefinitions() {
return nn(definitions) ? definitions : defs; // Fall back to
$defs for compatibility
}
@@ -854,7 +862,7 @@ public class JsonSchema {
* @return The value of the <property>$defs</property> property on this
bean, or <jk>null</jk> if it is not set.
*/
@BeanProp("$defs")
- public Map<String,JsonSchema> getDefs() {
+ public Map<String,JsonSchema<?>> getDefs() {
return defs; // Return only defs, not definitions (to avoid
double serialization)
}
@@ -864,7 +872,7 @@ public class JsonSchema {
* @return
* The value of the <property>dependencies</property> property on
this bean, or <jk>null</jk> if it is not set.
*/
- public Map<String,JsonSchema> getDependencies() { return
u(dependencies); }
+ public Map<String,JsonSchema<?>> getDependencies() { return
u(dependencies); }
/**
* Bean property getter: <property>format</property>.
@@ -891,7 +899,7 @@ public class JsonSchema {
*
* @return The value of the <property>dependentSchemas</property>
property on this bean, or <jk>null</jk> if it is not set.
*/
- public Map<String,JsonSchema> getDependentSchemas() { return
u(dependentSchemas); }
+ public Map<String,JsonSchema<?>> getDependentSchemas() { return
u(dependentSchemas); }
/**
* Bean property getter: <property>description</property>.
@@ -909,7 +917,7 @@ public class JsonSchema {
* @return The value of the <property>else</property> property on this
bean, or <jk>null</jk> if it is not set.
*/
@BeanProp("else")
- public JsonSchema getElse() { return else_; }
+ public JsonSchema<?> getElse() { return else_; }
/**
* Bean property getter: <property>enum</property>.
@@ -994,7 +1002,7 @@ public class JsonSchema {
* @return The value of the <property>if</property> property on this
bean, or <jk>null</jk> if it is not set.
*/
@BeanProp("if")
- public JsonSchema getIf() { return if_; }
+ public JsonSchema<?> getIf() { return if_; }
/**
* Bean property getter: <property>items</property>.
@@ -1019,7 +1027,7 @@ public class JsonSchema {
* @return The currently set value, or <jk>null</jk> if the property is
not set, or is set as a {@link JsonSchemaArray}.
*/
@BeanIgnore
- public JsonSchema getItemsAsSchema() { return itemsSchema; }
+ public JsonSchema<?> getItemsAsSchema() { return itemsSchema; }
/**
* Bean property getter: <property>items</property>.
@@ -1113,14 +1121,14 @@ public class JsonSchema {
*
* @return The value of the <property>not</property> property on this
bean, or <jk>null</jk> if it is not set.
*/
- public JsonSchema getNot() { return not; }
+ public JsonSchema<?> getNot() { return not; }
/**
* Bean property getter: <property>oneOf</property>.
*
* @return The value of the <property>oneOf</property> property on this
bean, or <jk>null</jk> if it is not set.
*/
- public List<JsonSchema> getOneOf() { return u(oneOf); }
+ public List<JsonSchema<?>> getOneOf() { return u(oneOf); }
/**
* Bean property getter: <property>pattern</property>.
@@ -1136,7 +1144,7 @@ public class JsonSchema {
* The value of the <property>patternProperties</property>
property on this bean, or <jk>null</jk> if it is
* not set.
*/
- public Map<String,JsonSchema> getPatternProperties() { return
u(patternProperties); }
+ public Map<String,JsonSchema<?>> getPatternProperties() { return
u(patternProperties); }
/**
* Bean property getter: <property>prefixItems</property>.
@@ -1153,7 +1161,7 @@ public class JsonSchema {
*
* @return The value of the <property>properties</property> property on
this bean, or <jk>null</jk> if it is not set.
*/
- public Map<String,JsonSchema> getProperties() { return u(properties); }
+ public Map<String,JsonSchema<?>> getProperties() { return
u(properties); }
/**
* Returns the property with the specified name.
@@ -1164,7 +1172,7 @@ public class JsonSchema {
* @param name The property name. Can be <jk>null</jk>.
* @return The property with the specified name, or <jk>null</jk> if no
property is specified.
*/
- public JsonSchema getProperty(String name) {
+ public JsonSchema<?> getProperty(String name) {
return getProperty(name, false);
}
@@ -1182,7 +1190,7 @@ public class JsonSchema {
* @param resolve If <jk>true</jk>, calls {@link #resolve()} on object
before returning.
* @return The property with the specified name, or <jk>null</jk> if no
property is specified.
*/
- public JsonSchema getProperty(String name, boolean resolve) {
+ public JsonSchema<?> getProperty(String name, boolean resolve) {
if (properties == null)
return null;
var s = properties.get(name);
@@ -1235,7 +1243,7 @@ public class JsonSchema {
* @return The value of the <property>then</property> property on this
bean, or <jk>null</jk> if it is not set.
*/
@BeanProp("then")
- public JsonSchema getThen() { return then_; }
+ public JsonSchema<?> getThen() { return then_; }
/**
* Bean property getter: <property>summary</property>.
@@ -1305,7 +1313,7 @@ public class JsonSchema {
*
* @return The value of the <property>unevaluatedItems</property>
property on this bean, or <jk>null</jk> if it is not set.
*/
- public JsonSchema getUnevaluatedItems() { return unevaluatedItems; }
+ public JsonSchema<?> getUnevaluatedItems() { return unevaluatedItems; }
/**
* Bean property getter: <property>unevaluatedProperties</property>.
@@ -1315,7 +1323,7 @@ public class JsonSchema {
*
* @return The value of the <property>unevaluatedProperties</property>
property on this bean, or <jk>null</jk> if it is not set.
*/
- public JsonSchema getUnevaluatedProperties() { return
unevaluatedProperties; }
+ public JsonSchema<?> getUnevaluatedProperties() { return
unevaluatedProperties; }
/**
* Bean property getter: <property>uniqueItems</property>.
@@ -1348,7 +1356,7 @@ public class JsonSchema {
*
* @return The referenced schema, or <jk>null</jk>.
*/
- public JsonSchema resolve() {
+ public JsonSchema<?> resolve() {
if (ref == null || master.schemaMap == null)
return this;
return master.schemaMap.get(ref);
@@ -1364,7 +1372,7 @@ public class JsonSchema {
* @return This object.
* @throws BeanRuntimeException If invalid object type passed in.
*/
- public JsonSchema setAdditionalItems(Object value) {
+ public SELF setAdditionalItems(Object value) {
this.additionalItemsBoolean = null;
this.additionalItemsSchemaArray = null;
if (nn(value)) {
@@ -1377,7 +1385,7 @@ public class JsonSchema {
throw brex(JsonSchemaProperty.class, "Invalid
attribute type '%s' passed in. Must be one of the following: Boolean,
JsonSchemaArray", cn(value));
}
}
- return this;
+ return self();
}
/**
@@ -1391,19 +1399,19 @@ public class JsonSchema {
* @throws BeanRuntimeException If invalid object type passed in.
*/
@MarshalledProp(dictionary={ JsonSchema.class })
- public JsonSchema setAdditionalProperties(Object value) {
+ public SELF setAdditionalProperties(Object value) {
this.additionalPropertiesBoolean = null;
this.additionalPropertiesSchema = null;
if (nn(value)) {
if (value instanceof Boolean value2)
this.additionalPropertiesBoolean = value2;
- else if (value instanceof JsonSchema value2) {
+ else if (value instanceof JsonSchema<?> value2) {
this.additionalPropertiesSchema = value2;
setMasterOn(this.additionalPropertiesSchema);
} else
throw brex(JsonSchemaProperty.class, "Invalid
attribute type '%s' passed in. Must be one of the following: Boolean,
JsonSchema", cn(value));
}
- return this;
+ return self();
}
/**
@@ -1412,10 +1420,10 @@ public class JsonSchema {
* @param value The new value for the <property>allOf</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setAllOf(List<JsonSchema> value) {
+ public SELF setAllOf(List<JsonSchema<?>> value) {
this.allOf = value;
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -1424,10 +1432,10 @@ public class JsonSchema {
* @param value The new value of the <property>anyOf</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setAnyOf(List<JsonSchema> value) {
+ public SELF setAnyOf(List<JsonSchema<?>> value) {
this.anyOf = value;
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -1439,9 +1447,9 @@ public class JsonSchema {
* @param value The new value for the <property>const</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setConst(Object value) {
+ public SELF setConst(Object value) {
this.const_ = value;
- return this;
+ return self();
}
/**
@@ -1453,9 +1461,9 @@ public class JsonSchema {
* @param value The new value for the
<property>contentEncoding</property> property on this bean.
* @return This object.
*/
- public JsonSchema setContentEncoding(String value) {
+ public SELF setContentEncoding(String value) {
this.contentEncoding = value;
- return this;
+ return self();
}
/**
@@ -1467,9 +1475,9 @@ public class JsonSchema {
* @param value The new value for the
<property>contentMediaType</property> property on this bean.
* @return This object.
*/
- public JsonSchema setContentMediaType(String value) {
+ public SELF setContentMediaType(String value) {
this.contentMediaType = value;
- return this;
+ return self();
}
/**
@@ -1481,9 +1489,9 @@ public class JsonSchema {
* @param value The new value for the <property>deprecated</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setDeprecated(Boolean value) {
+ public SELF setDeprecated(Boolean value) {
this.deprecated = value;
- return this;
+ return self();
}
/**
@@ -1496,9 +1504,9 @@ public class JsonSchema {
* @return This object.
*/
@BeanProp("$comment")
- public JsonSchema setComment(String value) {
+ public SELF setComment(String value) {
this.comment = value;
- return this;
+ return self();
}
/**
@@ -1507,11 +1515,11 @@ public class JsonSchema {
* @param value The new value for the <property>definitions</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setDefinitions(Map<String,JsonSchema> value) {
+ public SELF setDefinitions(Map<String,JsonSchema<?>> value) {
this.definitions = value;
if (nn(value))
setMasterOn(value.values());
- return this;
+ return self();
}
/**
@@ -1525,11 +1533,11 @@ public class JsonSchema {
* @return This object.
*/
@BeanProp("$defs")
- public JsonSchema setDefs(Map<String,JsonSchema> value) {
+ public SELF setDefs(Map<String,JsonSchema<?>> value) {
this.defs = value;
if (nn(value))
setMasterOn(value.values());
- return this;
+ return self();
}
/**
@@ -1538,11 +1546,11 @@ public class JsonSchema {
* @param value The new value for the <property>dependencies</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setDependencies(Map<String,JsonSchema> value) {
+ public SELF setDependencies(Map<String,JsonSchema<?>> value) {
this.dependencies = value;
if (nn(value))
setMasterOn(value.values());
- return this;
+ return self();
}
/**
@@ -1551,9 +1559,9 @@ public class JsonSchema {
* @param value The new value for the <property>format</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setFormat(String value) {
+ public SELF setFormat(String value) {
this.format = value;
- return this;
+ return self();
}
/**
@@ -1565,9 +1573,9 @@ public class JsonSchema {
* @param value The new value for the
<property>dependentRequired</property> property on this bean.
* @return This object.
*/
- public JsonSchema setDependentRequired(Map<String,List<String>> value) {
+ public SELF setDependentRequired(Map<String,List<String>> value) {
this.dependentRequired = value;
- return this;
+ return self();
}
/**
@@ -1579,11 +1587,11 @@ public class JsonSchema {
* @param value The new value for the
<property>dependentSchemas</property> property on this bean.
* @return This object.
*/
- public JsonSchema setDependentSchemas(Map<String,JsonSchema> value) {
+ public SELF setDependentSchemas(Map<String,JsonSchema<?>> value) {
this.dependentSchemas = value;
if (nn(value))
setMasterOn(value.values());
- return this;
+ return self();
}
/**
@@ -1592,9 +1600,9 @@ public class JsonSchema {
* @param value The new value for the <property>description</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setDescription(String value) {
+ public SELF setDescription(String value) {
this.description = value;
- return this;
+ return self();
}
/**
@@ -1607,10 +1615,10 @@ public class JsonSchema {
* @return This object.
*/
@BeanProp("else")
- public JsonSchema setElse(JsonSchema value) {
+ public SELF setElse(JsonSchema<?> value) {
this.else_ = value;
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -1619,9 +1627,9 @@ public class JsonSchema {
* @param value The new value for the <property>enum</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setEnum(List<Object> value) {
+ public SELF setEnum(List<Object> value) {
this.enum_ = value;
- return this;
+ return self();
}
/**
@@ -1633,9 +1641,9 @@ public class JsonSchema {
* @param value The new value for the <property>examples</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setExamples(List<Object> value) {
+ public SELF setExamples(List<Object> value) {
this.examples = value;
- return this;
+ return self();
}
/**
@@ -1648,9 +1656,9 @@ public class JsonSchema {
* @param value The new value for the
<property>exclusiveMaximum</property> property on this bean.
* @return This object.
*/
- public JsonSchema setExclusiveMaximum(Number value) {
+ public SELF setExclusiveMaximum(Number value) {
this.exclusiveMaximum = value;
- return this;
+ return self();
}
/**
@@ -1663,9 +1671,9 @@ public class JsonSchema {
* @param value The new value for the
<property>exclusiveMinimum</property> property on this bean.
* @return This object.
*/
- public JsonSchema setExclusiveMinimum(Number value) {
+ public SELF setExclusiveMinimum(Number value) {
this.exclusiveMinimum = value;
- return this;
+ return self();
}
/**
@@ -1690,9 +1698,9 @@ public class JsonSchema {
@SuppressWarnings({
"java:S1133" // Kept for Draft 04 backward compatibility, will
be removed in future version
})
- public JsonSchema setId(Object value) {
+ public SELF setId(Object value) {
this.id = toUri(value);
- return this;
+ return self();
}
/**
@@ -1712,9 +1720,9 @@ public class JsonSchema {
* @return This object.
*/
@BeanProp("$id")
- public JsonSchema setIdUri(Object value) {
+ public SELF setIdUri(Object value) {
this.idUri = toUri(value);
- return this;
+ return self();
}
/**
@@ -1727,10 +1735,10 @@ public class JsonSchema {
* @return This object.
*/
@BeanProp("if")
- public JsonSchema setIf(JsonSchema value) {
+ public SELF setIf(JsonSchema<?> value) {
this.if_ = value;
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -1743,11 +1751,11 @@ public class JsonSchema {
* @return This object.
* @throws BeanRuntimeException If invalid object type passed in.
*/
- public JsonSchema setItems(Object value) {
+ public SELF setItems(Object value) {
this.itemsSchema = null;
this.itemsSchemaArray = null;
if (nn(value)) {
- if (value instanceof JsonSchema value2) {
+ if (value instanceof JsonSchema<?> value2) {
this.itemsSchema = value2;
setMasterOn(this.itemsSchema);
} else if (value instanceof JsonSchemaArray value2) {
@@ -1757,7 +1765,7 @@ public class JsonSchema {
throw brex(JsonSchemaProperty.class, "Invalid
attribute type '%s' passed in. Must be one of the following: JsonSchema,
JsonSchemaArray", cn(value));
}
}
- return this;
+ return self();
}
/**
@@ -1766,9 +1774,9 @@ public class JsonSchema {
* @param value The new value for the <property>maximum</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setMaximum(Number value) {
+ public SELF setMaximum(Number value) {
this.maximum = value;
- return this;
+ return self();
}
/**
@@ -1777,9 +1785,9 @@ public class JsonSchema {
* @param value The new value for the <property>maxItems</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setMaxItems(Integer value) {
+ public SELF setMaxItems(Integer value) {
this.maxItems = value;
- return this;
+ return self();
}
/**
@@ -1788,9 +1796,9 @@ public class JsonSchema {
* @param value The new value for the <property>maxLength</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setMaxLength(Integer value) {
+ public SELF setMaxLength(Integer value) {
this.maxLength = value;
- return this;
+ return self();
}
/**
@@ -1799,9 +1807,9 @@ public class JsonSchema {
* @param value The new value for the
<property>maxProperties</property> property on this bean.
* @return This object.
*/
- public JsonSchema setMaxProperties(Integer value) {
+ public SELF setMaxProperties(Integer value) {
this.maxProperties = value;
- return this;
+ return self();
}
/**
@@ -1810,9 +1818,9 @@ public class JsonSchema {
* @param value The new value for the <property>minimum</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setMinimum(Number value) {
+ public SELF setMinimum(Number value) {
this.minimum = value;
- return this;
+ return self();
}
/**
@@ -1821,9 +1829,9 @@ public class JsonSchema {
* @param value The new value for the <property>minItems</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setMinItems(Integer value) {
+ public SELF setMinItems(Integer value) {
this.minItems = value;
- return this;
+ return self();
}
/**
@@ -1832,9 +1840,9 @@ public class JsonSchema {
* @param value The new value for the <property>minLength</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setMinLength(Integer value) {
+ public SELF setMinLength(Integer value) {
this.minLength = value;
- return this;
+ return self();
}
/**
@@ -1843,9 +1851,9 @@ public class JsonSchema {
* @param value The new value for the
<property>minProperties</property> property on this bean.
* @return This object.
*/
- public JsonSchema setMinProperties(Integer value) {
+ public SELF setMinProperties(Integer value) {
this.minProperties = value;
- return this;
+ return self();
}
/**
@@ -1854,9 +1862,9 @@ public class JsonSchema {
* @param value The new value for the <property>multipleOf</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setMultipleOf(Number value) {
+ public SELF setMultipleOf(Number value) {
this.multipleOf = value;
- return this;
+ return self();
}
/**
@@ -1869,9 +1877,9 @@ public class JsonSchema {
* @return This object.
*/
@BeanIgnore
- public JsonSchema setName(String value) {
+ public SELF setName(String value) {
this.name = value;
- return this;
+ return self();
}
/**
@@ -1880,10 +1888,10 @@ public class JsonSchema {
* @param value The new value for the <property>not</property> property
on this bean.
* @return This object.
*/
- public JsonSchema setNot(JsonSchema value) {
+ public SELF setNot(JsonSchema<?> value) {
this.not = value;
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -1892,10 +1900,10 @@ public class JsonSchema {
* @param value The new value for the <property>oneOf</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setOneOf(List<JsonSchema> value) {
+ public SELF setOneOf(List<JsonSchema<?>> value) {
this.oneOf = value;
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -1904,9 +1912,9 @@ public class JsonSchema {
* @param value The new value for the <property>pattern</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setPattern(String value) {
+ public SELF setPattern(String value) {
this.pattern = value;
- return this;
+ return self();
}
/**
@@ -1915,7 +1923,7 @@ public class JsonSchema {
* @param value The new value for the
<property>patternProperties</property> property on this bean.
* @return This object.
*/
- public JsonSchema setPatternProperties(Map<String,JsonSchema> value) {
+ public SELF setPatternProperties(Map<String,JsonSchema<?>> value) {
this.patternProperties = value;
if (nn(value)) {
value.entrySet().forEach(x -> {
@@ -1924,7 +1932,7 @@ public class JsonSchema {
s.setName(x.getKey());
});
}
- return this;
+ return self();
}
/**
@@ -1936,10 +1944,10 @@ public class JsonSchema {
* @param value The new value for the <property>prefixItems</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setPrefixItems(JsonSchemaArray value) {
+ public SELF setPrefixItems(JsonSchemaArray value) {
this.prefixItems = value;
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -1948,7 +1956,7 @@ public class JsonSchema {
* @param value The new value for the <property>properties</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setProperties(Map<String,JsonSchema> value) {
+ public SELF setProperties(Map<String,JsonSchema<?>> value) {
this.properties = value;
if (nn(value)) {
value.entrySet().forEach(x -> {
@@ -1957,7 +1965,7 @@ public class JsonSchema {
v.setName(x.getKey());
});
}
- return this;
+ return self();
}
/**
@@ -1969,9 +1977,9 @@ public class JsonSchema {
* @param value The new value for the <property>readOnly</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setReadOnly(Boolean value) {
+ public SELF setReadOnly(Boolean value) {
this.readOnly = value;
- return this;
+ return self();
}
/**
@@ -1988,9 +1996,9 @@ public class JsonSchema {
* @return This object.
*/
@BeanProp("$ref")
- public JsonSchema setRef(Object value) {
+ public SELF setRef(Object value) {
this.ref = toUri(value);
- return this;
+ return self();
}
/**
@@ -1999,9 +2007,9 @@ public class JsonSchema {
* @param value The new value for the <property>required</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setRequired(List<String> value) {
+ public SELF setRequired(List<String> value) {
this.required = value;
- return this;
+ return self();
}
/**
@@ -2012,9 +2020,9 @@ public class JsonSchema {
* @return This object.
*/
@BeanIgnore
- public JsonSchema setSchemaMap(JsonSchemaMap value) {
+ public SELF setSchemaMap(JsonSchemaMap value) {
this.schemaMap = value;
- return this;
+ return self();
}
/**
@@ -2031,9 +2039,9 @@ public class JsonSchema {
* @return This object.
*/
@BeanProp("$schema")
- public JsonSchema setSchemaVersionUri(Object value) {
+ public SELF setSchemaVersionUri(Object value) {
this.schemaVersion = toUri(value);
- return this;
+ return self();
}
/**
@@ -2046,10 +2054,10 @@ public class JsonSchema {
* @return This object.
*/
@BeanProp("then")
- public JsonSchema setThen(JsonSchema value) {
+ public SELF setThen(JsonSchema<?> value) {
this.then_ = value;
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -2059,9 +2067,9 @@ public class JsonSchema {
* @return This object.
* @since 10.0.0
*/
- public JsonSchema setSummary(String value) {
+ public SELF setSummary(String value) {
this.summary = value;
- return this;
+ return self();
}
/**
@@ -2070,9 +2078,9 @@ public class JsonSchema {
* @param value The new value for the <property>title</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setTitle(String value) {
+ public SELF setTitle(String value) {
this.title = value;
- return this;
+ return self();
}
/**
@@ -2085,7 +2093,7 @@ public class JsonSchema {
* @return This object.
* @throws BeanRuntimeException If invalid object type passed in.
*/
- public JsonSchema setType(Object value) {
+ public SELF setType(Object value) {
this.typeJsonType = null;
this.typeJsonTypeArray = null;
if (nn(value)) {
@@ -2096,7 +2104,7 @@ public class JsonSchema {
else
throw brex(JsonSchemaProperty.class, "Invalid
attribute type '%s' passed in. Must be one of the following: SimpleType,
SimpleTypeArray", cn(value));
}
- return this;
+ return self();
}
/**
@@ -2108,10 +2116,10 @@ public class JsonSchema {
* @param value The new value for the
<property>unevaluatedItems</property> property on this bean.
* @return This object.
*/
- public JsonSchema setUnevaluatedItems(JsonSchema value) {
+ public SELF setUnevaluatedItems(JsonSchema<?> value) {
this.unevaluatedItems = value;
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -2123,10 +2131,10 @@ public class JsonSchema {
* @param value The new value for the
<property>unevaluatedProperties</property> property on this bean.
* @return This object.
*/
- public JsonSchema setUnevaluatedProperties(JsonSchema value) {
+ public SELF setUnevaluatedProperties(JsonSchema<?> value) {
this.unevaluatedProperties = value;
setMasterOn(value);
- return this;
+ return self();
}
/**
@@ -2135,9 +2143,9 @@ public class JsonSchema {
* @param value The new value for the <property>uniqueItems</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setUniqueItems(Boolean value) {
+ public SELF setUniqueItems(Boolean value) {
this.uniqueItems = value;
- return this;
+ return self();
}
/**
@@ -2149,9 +2157,9 @@ public class JsonSchema {
* @param value The new value for the <property>writeOnly</property>
property on this bean.
* @return This object.
*/
- public JsonSchema setWriteOnly(Boolean value) {
+ public SELF setWriteOnly(Boolean value) {
this.writeOnly = value;
- return this;
+ return self();
}
@Override /* Overridden from Object */
@@ -2159,17 +2167,17 @@ public class JsonSchema {
return Json.of(this);
}
- private void setMasterOn(Collection<JsonSchema> ss) {
+ private void setMasterOn(Collection<JsonSchema<?>> ss) {
if (nn(ss))
ss.forEach(this::setMasterOn);
}
- private void setMasterOn(JsonSchema s) {
+ private void setMasterOn(JsonSchema<?> s) {
if (nn(s))
s.setMaster(this);
}
- private void setMasterOn(JsonSchema[] ss) {
+ private void setMasterOn(JsonSchema<?>[] ss) {
assertArgNotNull("ss", ss);
for (var s : ss)
setMasterOn(s);
@@ -2192,7 +2200,7 @@ public class JsonSchema {
@SuppressWarnings({
"java:S3776" // Cognitive complexity acceptable for this logic
})
- protected void setMaster(JsonSchema master) {
+ protected void setMaster(JsonSchema<?> master) {
this.master = master;
if (nn(definitions))
definitions.values().forEach(x -> x.setMaster(master));
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaArray.java
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaArray.java
index 0c6e3edff5..9856b6de12 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaArray.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaArray.java
@@ -23,7 +23,7 @@ import java.util.*;
*
* @serial exclude
*/
-public class JsonSchemaArray extends LinkedList<JsonSchema> {
+public class JsonSchemaArray extends LinkedList<JsonSchema<?>> {
private static final long serialVersionUID = 1L;
@@ -37,7 +37,7 @@ public class JsonSchemaArray extends LinkedList<JsonSchema> {
*
* @param value The list of schemas in this array.
*/
- public JsonSchemaArray(JsonSchema...value) {
+ public JsonSchemaArray(JsonSchema<?>...value) {
addAll(value);
}
@@ -47,7 +47,7 @@ public class JsonSchemaArray extends LinkedList<JsonSchema> {
* @param value The {@link JsonSchema} objects to add to this array.
* @return This object.
*/
- public JsonSchemaArray addAll(JsonSchema...value) {
+ public JsonSchemaArray addAll(JsonSchema<?>...value) {
Collections.addAll(this, value);
return this;
}
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaBeanGenerator.java
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaBeanGenerator.java
index a1322b9761..5116f7ad50 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaBeanGenerator.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaBeanGenerator.java
@@ -69,7 +69,7 @@ public final class JsonSchemaBeanGenerator {
* @param type The Java type. Must not be <jk>null</jk>.
* @return The generated schema bean, or <jk>null</jk> if a schema
could not be generated for the type.
*/
- public JsonSchema generate(Type type) {
+ public JsonSchema<?> generate(Type type) {
assertArgNotNull("type", type);
try {
var session = generator.getSession();
@@ -91,7 +91,7 @@ public final class JsonSchemaBeanGenerator {
* @param type The Java class. Must not be <jk>null</jk>.
* @return The generated schema bean, or <jk>null</jk> if a schema
could not be generated for the class.
*/
- public JsonSchema generate(Class<?> type) {
+ public JsonSchema<?> generate(Class<?> type) {
return generate((Type)type);
}
@@ -104,7 +104,7 @@ public final class JsonSchemaBeanGenerator {
* @param o The value to infer a schema from. Must not be
<jk>null</jk>.
* @return The generated schema bean, or <jk>null</jk> if a schema
could not be generated for the value.
*/
- public JsonSchema generate(Object o) {
+ public JsonSchema<?> generate(Object o) {
assertArgNotNull("o", o);
try {
var session = generator.getSession();
@@ -129,7 +129,7 @@ public final class JsonSchemaBeanGenerator {
* @param schemaMap The generated schema map. Must not be
<jk>null</jk>.
* @return The typed schema bean.
*/
- public static JsonSchema toBean(JsonMap schemaMap) {
+ public static JsonSchema<?> toBean(JsonMap schemaMap) {
assertArgNotNull("schemaMap", schemaMap);
try {
var json = Json.of(schemaMap);
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaMap.java
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaMap.java
index 77174241ac..d7ef75fbd7 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaMap.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaMap.java
@@ -41,7 +41,7 @@ import org.apache.juneau.marshall.marshaller.*;
*
* @serial exclude
*/
-public abstract class JsonSchemaMap extends ConcurrentHashMap<URI,JsonSchema> {
+public abstract class JsonSchemaMap extends
ConcurrentHashMap<URI,JsonSchema<?>> {
private static final long serialVersionUID = 1L;
@@ -58,7 +58,7 @@ public abstract class JsonSchemaMap extends
ConcurrentHashMap<URI,JsonSchema> {
@SuppressWarnings({
"removal", // Uses deprecated API for compatibility
})
- public JsonSchemaMap add(JsonSchema...schemas) {
+ public JsonSchemaMap add(JsonSchema<?>...schemas) {
for (var schema : schemas) {
if (schema.getId() == null)
throw iaex("Schema with no ID passed to
JsonSchemaMap.add(Schema...)");
@@ -85,7 +85,7 @@ public abstract class JsonSchemaMap extends
ConcurrentHashMap<URI,JsonSchema> {
* @return The JsonSchema, or <jk>null</jk> if schema was not located
and could not be loaded.
*/
@Override /* Overridden from Map */
- public JsonSchema get(Object uri) {
+ public JsonSchema<?> get(Object uri) {
var u = toUri(uri);
var s = super.get(u);
if (nn(s))
@@ -131,7 +131,7 @@ public abstract class JsonSchemaMap extends
ConcurrentHashMap<URI,JsonSchema> {
* @param uri The URI to load the schema from.
* @return The parsed schema, or <jk>null</jk> if the document is
unreachable.
*/
- public JsonSchema load(URI uri) {
+ public JsonSchema<?> load(URI uri) {
try (var r = getReader(uri)) {
if (r == null)
return null;
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaProperty.java
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaProperty.java
index 49cfffb0ff..f520fa4cd5 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaProperty.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaProperty.java
@@ -16,12 +16,15 @@
*/
package org.apache.juneau.bean.jsonschema;
-import java.util.*;
-
/**
* Represents a JSON property in the JSON-Schema core specification.
+ *
+ * @param <SELF> The self type for fluent setters.
*/
-public class JsonSchemaProperty extends JsonSchema {
+@SuppressWarnings({
+ "java:S119" // 'SELF' (CRTP self-type) is intentional and clearer than
a single-letter name.
+})
+public class JsonSchemaProperty<SELF extends JsonSchemaProperty<SELF>> extends
JsonSchema<SELF> {
/**
* Default constructor.
@@ -47,385 +50,4 @@ public class JsonSchemaProperty extends JsonSchema {
setName(name);
setType(type);
}
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addAdditionalItems(JsonSchema...value) {
- super.addAdditionalItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addAllOf(JsonSchema...value) {
- super.addAllOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addAnyOf(JsonSchema...value) {
- super.addAnyOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addDef(String name, JsonSchema value) {
- super.addDef(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addDefinition(String name, JsonSchema value) {
- super.addDefinition(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addDependency(String name, JsonSchema value) {
- super.addDependency(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addDependentRequired(String name,
List<String> value) {
- super.addDependentRequired(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addDependentSchema(String name, JsonSchema
value) {
- super.addDependentSchema(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addEnum(Object...value) {
- super.addEnum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addExamples(Object...value) {
- super.addExamples(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addItems(JsonSchema...value) {
- super.addItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addOneOf(JsonSchema...value) {
- super.addOneOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty
addPatternProperties(JsonSchemaProperty...value) {
- super.addPatternProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addPrefixItems(JsonSchema...value) {
- super.addPrefixItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addProperties(JsonSchema...value) {
- super.addProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addRequired(JsonSchemaProperty...value) {
- super.addRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addRequired(List<String> value) {
- super.addRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addRequired(String...value) {
- super.addRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty addTypes(JsonType...value) {
- super.addTypes(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setAllOf(List<JsonSchema> value) {
- super.setAllOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setAnyOf(List<JsonSchema> value) {
- super.setAnyOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setConst(Object value) {
- super.setConst(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setContentEncoding(String value) {
- super.setContentEncoding(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setContentMediaType(String value) {
- super.setContentMediaType(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setDeprecated(Boolean value) {
- super.setDeprecated(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setComment(String value) {
- super.setComment(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setDefinitions(Map<String,JsonSchema> value) {
- super.setDefinitions(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setDependencies(Map<String,JsonSchema> value)
{
- super.setDependencies(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setDependentRequired(Map<String,List<String>>
value) {
- super.setDependentRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setDependentSchemas(Map<String,JsonSchema>
value) {
- super.setDependentSchemas(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setDescription(String value) {
- super.setDescription(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setFormat(String value) {
- super.setFormat(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setEnum(List<Object> value) {
- super.setEnum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setExamples(List<Object> value) {
- super.setExamples(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setExclusiveMaximum(Number value) {
- super.setExclusiveMaximum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setExclusiveMinimum(Number value) {
- super.setExclusiveMinimum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- @SuppressWarnings({
- "removal", // Uses deprecated API for compatibility
- })
- public JsonSchemaProperty setId(Object value) {
- super.setId(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setMaximum(Number value) {
- super.setMaximum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setMaxItems(Integer value) {
- super.setMaxItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setMaxLength(Integer value) {
- super.setMaxLength(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setMaxProperties(Integer value) {
- super.setMaxProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setMinimum(Number value) {
- super.setMinimum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setMinItems(Integer value) {
- super.setMinItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setMinLength(Integer value) {
- super.setMinLength(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setMinProperties(Integer value) {
- super.setMinProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setMultipleOf(Number value) {
- super.setMultipleOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setName(String value) {
- super.setName(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setNot(JsonSchema value) {
- super.setNot(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setOneOf(List<JsonSchema> value) {
- super.setOneOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setPattern(String value) {
- super.setPattern(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setPatternProperties(Map<String,JsonSchema>
value) {
- super.setPatternProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setPrefixItems(JsonSchemaArray value) {
- super.setPrefixItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setProperties(Map<String,JsonSchema> value) {
- super.setProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setReadOnly(Boolean value) {
- super.setReadOnly(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setRequired(List<String> value) {
- super.setRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setSchemaMap(JsonSchemaMap value) {
- super.setSchemaMap(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setSummary(String value) {
- super.setSummary(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setTitle(String value) {
- super.setTitle(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setType(Object value) {
- super.setType(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setUnevaluatedItems(JsonSchema value) {
- super.setUnevaluatedItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setUnevaluatedProperties(JsonSchema value) {
- super.setUnevaluatedProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setUniqueItems(Boolean value) {
- super.setUniqueItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaProperty setWriteOnly(Boolean value) {
- super.setWriteOnly(value);
- return this;
- }
-}
\ No newline at end of file
+}
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaPropertySimpleArray.java
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaPropertySimpleArray.java
index 8d72a97dcb..92f2800c9b 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaPropertySimpleArray.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaPropertySimpleArray.java
@@ -16,8 +16,6 @@
*/
package org.apache.juneau.bean.jsonschema;
-import java.util.*;
-
/**
* Convenience class for representing a property that's an array of simple
types.
*
@@ -32,7 +30,7 @@ import java.util.*;
* );
* </p>
*/
-public class JsonSchemaPropertySimpleArray extends JsonSchemaProperty {
+public class JsonSchemaPropertySimpleArray extends
JsonSchemaProperty<JsonSchemaPropertySimpleArray> {
/**
* Constructor.
@@ -43,367 +41,6 @@ public class JsonSchemaPropertySimpleArray extends
JsonSchemaProperty {
public JsonSchemaPropertySimpleArray(String name, JsonType elementType)
{
setName(name);
setType(JsonType.ARRAY);
- setItems(new JsonSchema().setType(elementType));
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray
addAdditionalItems(JsonSchema...value) {
- super.addAdditionalItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addAllOf(JsonSchema...value) {
- super.addAllOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addAnyOf(JsonSchema...value) {
- super.addAnyOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addDef(String name, JsonSchema
value) {
- super.addDef(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addDefinition(String name,
JsonSchema value) {
- super.addDefinition(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addDependency(String name,
JsonSchema value) {
- super.addDependency(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addDependentRequired(String name,
List<String> value) {
- super.addDependentRequired(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addDependentSchema(String name,
JsonSchema value) {
- super.addDependentSchema(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addEnum(Object...value) {
- super.addEnum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addExamples(Object...value) {
- super.addExamples(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addItems(JsonSchema...value) {
- super.addItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addOneOf(JsonSchema...value) {
- super.addOneOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray
addPatternProperties(JsonSchemaProperty...value) {
- super.addPatternProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addPrefixItems(JsonSchema...value)
{
- super.addPrefixItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addProperties(JsonSchema...value) {
- super.addProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray
addRequired(JsonSchemaProperty...value) {
- super.addRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addRequired(List<String> value) {
- super.addRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addRequired(String...value) {
- super.addRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray addTypes(JsonType...value) {
- super.addTypes(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setAllOf(List<JsonSchema> value) {
- super.setAllOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setAnyOf(List<JsonSchema> value) {
- super.setAnyOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setConst(Object value) {
- super.setConst(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setContentEncoding(String value) {
- super.setContentEncoding(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setContentMediaType(String value) {
- super.setContentMediaType(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray
setDefinitions(Map<String,JsonSchema> value) {
- super.setDefinitions(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray
setDependencies(Map<String,JsonSchema> value) {
- super.setDependencies(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray
setDependentRequired(Map<String,List<String>> value) {
- super.setDependentRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray
setDependentSchemas(Map<String,JsonSchema> value) {
- super.setDependentSchemas(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setDescription(String value) {
- super.setDescription(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setEnum(List<Object> value) {
- super.setEnum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setExamples(List<Object> value) {
- super.setExamples(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setExclusiveMaximum(Number value) {
- super.setExclusiveMaximum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setExclusiveMinimum(Number value) {
- super.setExclusiveMinimum(value);
- return this;
- }
-
- /**
- * @deprecated Use {@link #setIdUri(Object)} instead.
- */
- @Override /* Overridden from JsonSchemaProperty */
- @Deprecated(since = "10.0", forRemoval = true) // Parent method is
deprecated
- @SuppressWarnings({
- "java:S1133" // Kept for Draft 04 backward compatibility, will
be removed in future version
- })
- public JsonSchemaPropertySimpleArray setId(Object value) {
- super.setId(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setMaximum(Number value) {
- super.setMaximum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setMaxItems(Integer value) {
- super.setMaxItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setMaxLength(Integer value) {
- super.setMaxLength(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setMaxProperties(Integer value) {
- super.setMaxProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setMinimum(Number value) {
- super.setMinimum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setMinItems(Integer value) {
- super.setMinItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setMinLength(Integer value) {
- super.setMinLength(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setMinProperties(Integer value) {
- super.setMinProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setMultipleOf(Number value) {
- super.setMultipleOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setName(String value) {
- super.setName(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setNot(JsonSchema value) {
- super.setNot(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setOneOf(List<JsonSchema> value) {
- super.setOneOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setPattern(String value) {
- super.setPattern(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray
setPatternProperties(Map<String,JsonSchema> value) {
- super.setPatternProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setPrefixItems(JsonSchemaArray
value) {
- super.setPrefixItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray
setProperties(Map<String,JsonSchema> value) {
- super.setProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setReadOnly(Boolean value) {
- super.setReadOnly(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setRequired(List<String> value) {
- super.setRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setSchemaMap(JsonSchemaMap value) {
- super.setSchemaMap(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setTitle(String value) {
- super.setTitle(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setType(Object value) {
- super.setType(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setUnevaluatedItems(JsonSchema
value) {
- super.setUnevaluatedItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray
setUnevaluatedProperties(JsonSchema value) {
- super.setUnevaluatedProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setUniqueItems(Boolean value) {
- super.setUniqueItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchemaProperty */
- public JsonSchemaPropertySimpleArray setWriteOnly(Boolean value) {
- super.setWriteOnly(value);
- return this;
+ setItems(new JsonSchema<>().setType(elementType));
}
-}
\ No newline at end of file
+}
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaRef.java
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaRef.java
index ed4abb9bb0..c21c7b1c19 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaRef.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaRef.java
@@ -17,7 +17,6 @@
package org.apache.juneau.bean.jsonschema;
import java.net.*;
-import java.util.*;
import org.apache.juneau.marshall.*;
@@ -32,7 +31,7 @@ import org.apache.juneau.marshall.*;
* JsonSchema <jv>schema</jv> = <jk>new</jk>
JsonSchema().setRef(<jv>uri</jv>);
* </p>
*/
-public class JsonSchemaRef extends JsonSchema {
+public class JsonSchemaRef extends JsonSchema<JsonSchemaRef> {
/**
* Constructor.
@@ -49,385 +48,4 @@ public class JsonSchemaRef extends JsonSchema {
public JsonSchemaRef(Object uri) {
this.setRef(uri);
}
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addAdditionalItems(JsonSchema...value) {
- super.addAdditionalItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addAllOf(JsonSchema...value) {
- super.addAllOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addAnyOf(JsonSchema...value) {
- super.addAnyOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addDef(String name, JsonSchema value) {
- super.addDef(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addDefinition(String name, JsonSchema value) {
- super.addDefinition(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addDependency(String name, JsonSchema value) {
- super.addDependency(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addDependentRequired(String name, List<String>
value) {
- super.addDependentRequired(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addDependentSchema(String name, JsonSchema value) {
- super.addDependentSchema(name, value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addEnum(Object...value) {
- super.addEnum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addExamples(Object...value) {
- super.addExamples(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addItems(JsonSchema...value) {
- super.addItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addOneOf(JsonSchema...value) {
- super.addOneOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addPatternProperties(JsonSchemaProperty...value) {
- super.addPatternProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addPrefixItems(JsonSchema...value) {
- super.addPrefixItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addProperties(JsonSchema...value) {
- super.addProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addRequired(JsonSchemaProperty...value) {
- super.addRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addRequired(List<String> value) {
- super.addRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addRequired(String...value) {
- super.addRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef addTypes(JsonType...value) {
- super.addTypes(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setAllOf(List<JsonSchema> value) {
- super.setAllOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setAnyOf(List<JsonSchema> value) {
- super.setAnyOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setConst(Object value) {
- super.setConst(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setContentEncoding(String value) {
- super.setContentEncoding(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setContentMediaType(String value) {
- super.setContentMediaType(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setDeprecated(Boolean value) {
- super.setDeprecated(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setComment(String value) {
- super.setComment(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setDefinitions(Map<String,JsonSchema> value) {
- super.setDefinitions(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setDependencies(Map<String,JsonSchema> value) {
- super.setDependencies(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setDependentRequired(Map<String,List<String>>
value) {
- super.setDependentRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setDependentSchemas(Map<String,JsonSchema> value) {
- super.setDependentSchemas(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setDescription(String value) {
- super.setDescription(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setFormat(String value) {
- super.setFormat(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setEnum(List<Object> value) {
- super.setEnum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setExamples(List<Object> value) {
- super.setExamples(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setExclusiveMaximum(Number value) {
- super.setExclusiveMaximum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setExclusiveMinimum(Number value) {
- super.setExclusiveMinimum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- @SuppressWarnings({
- "removal", // Uses deprecated API for compatibility
- })
- public JsonSchemaRef setId(Object value) {
- super.setId(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setMaximum(Number value) {
- super.setMaximum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setMaxItems(Integer value) {
- super.setMaxItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setMaxLength(Integer value) {
- super.setMaxLength(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setMaxProperties(Integer value) {
- super.setMaxProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setMinimum(Number value) {
- super.setMinimum(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setMinItems(Integer value) {
- super.setMinItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setMinLength(Integer value) {
- super.setMinLength(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setMinProperties(Integer value) {
- super.setMinProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setMultipleOf(Number value) {
- super.setMultipleOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setName(String value) {
- super.setName(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setNot(JsonSchema value) {
- super.setNot(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setOneOf(List<JsonSchema> value) {
- super.setOneOf(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setPattern(String value) {
- super.setPattern(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setPatternProperties(Map<String,JsonSchema> value)
{
- super.setPatternProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setPrefixItems(JsonSchemaArray value) {
- super.setPrefixItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setProperties(Map<String,JsonSchema> value) {
- super.setProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setReadOnly(Boolean value) {
- super.setReadOnly(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setRequired(List<String> value) {
- super.setRequired(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setSchemaMap(JsonSchemaMap value) {
- super.setSchemaMap(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setSummary(String value) {
- super.setSummary(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setTitle(String value) {
- super.setTitle(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setType(Object value) {
- super.setType(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setUnevaluatedItems(JsonSchema value) {
- super.setUnevaluatedItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setUnevaluatedProperties(JsonSchema value) {
- super.setUnevaluatedProperties(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setUniqueItems(Boolean value) {
- super.setUniqueItems(value);
- return this;
- }
-
- @Override /* Overridden from JsonSchema */
- public JsonSchemaRef setWriteOnly(Boolean value) {
- super.setWriteOnly(value);
- return this;
- }
-}
\ No newline at end of file
+}
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaValidator.java
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaValidator.java
index 11832b1f2b..e2b8f0ba9a 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaValidator.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/main/java/org/apache/juneau/bean/jsonschema/JsonSchemaValidator.java
@@ -109,7 +109,7 @@ import org.apache.juneau.marshall.marshaller.*;
*/
public final class JsonSchemaValidator implements PropertyValidator {
- private final JsonSchema schema;
+ private final JsonSchema<?> schema;
private final Pattern patternCache;
/**
@@ -118,7 +118,7 @@ public final class JsonSchemaValidator implements
PropertyValidator {
* @param schema The schema to validate against. Must not be
<jk>null</jk>.
* @return A new validator.
*/
- public static JsonSchemaValidator of(JsonSchema schema) {
+ public static JsonSchemaValidator of(JsonSchema<?> schema) {
assertArgNotNull("schema", schema);
return new JsonSchemaValidator(schema);
}
@@ -137,7 +137,7 @@ public final class JsonSchemaValidator implements
PropertyValidator {
return of(JsonSchemaBeanGenerator.toBean(schemaMap));
}
- private JsonSchemaValidator(JsonSchema schema) {
+ private JsonSchemaValidator(JsonSchema<?> schema) {
this.schema = schema;
var p = schema.getPattern();
this.patternCache = p == null ? null : Pattern.compile(p);
@@ -148,7 +148,7 @@ public final class JsonSchemaValidator implements
PropertyValidator {
*
* @return The schema.
*/
- public JsonSchema getSchema() {
+ public JsonSchema<?> getSchema() {
return schema;
}
@@ -160,7 +160,7 @@ public final class JsonSchemaValidator implements
PropertyValidator {
@SuppressWarnings({
"java:S3776" // Cognitive complexity — dispatch table over the
JSON Schema keyword set.
})
- private static void validateAgainst(JsonSchema s, Object value, Pattern
patternOverride) {
+ private static void validateAgainst(JsonSchema<?> s, Object value,
Pattern patternOverride) {
validateEnum(s, value);
validateConst(s, value);
@@ -189,7 +189,7 @@ public final class JsonSchemaValidator implements
PropertyValidator {
// Type / enum / const
//
=================================================================================================================
- private static void validateEnum(JsonSchema s, Object value) {
+ private static void validateEnum(JsonSchema<?> s, Object value) {
var enums = s.getEnum();
if (ie(enums))
return;
@@ -200,7 +200,7 @@ public final class JsonSchemaValidator implements
PropertyValidator {
throw new SchemaValidationException("Value '%s' does not match
one of the allowed enum values.", value);
}
- private static void validateConst(JsonSchema s, Object value) {
+ private static void validateConst(JsonSchema<?> s, Object value) {
var c = s.getConst();
if (c == null)
return; // const=null is indistinguishable from "not
set" in the bean; treat as unset.
@@ -208,7 +208,7 @@ public final class JsonSchemaValidator implements
PropertyValidator {
throw new SchemaValidationException("Value '%s' does
not match required const '%s'.", value, c);
}
- private static void validateType(JsonSchema s, Object value) {
+ private static void validateType(JsonSchema<?> s, Object value) {
var single = s.getTypeAsJsonType();
if (nn(single)) {
if (! matchesType(single, value))
@@ -281,7 +281,7 @@ public final class JsonSchemaValidator implements
PropertyValidator {
// String
//
=================================================================================================================
- private static void validateString(JsonSchema s, String value, Pattern
patternOverride) {
+ private static void validateString(JsonSchema<?> s, String value,
Pattern patternOverride) {
var minL = s.getMinLength();
var maxL = s.getMaxLength();
var len = value.codePointCount(0, value.length());
@@ -303,7 +303,7 @@ public final class JsonSchemaValidator implements
PropertyValidator {
@SuppressWarnings({
"java:S3776" // Numeric keyword fan-out is intentionally flat;
each branch maps to one Draft 2020-12 keyword.
})
- private static void validateNumber(JsonSchema s, Number value) {
+ private static void validateNumber(JsonSchema<?> s, Number value) {
BigDecimal bd;
try {
bd = toBigDecimal(value);
@@ -330,7 +330,7 @@ public final class JsonSchemaValidator implements
PropertyValidator {
// Array
//
=================================================================================================================
- private static void validateArray(JsonSchema s, Collection<?> value) {
+ private static void validateArray(JsonSchema<?> s, Collection<?> value)
{
var min = s.getMinItems();
var max = s.getMaxItems();
var size = value.size();
@@ -376,7 +376,7 @@ public final class JsonSchemaValidator implements
PropertyValidator {
@SuppressWarnings({
"java:S3776" // Cognitive complexity — flat fan-out over the
Draft 2020-12 object keywords (min/maxProperties, required, properties).
})
- private static void validateObject(JsonSchema s, Map<?,?> value) {
+ private static void validateObject(JsonSchema<?> s, Map<?,?> value) {
var minP = s.getMinProperties();
var maxP = s.getMaxProperties();
var size = value.size();
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaMap_Test.java
b/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaMap_Test.java
index 9eaf745365..cb0c88a13a 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaMap_Test.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaMap_Test.java
@@ -25,9 +25,11 @@ import org.apache.juneau.*;
import org.junit.jupiter.api.*;
@SuppressWarnings({
- "removal", // Tests deprecated getId() / setId() for backward
compatibility
+ "removal", // Tests deprecated getId() / setId() for backward
compatibility
"java:S5778", // assertThrows lambdas with chained calls; intermediate
invocations do not throw in practice
- "resource" // Reader fixtures returned by getReader() overrides are
test stubs (null / throwing); no resource to close.
+ "resource", // Reader fixtures returned by getReader() overrides are
test stubs (null / throwing); no resource to close.
+ "rawtypes", // JsonSchema/JsonSchemaProperty are self-typed CRTP
roots; direct instantiation is intentionally raw (accepted 10.0.0 tradeoff).
+ "unchecked" // See rawtypes rationale above.
})
class JsonSchemaMap_Test extends TestBase {
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaPropertySimpleArray_Test.java
b/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaPropertySimpleArray_Test.java
index f1d6bcb2f7..a6a06b7f1d 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaPropertySimpleArray_Test.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaPropertySimpleArray_Test.java
@@ -25,7 +25,8 @@ import org.junit.jupiter.api.*;
* Tests for JsonSchemaPropertySimpleArray fluent setter overrides.
*/
@SuppressWarnings({
- "removal" // Tests deprecated setId() method for backward compatibility
+ "removal", // Tests deprecated setId() method for backward
compatibility
+ "rawtypes"
})
class JsonSchemaPropertySimpleArray_Test extends TestBase {
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaProperty_Test.java
b/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaProperty_Test.java
index 1269a3c732..1d6b8cb298 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaProperty_Test.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaProperty_Test.java
@@ -24,13 +24,17 @@ import org.junit.jupiter.api.*;
/**
* Tests for JsonSchemaProperty fluent setter overrides.
*/
+@SuppressWarnings({
+ "rawtypes", // JsonSchema/JsonSchemaProperty are self-typed CRTP
roots; direct instantiation is intentionally raw (accepted 10.0.0 tradeoff).
+ "unchecked" // See rawtypes rationale above.
+})
class JsonSchemaProperty_Test extends TestBase {
@Test void a01_fluentChaining_basicSetters() {
var p = new JsonSchemaProperty();
// Test that fluent methods return JsonSchemaProperty (not
JsonSchema)
- JsonSchemaProperty result;
+ JsonSchema<?> result;
result = p.setName("myProperty");
assertSame(p, result);
@@ -45,7 +49,7 @@ class JsonSchemaProperty_Test extends TestBase {
result = p.setType(JsonType.STRING);
assertSame(p, result);
- result = p.setId("http://example.com/schema");
+ result = p.setIdUri("http://example.com/schema"); //
Non-deprecated replacement for setId(); this test only exercises fluent
chaining.
assertSame(p, result);
}
@@ -53,7 +57,7 @@ class JsonSchemaProperty_Test extends TestBase {
var p = new JsonSchemaProperty();
// Test numeric constraint methods
- JsonSchemaProperty result;
+ JsonSchema<?> result;
result = p.setMultipleOf(5);
assertSame(p, result);
@@ -76,7 +80,7 @@ class JsonSchemaProperty_Test extends TestBase {
var p = new JsonSchemaProperty();
// Test string constraint methods
- JsonSchemaProperty result;
+ JsonSchema<?> result;
result = p.setMaxLength(50);
assertSame(p, result);
@@ -99,7 +103,7 @@ class JsonSchemaProperty_Test extends TestBase {
var p = new JsonSchemaProperty();
// Test array constraint methods
- JsonSchemaProperty result;
+ JsonSchema<?> result;
result = p.setMaxItems(10);
assertSame(p, result);
@@ -122,7 +126,7 @@ class JsonSchemaProperty_Test extends TestBase {
var p = new JsonSchemaProperty();
// Test object constraint methods
- JsonSchemaProperty result;
+ JsonSchema<?> result;
result = p.setMaxProperties(20);
assertSame(p, result);
@@ -131,7 +135,7 @@ class JsonSchemaProperty_Test extends TestBase {
result = p.setMinProperties(1);
assertSame(p, result);
- var props = new HashMap<String, JsonSchema>();
+ var props = new HashMap<String, JsonSchema<?>>();
result = p.setProperties(props);
assertSame(p, result);
@@ -143,7 +147,7 @@ class JsonSchemaProperty_Test extends TestBase {
var p = new JsonSchemaProperty();
// Test required and enum methods
- JsonSchemaProperty result;
+ JsonSchema<?> result;
result = p.addRequired("field1", "field2");
assertSame(p, result);
@@ -163,7 +167,7 @@ class JsonSchemaProperty_Test extends TestBase {
var p = new JsonSchemaProperty();
// Test schema composition methods
- JsonSchemaProperty result;
+ JsonSchema<?> result;
result = p.addAllOf(new JsonSchema());
assertSame(p, result);
@@ -192,7 +196,7 @@ class JsonSchemaProperty_Test extends TestBase {
var p = new JsonSchemaProperty();
// Test metadata methods
- JsonSchemaProperty result;
+ JsonSchema<?> result;
result = p.setReadOnly(true);
assertSame(p, result);
@@ -253,7 +257,7 @@ class JsonSchemaProperty_Test extends TestBase {
var p = new JsonSchemaProperty();
// Test definition methods
- JsonSchemaProperty result;
+ JsonSchema<?> result;
result = p.addDefinition("def1", new JsonSchema());
assertSame(p, result);
@@ -270,7 +274,7 @@ class JsonSchemaProperty_Test extends TestBase {
var p = new JsonSchemaProperty();
// Test dependency methods
- JsonSchemaProperty result;
+ JsonSchema<?> result;
result = p.addDependency("dep1", new JsonSchema());
assertSame(p, result);
@@ -296,7 +300,7 @@ class JsonSchemaProperty_Test extends TestBase {
var p = new JsonSchemaProperty();
// Test pattern property methods
- JsonSchemaProperty result;
+ JsonSchema<?> result;
result = p.addPatternProperties(new
JsonSchemaProperty("pattern1"));
assertSame(p, result);
@@ -310,7 +314,7 @@ class JsonSchemaProperty_Test extends TestBase {
var p = new JsonSchemaProperty();
// Test prefix items methods
- JsonSchemaProperty result;
+ JsonSchema<?> result;
result = p.addPrefixItems(new JsonSchema());
assertSame(p, result);
@@ -324,7 +328,7 @@ class JsonSchemaProperty_Test extends TestBase {
var p = new JsonSchemaProperty();
// Test unevaluated methods
- JsonSchemaProperty result;
+ JsonSchema<?> result;
result = p.setUnevaluatedItems(new JsonSchema());
assertSame(p, result);
@@ -338,7 +342,7 @@ class JsonSchemaProperty_Test extends TestBase {
var p = new JsonSchemaProperty();
// Test addTypes method
- JsonSchemaProperty result = p.addTypes(JsonType.STRING,
JsonType.NULL);
+ JsonSchema<?> result = p.addTypes(JsonType.STRING,
JsonType.NULL);
assertSame(p, result);
assertInstanceOf(JsonSchemaProperty.class, result);
@@ -362,12 +366,12 @@ class JsonSchemaProperty_Test extends TestBase {
// addRequired(JsonSchemaProperty...)
var child = new JsonSchemaProperty("childField");
- JsonSchemaProperty r1 = p.addRequired(child);
+ JsonSchema<?> r1 = p.addRequired(child);
assertSame(p, r1);
assertInstanceOf(JsonSchemaProperty.class, r1);
// addRequired(List<String>)
- JsonSchemaProperty r2 = p.addRequired(l("field1", "field2"));
+ JsonSchema<?> r2 = p.addRequired(l("field1", "field2"));
assertSame(p, r2);
assertInstanceOf(JsonSchemaProperty.class, r2);
}
@@ -375,7 +379,7 @@ class JsonSchemaProperty_Test extends TestBase {
@Test void a21_setSchemaMap() {
var p = new JsonSchemaProperty("prop");
var map = new JsonSchemaMap() {};
- JsonSchemaProperty r = p.setSchemaMap(map);
+ JsonSchema<?> r = p.setSchemaMap(map);
assertSame(p, r);
assertInstanceOf(JsonSchemaProperty.class, r);
}
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaRef_Test.java
b/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaRef_Test.java
index 80f3aeb731..38443ac374 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaRef_Test.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaRef_Test.java
@@ -24,6 +24,9 @@ import org.junit.jupiter.api.*;
/**
* Tests for JsonSchemaRef fluent setter overrides.
*/
+@SuppressWarnings({
+ "rawtypes"
+})
class JsonSchemaRef_Test extends TestBase {
@Test void a01_fluentChaining_basicSetters() {
@@ -45,7 +48,7 @@ class JsonSchemaRef_Test extends TestBase {
result = r.setType(JsonType.STRING);
assertSame(r, result);
- result = r.setId("http://example.com/id");
+ result = r.setIdUri("http://example.com/id"); // Non-deprecated
replacement for setId(); this test only exercises fluent chaining.
assertSame(r, result);
}
@@ -131,7 +134,7 @@ class JsonSchemaRef_Test extends TestBase {
result = r.setMinProperties(1);
assertSame(r, result);
- var props = new HashMap<String, JsonSchema>();
+ var props = new HashMap<String, JsonSchema<?>>();
result = r.setProperties(props);
assertSame(r, result);
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaValidator_Test.java
b/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaValidator_Test.java
index 99b6152abd..b04573cdae 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaValidator_Test.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchemaValidator_Test.java
@@ -30,7 +30,9 @@ import org.junit.jupiter.api.*;
* Tests {@link JsonSchemaValidator} in isolation against {@link JsonSchema}
beans.
*/
@SuppressWarnings({
- "java:S5778" // assertThrows lambdas intentionally build the
schema/validator and supply the value inline; the throwing call is unambiguous
(validate) and hoisting validator+argument locals across ~40 tests would bloat
the file without clarity gain.
+ "java:S5778", // assertThrows lambdas intentionally build the
schema/validator and supply the value inline; the throwing call is unambiguous
(validate) and hoisting validator+argument locals across ~40 tests would bloat
the file without clarity gain.
+ "rawtypes", // JsonSchema/JsonSchemaProperty are self-typed CRTP
roots; direct instantiation is intentionally raw (accepted 10.0.0 tradeoff).
+ "unchecked" // See rawtypes rationale above.
})
class JsonSchemaValidator_Test extends TestBase {
diff --git
a/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchema_Test.java
b/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchema_Test.java
index 7c600b3f4f..8f601e5b4b 100644
---
a/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchema_Test.java
+++
b/juneau-bean/juneau-bean-jsonschema/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchema_Test.java
@@ -25,7 +25,9 @@ import org.apache.juneau.marshall.json5.*;
import org.junit.jupiter.api.*;
@SuppressWarnings({
- "removal" // Tests deprecated API for backward compatibility
+ "removal", // Tests deprecated API for backward compatibility
+ "rawtypes", // JsonSchema/JsonSchemaProperty are self-typed CRTP
roots; direct instantiation is intentionally raw (accepted 10.0.0 tradeoff).
+ "unchecked" // See rawtypes rationale above.
})
public class JsonSchema_Test extends TestBase {
diff --git
a/juneau-integration-tests/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchema_Test.java
b/juneau-integration-tests/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchema_Test.java
index d349e40a67..fd04789209 100644
---
a/juneau-integration-tests/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchema_Test.java
+++
b/juneau-integration-tests/src/test/java/org/apache/juneau/bean/jsonschema/JsonSchema_Test.java
@@ -25,7 +25,9 @@ import org.apache.juneau.marshall.json5.*;
import org.junit.jupiter.api.*;
@SuppressWarnings({
- "removal" // Tests deprecated API for backward compatibility
+ "removal", // Tests deprecated API for backward compatibility
+ "rawtypes", // JsonSchema/JsonSchemaProperty are self-typed CRTP
roots; direct instantiation is intentionally raw (accepted 10.0.0 tradeoff).
+ "unchecked" // See rawtypes rationale above.
})
public class JsonSchema_Test extends TestBase {