-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#16 Provide a single method to compare 2 OpenAPI instances
- Loading branch information
Showing
2 changed files
with
29 additions
and
8 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
swagger-brake/src/main/java/io/redskap/swagger/brake/runner/Checker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.redskap.swagger.brake.runner; | ||
|
||
import java.util.Collection; | ||
|
||
import io.redskap.swagger.brake.core.BreakChecker; | ||
import io.redskap.swagger.brake.core.BreakingChange; | ||
import io.redskap.swagger.brake.core.model.Specification; | ||
import io.redskap.swagger.brake.core.model.transformer.Transformer; | ||
import io.swagger.v3.oas.models.OpenAPI; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class Checker { | ||
private final Transformer<OpenAPI, Specification> transformer; | ||
private final BreakChecker breakChecker; | ||
|
||
public Collection<BreakingChange> check(OpenAPI oldApi, OpenAPI newApi) { | ||
log.info("Starting the check for breaking API changes"); | ||
Collection<BreakingChange> breakingChanges = breakChecker.check(transformer.transform(oldApi), transformer.transform(newApi)); | ||
log.info("Check is finished"); | ||
return breakingChanges; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters