Class OpenAPIComparator

java.lang.Object
org.brapi.schematools.core.openapi.comparator.OpenAPIComparator

public class OpenAPIComparator extends Object
Compares two OpenAPI Specifications
  • Constructor Details

    • OpenAPIComparator

      public OpenAPIComparator()
      Creates a Comparator with default options
    • OpenAPIComparator

      public OpenAPIComparator(OpenAPIComparatorOptions options)
  • Method Details

    • compare

      public Response<org.openapitools.openapidiff.core.model.ChangedOpenApi> compare(Path firstPath, Path secondPath)
      Compares the OpenAPI Specification in files on a file path and returns a diff object for downstream use.
      Parameters:
      firstPath - the path of the first Specification
      secondPath - the path of the second Specification
      Returns:
      a response with the diff output
    • compare

      public Response<Path> compare(Path firstPath, Path secondPath, Path outputPath, ComparisonOutputFormat outputFormat)
      Compares the OpenAPI Specification in files on a file path and outputs the result in the provided format. If the output file does not exist, it will be created along with any missing parent directories.
      Parameters:
      firstPath - the path of the first Specification
      secondPath - the path of the second Specification
      outputPath - the path of output file.
      outputFormat - the format of the output
      Returns:
      a response with the path of the created output
    • compare

      public Response<org.openapitools.openapidiff.core.model.ChangedOpenApi> compare(String firstContent, String secondContent)
      Compares the OpenAPI Specification in a string on a file path and outputs the result in the provided format and returns a diff object for downstream use.
      Parameters:
      firstContent - the content of the first Specification
      secondContent - the content of the second Specification
      Returns:
      a response with the diff output
    • compare

      public Response<Path> compare(String firstContent, String secondContent, Path outputPath, ComparisonOutputFormat outputFormat)
      Compares the OpenAPI Specification in files on a file path and a diff object for downstream use.
      Parameters:
      firstContent - the content of the first Specification
      secondContent - the content of the second Specification
      outputPath - the path of output file.
      outputFormat - the format of the output
      Returns:
      a response with the path of the created output