Class UrlLoader
java.lang.Object
io.micronaut.jsonschema.generator.loaders.UrlLoader
- All Implemented Interfaces:
SchemaLoader
Loads a JSON schema from a URL.
This class implements the
SchemaLoader
interface and provides the functionality
to load a JSON schema from a given URL by opening an HTTP connection and reading the content.- Author:
- Elif Kurtay
-
Field Summary
Fields inherited from interface io.micronaut.jsonschema.generator.loaders.SchemaLoader
JSON_MAPPER
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addAllowedUrlPattern
(String allowedUrlPattern) static void
addAllowedUrlPatterns
(List<String> allowedUrlPatterns) static boolean
isValidUrl
(String fileUrl) Validates if the provided URL matches any of the allowed patterns.load()
Loads a JSON schema.static void
setAllowedUrlPatterns
(List<String> allowedUrlPatterns)
-
Constructor Details
-
UrlLoader
-
-
Method Details
-
load
Description copied from interface:SchemaLoader
Loads a JSON schema.- Specified by:
load
in interfaceSchemaLoader
- Returns:
- a
Schema
object representing the loaded JSON schema
-
isValidUrl
Validates if the provided URL matches any of the allowed patterns.- Parameters:
fileUrl
- The URL to validate.- Returns:
- true if the URL matches at least one allowed pattern, false otherwise.
-
getAllowedUrlPatterns
-
setAllowedUrlPatterns
-
addAllowedUrlPattern
-
addAllowedUrlPatterns
-