You're viewing an older version of Vaadin JavaDoc. Please see version 24.7.0 for the latest.
com.vaadin.hilla.

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

    • generateOpenAPI

      public static String generateOpenAPI(Path buildDirectory, boolean isProductionMode) 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

      isProductionMode - whether to generate the openapi for production mode

      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