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 voidaddAllowedUrlPattern(String allowedUrlPattern) static voidaddAllowedUrlPatterns(List<String> allowedUrlPatterns) static booleanisValidUrl(String fileUrl) Validates if the provided URL matches any of the allowed patterns.load()Loads a JSON schema.static voidsetAllowedUrlPatterns(List<String> allowedUrlPatterns)
-
Constructor Details
-
UrlLoader
-
-
Method Details
-
load
Description copied from interface:SchemaLoaderLoads a JSON schema.- Specified by:
loadin interfaceSchemaLoader- Returns:
- a
Schemaobject 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
-