Class OpenAPIUtil

java.lang.Object
com.vaadin.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, boolean isProductionMode) throws IOException
      Reads the open api file from the build directory.
      Parameters:
      buildDirectory - the build directory, target if running with Maven
      isProductionMode - whether to generate the openapi for production mode
      Returns:
      the contents of the generated openapi.json
      Throws:
      IOException - if something went wrong
    • getCurrentOpenAPIPath

      public static Optional<Path> getCurrentOpenAPIPath(Path buildDirectory, boolean isProductionMode) throws IOException
      Returns the path to open api file from the build directory.
      Parameters:
      buildDirectory - the build directory, target if running with Maven
      isProductionMode - whether to generate the openapi for production mode
      Returns:
      the Path to the openapi json file
      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