Package dev.hilla

Class OpenAPIUtil

java.lang.Object
dev.hilla.OpenAPIUtil

public class OpenAPIUtil extends Object
Utilities for interacting with the generated openapi.json.
  • Constructor Details

    • OpenAPIUtil

      public OpenAPIUtil()
  • Method Details

    • getCurrentOpenAPI

      public static String getCurrentOpenAPI(Path buildDirectory) throws IOException
      Reads the open api file from the build directory.
      Parameters:
      buildDirectory - the build directory, target if running with Maven
      Returns:
      the contents of the generated openapi.json
      Throws:
      IOException - if something went wrong
    • generateOpenAPI

      public static String generateOpenAPI(Path buildDirectory) throws IOException
      Generate a new openapi.json and return it, based on the classes in the build directory.
      Parameters:
      buildDirectory - the build directory, target if running with Maven
      Returns:
      the contents of the generated openapi.json
      Throws:
      IOException - if something went wrong
    • findOpenApiClasses

      public static Set<String> findOpenApiClasses(String openApiAsText) throws IOException
      Parses the given open api and finds all used classes.
      Parameters:
      openApiAsText - the open api JSON as text
      Returns:
      a set of classes used
      Throws:
      IOException - if parsing fails