You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2026/07/22 18:26:48 UTC
(juneau) 02/02: TODO-280: add missing collection-family API methods to DTO beans
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
commit 49b93f9d98dde55f545c78672c95ed831ec58cc6
Author: James Bognar <ja...@apache.org>
AuthorDate: Wed Jul 22 14:26:31 2026 -0400
TODO-280: add missing collection-family API methods to DTO beans
API-01 fix from the reactor quality grid: bring List/Map properties to the
full 4-method family (setX(X...), setX(Collection<X>), addX(X...),
addX(Collection<X>)) plus keyed Map single-entry adders across
juneau-bean-mcp, juneau-bean-jsonapi, juneau-bean-jsonschema, and
juneau-bean-openapi-v3.
Pure-additive (new overloads only; no existing signature changed or removed);
round-trip marshalling stays byte-identical. 21 files, 61 new methods.
Co-authored-by: Cursor <cu...@cursor.com>
---
.../juneau/bean/jsonapi/JsonApiDocument.java | 76 +++++++++
.../apache/juneau/bean/jsonapi/JsonApiError.java | 29 ++++
.../apache/juneau/bean/jsonapi/JsonApiLink.java | 15 ++
.../juneau/bean/jsonapi/JsonApiRelationship.java | 29 ++++
.../juneau/bean/jsonapi/JsonApiResource.java | 28 ++++
.../bean/jsonapi/JsonApiResourceIdentifier.java | 15 ++
.../apache/juneau/bean/jsonapi/JsonApiVersion.java | 15 ++
.../apache/juneau/bean/jsonschema/JsonSchema.java | 173 +++++++++++++++++++++
.../apache/juneau/bean/mcp/CallToolRequest.java | 15 ++
.../org/apache/juneau/bean/mcp/CallToolResult.java | 38 +++++
.../apache/juneau/bean/mcp/ClientCapabilities.java | 29 ++++
.../apache/juneau/bean/mcp/GetPromptRequest.java | 15 ++
.../apache/juneau/bean/mcp/GetPromptResult.java | 38 +++++
.../org/apache/juneau/bean/mcp/JsonSchema.java | 66 ++++++++
.../apache/juneau/bean/mcp/ListPromptsResult.java | 38 +++++
.../juneau/bean/mcp/ListResourcesResult.java | 38 +++++
.../apache/juneau/bean/mcp/ListToolsResult.java | 38 +++++
.../java/org/apache/juneau/bean/mcp/Prompt.java | 38 +++++
.../apache/juneau/bean/mcp/ReadResourceResult.java | 38 +++++
.../apache/juneau/bean/mcp/ServerCapabilities.java | 15 ++
.../org/apache/juneau/bean/openapi3/OpenApi.java | 22 +++
21 files changed, 808 insertions(+)
diff --git a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiDocument.java b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiDocument.java
index 029efbd7f2..5d42ecf42a 100644
--- a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiDocument.java
+++ b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiDocument.java
@@ -129,6 +129,17 @@ public class JsonApiDocument {
return this;
}
+ /**
+ * Bean property setter: <property>errors</property>.
+ *
+ * @param value The new value for this property.
+ * @return This object.
+ */
+ public JsonApiDocument setErrors(JsonApiError...value) {
+ errors = list(value);
+ return this;
+ }
+
/**
* Bean property appender: <property>errors</property>.
*
@@ -142,6 +153,19 @@ public class JsonApiDocument {
return this;
}
+ /**
+ * Bean property appender: <property>errors</property>.
+ *
+ * @param value The error objects to append.
+ * @return This object.
+ */
+ public JsonApiDocument addErrors(Collection<JsonApiError> value) {
+ if (errors == null)
+ errors = list();
+ errors.addAll(value);
+ return this;
+ }
+
/**
* Bean property getter: <property>meta</property>.
*
@@ -160,6 +184,20 @@ public class JsonApiDocument {
return this;
}
+ /**
+ * Convenience method to add a single meta entry.
+ *
+ * @param name The meta key. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The meta value. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object.
+ */
+ public JsonApiDocument putMeta(String name, Object value) {
+ if (meta == null)
+ meta = map();
+ meta.put(name, value);
+ return this;
+ }
+
/**
* Bean property getter: <property>jsonapi</property>.
*
@@ -203,6 +241,20 @@ public class JsonApiDocument {
return this;
}
+ /**
+ * Convenience method to add a single link.
+ *
+ * @param name The link name. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The link value (a {@link String} URL or a {@link JsonApiLink} object). Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object.
+ */
+ public JsonApiDocument putLink(String name, Object value) {
+ if (links == null)
+ links = map();
+ links.put(name, value);
+ return this;
+ }
+
/**
* Bean property getter: <property>included</property>.
*
@@ -221,6 +273,17 @@ public class JsonApiDocument {
return this;
}
+ /**
+ * Bean property setter: <property>included</property>.
+ *
+ * @param value The new value for this property.
+ * @return This object.
+ */
+ public JsonApiDocument setIncluded(JsonApiResource...value) {
+ included = list(value);
+ return this;
+ }
+
/**
* Bean property appender: <property>included</property>.
*
@@ -234,6 +297,19 @@ public class JsonApiDocument {
return this;
}
+ /**
+ * Bean property appender: <property>included</property>.
+ *
+ * @param value The resource objects to append.
+ * @return This object.
+ */
+ public JsonApiDocument addIncluded(Collection<JsonApiResource> value) {
+ if (included == null)
+ included = list();
+ included.addAll(value);
+ return this;
+ }
+
/**
* Validates document-level invariants per the JSON:API spec.
*
diff --git a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiError.java b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiError.java
index 9ad8666c60..1b02518d08 100644
--- a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiError.java
+++ b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiError.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.jsonapi;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -92,6 +93,20 @@ public class JsonApiError {
return this;
}
+ /**
+ * Convenience method to add a single link.
+ *
+ * @param name The link name. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The link value (a {@link String} URL or a {@link JsonApiLink} object). Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object.
+ */
+ public JsonApiError putLink(String name, Object value) {
+ if (links == null)
+ links = map();
+ links.put(name, value);
+ return this;
+ }
+
/**
* Bean property getter: <property>status</property>.
*
@@ -206,6 +221,20 @@ public class JsonApiError {
return this;
}
+ /**
+ * Convenience method to add a single meta entry.
+ *
+ * @param name The meta key. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The meta value. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object.
+ */
+ public JsonApiError putMeta(String name, Object value) {
+ if (meta == null)
+ meta = map();
+ meta.put(name, value);
+ return this;
+ }
+
@Override /* Overridden from Object */
public String toString() {
return Json.of(this);
diff --git a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiLink.java b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiLink.java
index aae1f0d939..37ae2cb1a4 100644
--- a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiLink.java
+++ b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiLink.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.jsonapi;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -193,6 +194,20 @@ public class JsonApiLink {
return this;
}
+ /**
+ * Convenience method to add a single meta entry.
+ *
+ * @param name The meta key. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The meta value. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object.
+ */
+ public JsonApiLink putMeta(String name, Object value) {
+ if (meta == null)
+ meta = map();
+ meta.put(name, value);
+ return this;
+ }
+
@Override /* Overridden from Object */
public String toString() {
return Json.of(this);
diff --git a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiRelationship.java b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiRelationship.java
index e1e0bad022..d135b56988 100644
--- a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiRelationship.java
+++ b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiRelationship.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.jsonapi;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -123,6 +124,20 @@ public class JsonApiRelationship {
return this;
}
+ /**
+ * Convenience method to add a single link.
+ *
+ * @param name The link name. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The link value (a {@link String} URL or a {@link JsonApiLink} object). Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object.
+ */
+ public JsonApiRelationship putLink(String name, Object value) {
+ if (links == null)
+ links = map();
+ links.put(name, value);
+ return this;
+ }
+
/**
* Bean property getter: <property>meta</property>.
*
@@ -141,6 +156,20 @@ public class JsonApiRelationship {
return this;
}
+ /**
+ * Convenience method to add a single meta entry.
+ *
+ * @param name The meta key. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The meta value. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object.
+ */
+ public JsonApiRelationship putMeta(String name, Object value) {
+ if (meta == null)
+ meta = map();
+ meta.put(name, value);
+ return this;
+ }
+
@Override /* Overridden from Object */
public String toString() {
return Json.of(this);
diff --git a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiResource.java b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiResource.java
index 9fcdc610bb..37de6a4566 100644
--- a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiResource.java
+++ b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiResource.java
@@ -207,6 +207,20 @@ public class JsonApiResource {
return this;
}
+ /**
+ * Convenience method to add a single link.
+ *
+ * @param name The link name. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The link value (a {@link String} URL or a {@link JsonApiLink} object). Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object.
+ */
+ public JsonApiResource putLink(String name, Object value) {
+ if (links == null)
+ links = map();
+ links.put(name, value);
+ return this;
+ }
+
/**
* Bean property getter: <property>meta</property>.
*
@@ -225,6 +239,20 @@ public class JsonApiResource {
return this;
}
+ /**
+ * Convenience method to add a single meta entry.
+ *
+ * @param name The meta key. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The meta value. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object.
+ */
+ public JsonApiResource putMeta(String name, Object value) {
+ if (meta == null)
+ meta = map();
+ meta.put(name, value);
+ return this;
+ }
+
@Override /* Overridden from Object */
public String toString() {
return Json.of(this);
diff --git a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiResourceIdentifier.java b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiResourceIdentifier.java
index 8d796b89fa..fd90a21d81 100644
--- a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiResourceIdentifier.java
+++ b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiResourceIdentifier.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.jsonapi;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -113,6 +114,20 @@ public class JsonApiResourceIdentifier {
return this;
}
+ /**
+ * Convenience method to add a single meta entry.
+ *
+ * @param name The meta key. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The meta value. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object.
+ */
+ public JsonApiResourceIdentifier putMeta(String name, Object value) {
+ if (meta == null)
+ meta = map();
+ meta.put(name, value);
+ return this;
+ }
+
@Override /* Overridden from Object */
public String toString() {
return Json.of(this);
diff --git a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiVersion.java b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiVersion.java
index 2e4e6f6516..91f7969deb 100644
--- a/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiVersion.java
+++ b/juneau-bean/juneau-bean-jsonapi/src/main/java/org/apache/juneau/bean/jsonapi/JsonApiVersion.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.jsonapi;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -91,6 +92,20 @@ public class JsonApiVersion {
return this;
}
+ /**
+ * Convenience method to add a single meta entry.
+ *
+ * @param name The meta key. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The meta value. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object.
+ */
+ public JsonApiVersion putMeta(String name, Object value) {
+ if (meta == null)
+ meta = map();
+ meta.put(name, value);
+ return this;
+ }
+
@Override /* Overridden from Object */
public String toString() {
return Json.of(this);
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 8dce1552b1..2a6ffdf1d7 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
@@ -437,6 +437,18 @@ public class JsonSchema<SELF extends JsonSchema<SELF>> {
return self();
}
+ /**
+ * Bean property appender: <property>allOf</property>.
+ *
+ * @param value The collection of items to append to the <property>allOf</property> property on this bean.
+ * @return This object.
+ */
+ public SELF addAllOf(Collection<JsonSchema<?>> value) {
+ setMasterOn(value);
+ this.allOf = addAll(this.allOf, value == null ? null : new ArrayList<>(value));
+ return self();
+ }
+
/**
* Bean property appender: <property>anyOf</property>.
*
@@ -452,6 +464,20 @@ public class JsonSchema<SELF extends JsonSchema<SELF>> {
return self();
}
+ /**
+ * Bean property appender: <property>anyOf</property>.
+ *
+ * @param value The collection of items to append to the <property>anyOf</property> property on this bean.
+ * @return This object.
+ */
+ public SELF addAnyOf(Collection<JsonSchema<?>> value) {
+ if (this.anyOf == null)
+ this.anyOf = new LinkedList<>();
+ setMasterOn(value);
+ this.anyOf.addAll(value);
+ return self();
+ }
+
/**
* Bean property appender: <property>$defs</property>.
*
@@ -540,6 +566,19 @@ public class JsonSchema<SELF extends JsonSchema<SELF>> {
return self();
}
+ /**
+ * Bean property appender: <property>enum</property>.
+ *
+ * @param value The collection of items to append to the <property>enum</property> property on this bean.
+ * @return This object.
+ */
+ public SELF addEnum(Collection<Object> value) {
+ if (this.enum_ == null)
+ this.enum_ = new LinkedList<>();
+ this.enum_.addAll(value);
+ return self();
+ }
+
/**
* Bean property appender: <property>examples</property>.
*
@@ -554,6 +593,19 @@ public class JsonSchema<SELF extends JsonSchema<SELF>> {
return self();
}
+ /**
+ * Bean property appender: <property>examples</property>.
+ *
+ * @param value The collection of items to append to the <property>examples</property> property on this bean.
+ * @return This object.
+ */
+ public SELF addExamples(Collection<Object> value) {
+ if (this.examples == null)
+ this.examples = new LinkedList<>();
+ this.examples.addAll(value);
+ return self();
+ }
+
/**
* Bean property appender: <property>items</property>.
*
@@ -583,6 +635,20 @@ public class JsonSchema<SELF extends JsonSchema<SELF>> {
return self();
}
+ /**
+ * Bean property appender: <property>oneOf</property>.
+ *
+ * @param value The collection of items to append to the <property>oneOf</property> property on this bean.
+ * @return This object.
+ */
+ public SELF addOneOf(Collection<JsonSchema<?>> value) {
+ if (this.oneOf == null)
+ this.oneOf = new LinkedList<>();
+ setMasterOn(value);
+ this.oneOf.addAll(value);
+ return self();
+ }
+
/**
* Bean property appender: <property>patternProperties</property>.
*
@@ -605,6 +671,28 @@ public class JsonSchema<SELF extends JsonSchema<SELF>> {
return self();
}
+ /**
+ * Bean property appender: <property>patternProperties</property>.
+ *
+ * <p>
+ * Unlike {@link #addPatternProperties(JsonSchemaProperty...)}, this keyed form does not require the value's
+ * <property>name</property> property to be pre-set — it is set automatically from {@code name}.
+ *
+ * @param name The key in the patternProperties map entry. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The value in the patternProperties map entry. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object.
+ */
+ public SELF addPatternProperty(String name, JsonSchema<?> value) {
+ if (this.patternProperties == null)
+ this.patternProperties = map();
+ if (value != null) {
+ setMasterOn(value);
+ value.setName(name);
+ }
+ this.patternProperties.put(name, value);
+ return self();
+ }
+
/**
* Bean property appender: <property>prefixItems</property>.
*
@@ -641,6 +729,28 @@ public class JsonSchema<SELF extends JsonSchema<SELF>> {
return self();
}
+ /**
+ * Bean property appender: <property>properties</property>.
+ *
+ * <p>
+ * Unlike {@link #addProperties(JsonSchema...)}, this keyed form does not require the value's
+ * <property>name</property> property to be pre-set — it is set automatically from {@code name}.
+ *
+ * @param name The key in the properties map entry. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The value in the properties map entry. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object.
+ */
+ public SELF addProperty(String name, JsonSchema<?> value) {
+ if (this.properties == null)
+ this.properties = map();
+ if (value != null) {
+ setMasterOn(value);
+ value.setName(name);
+ }
+ this.properties.put(name, value);
+ return self();
+ }
+
/**
* Bean property appender: <property>required</property>.
*
@@ -1426,6 +1536,16 @@ public class JsonSchema<SELF extends JsonSchema<SELF>> {
return self();
}
+ /**
+ * Bean property setter: <property>allOf</property>.
+ *
+ * @param value The new value for the <property>allOf</property> property on this bean.
+ * @return This object.
+ */
+ public SELF setAllOf(JsonSchema<?>...value) {
+ return setAllOf(list(value));
+ }
+
/**
* Bean property setter: <property>anyOf</property>.
*
@@ -1438,6 +1558,16 @@ public class JsonSchema<SELF extends JsonSchema<SELF>> {
return self();
}
+ /**
+ * Bean property setter: <property>anyOf</property>.
+ *
+ * @param value The new value for the <property>anyOf</property> property on this bean.
+ * @return This object.
+ */
+ public SELF setAnyOf(JsonSchema<?>...value) {
+ return setAnyOf(list(value));
+ }
+
/**
* Bean property setter: <property>const</property>.
*
@@ -1632,6 +1762,16 @@ public class JsonSchema<SELF extends JsonSchema<SELF>> {
return self();
}
+ /**
+ * Bean property setter: <property>enum</property>.
+ *
+ * @param value The new value for the <property>enum</property> property on this bean.
+ * @return This object.
+ */
+ public SELF setEnum(Object...value) {
+ return setEnum(list(value));
+ }
+
/**
* Bean property setter: <property>examples</property>.
*
@@ -1646,6 +1786,19 @@ public class JsonSchema<SELF extends JsonSchema<SELF>> {
return self();
}
+ /**
+ * Bean property setter: <property>examples</property>.
+ *
+ * <p>
+ * This property was added in Draft 06.
+ *
+ * @param value The new value for the <property>examples</property> property on this bean.
+ * @return This object.
+ */
+ public SELF setExamples(Object...value) {
+ return setExamples(list(value));
+ }
+
/**
* Bean property setter: <property>exclusiveMaximum</property>.
*
@@ -1906,6 +2059,16 @@ public class JsonSchema<SELF extends JsonSchema<SELF>> {
return self();
}
+ /**
+ * Bean property setter: <property>oneOf</property>.
+ *
+ * @param value The new value for the <property>oneOf</property> property on this bean.
+ * @return This object.
+ */
+ public SELF setOneOf(JsonSchema<?>...value) {
+ return setOneOf(list(value));
+ }
+
/**
* Bean property setter: <property>pattern</property>.
*
@@ -2012,6 +2175,16 @@ public class JsonSchema<SELF extends JsonSchema<SELF>> {
return self();
}
+ /**
+ * Bean property setter: <property>required</property>.
+ *
+ * @param value The new value for the <property>required</property> property on this bean.
+ * @return This object.
+ */
+ public SELF setRequired(String...value) {
+ return setRequired(list(value));
+ }
+
/**
* Associates a schema map with this schema for resolving other schemas identified through <property>$ref</property>
* properties.
diff --git a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/CallToolRequest.java b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/CallToolRequest.java
index 443c60cb74..e90ca0d5fa 100644
--- a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/CallToolRequest.java
+++ b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/CallToolRequest.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.mcp;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -70,4 +71,18 @@ public class CallToolRequest {
arguments = value;
return this;
}
+
+ /**
+ * Convenience method to add a single tool argument.
+ *
+ * @param name The argument name. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The argument value. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object (for method chaining).
+ */
+ public CallToolRequest putArgument(String name, Object value) {
+ if (arguments == null)
+ arguments = map();
+ arguments.put(name, value);
+ return this;
+ }
}
diff --git a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/CallToolResult.java b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/CallToolResult.java
index 9b21dfb598..ffe1849ba0 100644
--- a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/CallToolResult.java
+++ b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/CallToolResult.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.mcp;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -51,6 +52,43 @@ public class CallToolResult {
return this;
}
+ /**
+ * Sets the content blocks.
+ *
+ * @param value The new value. Can be <jk>null</jk> to unset the property.
+ * @return This object (for method chaining).
+ */
+ public CallToolResult setContent(Content...value) {
+ content = list(value);
+ return this;
+ }
+
+ /**
+ * Appends to the content blocks.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public CallToolResult addContent(Content...value) {
+ if (content == null)
+ content = list();
+ Collections.addAll(content, value);
+ return this;
+ }
+
+ /**
+ * Appends to the content blocks.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public CallToolResult addContent(Collection<Content> value) {
+ if (content == null)
+ content = list();
+ content.addAll(value);
+ return this;
+ }
+
/**
* When {@code true}, the tool reported an application-level error.
*
diff --git a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ClientCapabilities.java b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ClientCapabilities.java
index 73a74b3dc1..f7c55fd849 100644
--- a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ClientCapabilities.java
+++ b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ClientCapabilities.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.mcp;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -72,6 +73,20 @@ public class ClientCapabilities {
return this;
}
+ /**
+ * Convenience method to add a single sampling capability entry.
+ *
+ * @param name The entry name. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The entry value. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object (for method chaining).
+ */
+ public ClientCapabilities putSampling(String name, Object value) {
+ if (sampling == null)
+ sampling = map();
+ sampling.put(name, value);
+ return this;
+ }
+
/**
* Experimental capability extensions.
*
@@ -91,4 +106,18 @@ public class ClientCapabilities {
experimental = value;
return this;
}
+
+ /**
+ * Convenience method to add a single experimental extension entry.
+ *
+ * @param name The extension name. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The extension value. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object (for method chaining).
+ */
+ public ClientCapabilities putExperimental(String name, Object value) {
+ if (experimental == null)
+ experimental = map();
+ experimental.put(name, value);
+ return this;
+ }
}
diff --git a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/GetPromptRequest.java b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/GetPromptRequest.java
index 603bac1394..9e64bf226b 100644
--- a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/GetPromptRequest.java
+++ b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/GetPromptRequest.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.mcp;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -70,4 +71,18 @@ public class GetPromptRequest {
arguments = value;
return this;
}
+
+ /**
+ * Convenience method to add a single argument value.
+ *
+ * @param name The argument name. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The argument value. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object (for method chaining).
+ */
+ public GetPromptRequest putArgument(String name, Object value) {
+ if (arguments == null)
+ arguments = map();
+ arguments.put(name, value);
+ return this;
+ }
}
diff --git a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/GetPromptResult.java b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/GetPromptResult.java
index bbda5ab018..ff18bea0fa 100644
--- a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/GetPromptResult.java
+++ b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/GetPromptResult.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.mcp;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -70,4 +71,41 @@ public class GetPromptResult {
messages = value;
return this;
}
+
+ /**
+ * Sets rendered messages.
+ *
+ * @param value The new value. Can be <jk>null</jk> to unset the property.
+ * @return This object (for method chaining).
+ */
+ public GetPromptResult setMessages(PromptMessage...value) {
+ messages = list(value);
+ return this;
+ }
+
+ /**
+ * Appends to the rendered messages.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public GetPromptResult addMessages(PromptMessage...value) {
+ if (messages == null)
+ messages = list();
+ Collections.addAll(messages, value);
+ return this;
+ }
+
+ /**
+ * Appends to the rendered messages.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public GetPromptResult addMessages(Collection<PromptMessage> value) {
+ if (messages == null)
+ messages = list();
+ messages.addAll(value);
+ return this;
+ }
}
diff --git a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/JsonSchema.java b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/JsonSchema.java
index ecac181488..babd42b2ec 100644
--- a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/JsonSchema.java
+++ b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/JsonSchema.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.mcp;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -78,6 +79,20 @@ public class JsonSchema {
return this;
}
+ /**
+ * Convenience method to add a single property schema.
+ *
+ * @param name The property name. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The property schema. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object (for method chaining).
+ */
+ public JsonSchema addProperty(String name, JsonSchema value) {
+ if (properties == null)
+ properties = map();
+ properties.put(name, value);
+ return this;
+ }
+
/**
* Required property names.
*
@@ -98,6 +113,43 @@ public class JsonSchema {
return this;
}
+ /**
+ * Sets required property names.
+ *
+ * @param value The new value. Can be <jk>null</jk> to unset the property.
+ * @return This object (for method chaining).
+ */
+ public JsonSchema setRequired(String...value) {
+ required = list(value);
+ return this;
+ }
+
+ /**
+ * Appends to the required property names.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public JsonSchema addRequired(String...value) {
+ if (required == null)
+ required = list();
+ Collections.addAll(required, value);
+ return this;
+ }
+
+ /**
+ * Appends to the required property names.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public JsonSchema addRequired(Collection<String> value) {
+ if (required == null)
+ required = list();
+ required.addAll(value);
+ return this;
+ }
+
/**
* {@code additionalProperties} keyword (boolean or nested schema).
*
@@ -157,4 +209,18 @@ public class JsonSchema {
defs = value;
return this;
}
+
+ /**
+ * Convenience method to add a single reusable sub-schema.
+ *
+ * @param name The sub-schema name. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The sub-schema. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object (for method chaining).
+ */
+ public JsonSchema addDef(String name, JsonSchema value) {
+ if (defs == null)
+ defs = map();
+ defs.put(name, value);
+ return this;
+ }
}
diff --git a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ListPromptsResult.java b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ListPromptsResult.java
index 412a3fa308..3b5865b144 100644
--- a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ListPromptsResult.java
+++ b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ListPromptsResult.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.mcp;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -51,6 +52,43 @@ public class ListPromptsResult {
return this;
}
+ /**
+ * Sets the prompt descriptors.
+ *
+ * @param value The new value. Can be <jk>null</jk> to unset the property.
+ * @return This object (for method chaining).
+ */
+ public ListPromptsResult setPrompts(Prompt...value) {
+ prompts = list(value);
+ return this;
+ }
+
+ /**
+ * Appends to the prompt descriptors.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public ListPromptsResult addPrompts(Prompt...value) {
+ if (prompts == null)
+ prompts = list();
+ Collections.addAll(prompts, value);
+ return this;
+ }
+
+ /**
+ * Appends to the prompt descriptors.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public ListPromptsResult addPrompts(Collection<Prompt> value) {
+ if (prompts == null)
+ prompts = list();
+ prompts.addAll(value);
+ return this;
+ }
+
/**
* Pagination cursor for the next page.
*
diff --git a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ListResourcesResult.java b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ListResourcesResult.java
index 5d91db6ddf..afa987c4a9 100644
--- a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ListResourcesResult.java
+++ b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ListResourcesResult.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.mcp;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -51,6 +52,43 @@ public class ListResourcesResult {
return this;
}
+ /**
+ * Sets the resource descriptors.
+ *
+ * @param value The new value. Can be <jk>null</jk> to unset the property.
+ * @return This object (for method chaining).
+ */
+ public ListResourcesResult setResources(Resource...value) {
+ resources = list(value);
+ return this;
+ }
+
+ /**
+ * Appends to the resource descriptors.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public ListResourcesResult addResources(Resource...value) {
+ if (resources == null)
+ resources = list();
+ Collections.addAll(resources, value);
+ return this;
+ }
+
+ /**
+ * Appends to the resource descriptors.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public ListResourcesResult addResources(Collection<Resource> value) {
+ if (resources == null)
+ resources = list();
+ resources.addAll(value);
+ return this;
+ }
+
/**
* Pagination cursor for the next page.
*
diff --git a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ListToolsResult.java b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ListToolsResult.java
index 62eef6c47b..307a7c3b97 100644
--- a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ListToolsResult.java
+++ b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ListToolsResult.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.mcp;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -51,6 +52,43 @@ public class ListToolsResult {
return this;
}
+ /**
+ * Sets the tool descriptors.
+ *
+ * @param value The new value. Can be <jk>null</jk> to unset the property.
+ * @return This object (for method chaining).
+ */
+ public ListToolsResult setTools(Tool...value) {
+ tools = list(value);
+ return this;
+ }
+
+ /**
+ * Appends to the tool descriptors.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public ListToolsResult addTools(Tool...value) {
+ if (tools == null)
+ tools = list();
+ Collections.addAll(tools, value);
+ return this;
+ }
+
+ /**
+ * Appends to the tool descriptors.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public ListToolsResult addTools(Collection<Tool> value) {
+ if (tools == null)
+ tools = list();
+ tools.addAll(value);
+ return this;
+ }
+
/**
* Pagination cursor for the next page.
*
diff --git a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/Prompt.java b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/Prompt.java
index e94f0fdeee..e27cc1ea4f 100644
--- a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/Prompt.java
+++ b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/Prompt.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.mcp;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -91,4 +92,41 @@ public class Prompt {
arguments = value;
return this;
}
+
+ /**
+ * Sets declared arguments.
+ *
+ * @param value The new value. Can be <jk>null</jk> to unset the property.
+ * @return This object (for method chaining).
+ */
+ public Prompt setArguments(PromptArgument...value) {
+ arguments = list(value);
+ return this;
+ }
+
+ /**
+ * Appends to the declared arguments.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public Prompt addArguments(PromptArgument...value) {
+ if (arguments == null)
+ arguments = list();
+ Collections.addAll(arguments, value);
+ return this;
+ }
+
+ /**
+ * Appends to the declared arguments.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public Prompt addArguments(Collection<PromptArgument> value) {
+ if (arguments == null)
+ arguments = list();
+ arguments.addAll(value);
+ return this;
+ }
}
diff --git a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ReadResourceResult.java b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ReadResourceResult.java
index 191a48f0d4..7f2abdbbfd 100644
--- a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ReadResourceResult.java
+++ b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ReadResourceResult.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.mcp;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -49,4 +50,41 @@ public class ReadResourceResult {
contents = value;
return this;
}
+
+ /**
+ * Sets resource bodies.
+ *
+ * @param value The new value. Can be <jk>null</jk> to unset the property.
+ * @return This object (for method chaining).
+ */
+ public ReadResourceResult setContents(ResourceContents...value) {
+ contents = list(value);
+ return this;
+ }
+
+ /**
+ * Appends to the resource bodies.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public ReadResourceResult addContents(ResourceContents...value) {
+ if (contents == null)
+ contents = list();
+ Collections.addAll(contents, value);
+ return this;
+ }
+
+ /**
+ * Appends to the resource bodies.
+ *
+ * @param value The values to append.
+ * @return This object (for method chaining).
+ */
+ public ReadResourceResult addContents(Collection<ResourceContents> value) {
+ if (contents == null)
+ contents = list();
+ contents.addAll(value);
+ return this;
+ }
}
diff --git a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ServerCapabilities.java b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ServerCapabilities.java
index e62b872ead..37355e9133 100644
--- a/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ServerCapabilities.java
+++ b/juneau-bean/juneau-bean-mcp/src/main/java/org/apache/juneau/bean/mcp/ServerCapabilities.java
@@ -16,6 +16,7 @@
*/
package org.apache.juneau.bean.mcp;
+import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.Shorts.*;
import java.util.*;
@@ -133,4 +134,18 @@ public class ServerCapabilities {
experimental = value;
return this;
}
+
+ /**
+ * Convenience method to add a single experimental extension entry.
+ *
+ * @param name The extension name. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
+ * @param value The extension value. Can be <jk>null</jk> (stored as <jk>null</jk>).
+ * @return This object (for method chaining).
+ */
+ public ServerCapabilities putExperimental(String name, Object value) {
+ if (experimental == null)
+ experimental = map();
+ experimental.put(name, value);
+ return this;
+ }
}
diff --git a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/OpenApi.java b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/OpenApi.java
index 30882d5b8f..f01e94dbb5 100644
--- a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/OpenApi.java
+++ b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/OpenApi.java
@@ -460,6 +460,17 @@ public class OpenApi extends OpenApiElement {
return this;
}
+ /**
+ * Sets the security requirements list.
+ *
+ * @param value The new value for this property.
+ * @return This object.
+ */
+ public OpenApi setSecurity(SecurityRequirement...value) {
+ setSecurity(toListBuilder(value, SecurityRequirement.class).sparse().build());
+ return this;
+ }
+
/**
* Sets the servers list.
*
@@ -473,6 +484,17 @@ public class OpenApi extends OpenApiElement {
return this;
}
+ /**
+ * Sets the servers list.
+ *
+ * @param value The new value for this property.
+ * @return This object.
+ */
+ public OpenApi setServers(Server...value) {
+ setServers(toListBuilder(value, Server.class).sparse().build());
+ return this;
+ }
+
/**
* Sets the tags list.
*