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

    Modifier and Type
    Method
    Description
    static com.fasterxml.jackson.databind.ObjectWriter
    createObjectWriter(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Format format)
    Creates an ObjectWriter for the given format with the appropriate settings.
    static String
    serialize(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 String
    serialize(org.eclipse.microprofile.openapi.models.OpenAPI openApi, com.fasterxml.jackson.databind.ObjectWriter writer)
    Serializes the given OpenAPI object using the provided ObjectWriter and returns it as a string.
    static String
    serialize(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • createObjectWriter

      public static com.fasterxml.jackson.databind.ObjectWriter createObjectWriter(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Format format)
      Creates an ObjectWriter for the given format with the appropriate settings.
      Parameters:
      objectMapper - the ObjectMapper to use
      format - the serialization format
      Returns:
      the ObjectWriter with 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 object
      format - 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 object
      objectMapper - the ObjectMapper to use
      format - 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 provided ObjectWriter and returns it as a string.
      Parameters:
      openApi - the OpenAPI object
      writer - the ObjectWriter to use
      Returns:
      OpenAPI object as a String
      Throws:
      IOException - Errors in processing the model