Package io.smallrye.openapi.runtime.io
Class OpenApiParser
- java.lang.Object
-
- io.smallrye.openapi.runtime.io.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:
- eric.wittmann@gmail.com
-
-
Constructor Summary
Constructors Constructor Description OpenApiParser(com.fasterxml.jackson.databind.JsonNode tree)Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.eclipse.microprofile.openapi.models.OpenAPIparse(InputStream stream, Format format)static org.eclipse.microprofile.openapi.models.OpenAPIparse(InputStream stream, Format format, Integer maximumStaticFileSize)Parses the resource found at the given stream.static org.eclipse.microprofile.openapi.models.OpenAPIparse(URL url)Parses the resource found at the given URL.static org.eclipse.microprofile.openapi.models.media.SchemaparseSchema(String schemaJson)Parses the schema in the provided String.
-
-
-
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 ofOpenAPI.- 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, Integer maximumStaticFileSize) throws IOException
Parses the resource found at the given stream. The format of the stream must be specified.- Parameters:
stream- InputStream containing an OpenAPI documentformat- Format of the streammaximumStaticFileSize- Integer to change (usually to increase) the maximum static file size- Returns:
- OpenAPIImpl parsed from the stream
- Throws:
IOException- Errors in reading the stream
-
parse
public static final org.eclipse.microprofile.openapi.models.OpenAPI parse(InputStream stream, Format format) throws IOException
- Throws:
IOException
-
parseSchema
public static final org.eclipse.microprofile.openapi.models.media.Schema parseSchema(String schemaJson)
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:
OpenApiRuntimeException- Errors in reading the String
-
-