Open
Description
I am using the following JSON Schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "BinaryImageAttributes",
"type": "object",
"properties": {
"bytes": {
"type": "string",
"media": {
"binaryEncoding": "base64"
},
"description": "Base64-encoded binary image data.",
"minLength": 1,
"maxLength": 102400
}
},
"required": ["bytes"]
}
This is generating the following Java Bean:
package io.humangraphics.backend.lambda.image.analyze.api.model.request;
import java.util.Arrays;
import javax.annotation.processing.Generated;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import jakarta.validation.constraints.NotNull;
/**
* BinaryImageAttributes
* <p>
*
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"bytes"
})
@Generated("jsonschema2pojo")
public class BinaryImageAttributes {
/**
* Base64-encoded binary image data.
* (Required)
*
*/
@JsonProperty("bytes")
@JsonPropertyDescription("Base64-encoded binary image data.")
@NotNull
private byte[] bytes;
/**
* Base64-encoded binary image data.
* (Required)
*
*/
@JsonProperty("bytes")
public byte[] getBytes() {
return bytes;
}
/**
* Base64-encoded binary image data.
* (Required)
*
*/
@JsonProperty("bytes")
public void setBytes(byte[] bytes) {
this.bytes = bytes;
}
public BinaryImageAttributes withBytes(byte[] bytes) {
this.bytes = bytes;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(BinaryImageAttributes.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("bytes");
sb.append('=');
sb.append(((this.bytes == null)?"<null>":Arrays.toString(this.bytes).replace('[', '{').replace(']', '}').replace(", ", ",")));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
} else {
sb.append(']');
}
return sb.toString();
}
@Override
public int hashCode() {
int result = 1;
result = ((result* 31)+ Arrays.hashCode(this.bytes));
return result;
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof BinaryImageAttributes) == false) {
return false;
}
BinaryImageAttributes rhs = ((BinaryImageAttributes) other);
return Arrays.equals(this.bytes, rhs.bytes);
}
}
I expect the private byte[] bytes
field to have the following annotations:
/**
* Base64-encoded binary image data.
* (Required)
*
*/
@JsonProperty("bytes")
@JsonPropertyDescription("Base64-encoded binary image data.")
@NotNull
@Size(minLength=1, maxLength=102400)
private byte[] bytes;
It is currently missing the @Size
annotation.
Metadata
Metadata
Assignees
Labels
No labels