Class ByteArraySerializer
- java.lang.Object
-
- com.fasterxml.jackson.databind.JsonSerializer<T>
-
- com.fasterxml.jackson.databind.ser.std.StdSerializer<byte[]>
-
- org.openapitools.codegen.serializer.ByteArraySerializer
-
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable,com.fasterxml.jackson.databind.jsonschema.SchemaAware,Serializable
public class ByteArraySerializer extends com.fasterxml.jackson.databind.ser.std.StdSerializer<byte[]>Serializesbyte[]as a UTF-8 string, preserving the original base64 representation of an OpenAPIformat: byteexample. swagger-parser storesformat: byteexamples as the raw bytes of the input base64 string (not the decoded content), so writing those bytes back as a string round-trips to the user's original value. This prevents Jackson's default YAML behavior of emitting a!!binaryblock with a re-encoded payload.Load-bearing assumption: this only round-trips correctly because swagger-parser stores the raw input bytes. If swagger-parser ever decodes
format: byteexamples internally, this serializer must switch toBase64.getEncoder().encodeToString(value).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ByteArraySerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidserialize(byte[] value, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider serializers)-
Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_neitherNull, _nonEmpty, acceptJsonFormatVisitor, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrow
-
-
-
-
Method Detail
-
serialize
public void serialize(byte[] value, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider serializers) throws IOException- Specified by:
serializein classcom.fasterxml.jackson.databind.ser.std.StdSerializer<byte[]>- Throws:
IOException
-
-