Class OpenApiParser


  • public class OpenApiParser
    extends Object
    A class used to parse an OpenAPI document (either YAML or JSON) into a Microprofile OpenAPI model tree.
    Author:
    [email protected]
    • Constructor Detail

      • OpenApiParser

        public OpenApiParser​(com.fasterxml.jackson.databind.JsonNode tree)
        Constructor.
        Parameters:
        tree - JsonNode
    • Method Detail

      • parse

        public static final org.eclipse.microprofile.openapi.models.OpenAPI parse​(URL url)
                                                                           throws IOException
        Parses the resource found at the given URL. This method accepts resources either in JSON or YAML format. It will parse the input and, assuming it is valid, return an instance of OpenAPI.
        Parameters:
        url - URL to OpenAPI document
        Returns:
        OpenAPIImpl parsed from URL
        Throws:
        IOException - URL parameter is not found
      • parse

        public static final org.eclipse.microprofile.openapi.models.OpenAPI parse​(InputStream stream,
                                                                                  Format format)
                                                                           throws IOException
        Parses the resource found at the given stream. The format of the stream must be specified.
        Parameters:
        stream - InputStream containing an OpenAPI document
        format - Format of the stream
        Returns:
        OpenAPIImpl parsed from the stream
        Throws:
        IOException - Errors in reading the stream
      • parseSchema

        public static final org.eclipse.microprofile.openapi.models.media.Schema parseSchema​(String schemaJson)
                                                                                      throws IOException
        Parses the schema in the provided String. The format of the stream must be JSON.
        Parameters:
        schemaJson - String containing a JSON formatted schema
        Returns:
        Schema parsed from the String
        Throws:
        IOException - Errors in reading the String