java.lang.Object
io.micronaut.jsonschema.generator.loaders.UrlLoader
All Implemented Interfaces:
SchemaLoader

public class UrlLoader extends Object implements 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
  • Constructor Details

    • UrlLoader

      public UrlLoader(String url)
  • Method Details

    • load

      public Schema load()
      Description copied from interface: SchemaLoader
      Loads a JSON schema.
      Specified by:
      load in interface SchemaLoader
      Returns:
      a Schema object representing the loaded JSON schema
    • isValidUrl

      public static boolean isValidUrl(String fileUrl)
      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

      public static List<String> getAllowedUrlPatterns()
    • setAllowedUrlPatterns

      public static void setAllowedUrlPatterns(List<String> allowedUrlPatterns)
    • addAllowedUrlPattern

      public static void addAllowedUrlPattern(String allowedUrlPattern)
    • addAllowedUrlPatterns

      public static void addAllowedUrlPatterns(List<String> allowedUrlPatterns)