Package io.smallrye.openapi.runtime.io
Class OpenApiSerializer
- java.lang.Object
-
- io.smallrye.openapi.runtime.io.OpenApiSerializer
-
public class OpenApiSerializer extends Object
Class used to serialize an OpenAPI- Author:
- eric.wittmann@gmail.com
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.fasterxml.jackson.databind.ObjectWritercreateObjectWriter(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Format format)Creates anObjectWriterfor the given format with the appropriate settings.static Stringserialize(org.eclipse.microprofile.openapi.models.OpenAPI openApi, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Format format)Serializes the given OpenAPI object into either JSON or YAML and returns it as a string.static Stringserialize(org.eclipse.microprofile.openapi.models.OpenAPI openApi, com.fasterxml.jackson.databind.ObjectWriter writer)Serializes the given OpenAPI object using the providedObjectWriterand returns it as a string.static Stringserialize(org.eclipse.microprofile.openapi.models.OpenAPI openApi, Format format)Serializes the given OpenAPI object into either JSON or YAML and returns it as a string.
-
-
-
Method Detail
-
createObjectWriter
public static com.fasterxml.jackson.databind.ObjectWriter createObjectWriter(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Format format)Creates anObjectWriterfor the given format with the appropriate settings.- Parameters:
objectMapper- theObjectMapperto useformat- the serialization format- Returns:
- the
ObjectWriterwith the appropriate settings
-
serialize
public static String serialize(org.eclipse.microprofile.openapi.models.OpenAPI openApi, Format format) throws IOException
Serializes the given OpenAPI object into either JSON or YAML and returns it as a string.- Parameters:
openApi- the OpenAPI objectformat- the serialization format- Returns:
- OpenAPI object as a String
- Throws:
IOException- Errors in processing the JSON
-
serialize
public static String serialize(org.eclipse.microprofile.openapi.models.OpenAPI openApi, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Format format) throws IOException
Serializes the given OpenAPI object into either JSON or YAML and returns it as a string.- Parameters:
openApi- the OpenAPI objectobjectMapper- theObjectMapperto useformat- the serialization format- Returns:
- OpenAPI object as a String
- Throws:
IOException- Errors in processing the JSON
-
serialize
public static String serialize(org.eclipse.microprofile.openapi.models.OpenAPI openApi, com.fasterxml.jackson.databind.ObjectWriter writer) throws IOException
Serializes the given OpenAPI object using the providedObjectWriterand returns it as a string.- Parameters:
openApi- the OpenAPI objectwriter- theObjectWriterto use- Returns:
- OpenAPI object as a String
- Throws:
IOException- Errors in processing the model
-
-