Class HttpPartSchema

java.lang.Object
org.apache.juneau.httppart.HttpPartSchema

public class HttpPartSchema extends Object
Represents an OpenAPI schema definition.

The schema definition can be applied to any HTTP parts such as bodies, headers, query/form parameters, and URL path parts.
The API is generic enough to apply to any path part although some attributes may only applicable for certain parts.

Schema objects are created via builders instantiated through the create() method.

Jakarta Bean Validation Support:

As of 9.2.0, this class supports Jakarta Bean Validation constraint annotations (e.g., @NotNull, @Size, @Min, @Max). When these annotations are encountered during schema building, they are automatically mapped to corresponding OpenAPI schema properties:

  • @NotNullrequired(true)
  • @Size(min=x, max=y)minLength/maxLength and minItems/maxItems
  • @Min(value)minimum(value)
  • @Max(value)maximum(value)
  • @Pattern(regexp)pattern(regexp)
  • @Emailformat("email")
  • @Positive/@PositiveOrZero/@Negative/@NegativeOrZero → Corresponding min/max constraints
  • @NotEmptyrequired(true) + minLength(1)/minItems(1)
  • @NotBlankrequired(true) + minLength(1) + pattern
  • @DecimalMin/@DecimalMaxminimum/maximum with optional exclusiveMinimum/exclusiveMaximum

This integration uses pure reflection and does not require jakarta.validation-api as a dependency. The annotations are detected and processed automatically when present.

Notes:
  • This class is thread safe and reusable.
See Also: