Skip to content

Commit

Permalink
Merge pull request #832 from dsmf/chore/improve-api-comparison-test
Browse files Browse the repository at this point in the history
Chore/improve api comparison test
  • Loading branch information
ds-jhartmann authored Jul 23, 2024
2 parents d034db1 + d834917 commit e2c1db4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ _**For better traceability add the corresponding GitHub issue number in each cha
### Changed

- Improved documentation for `GET /irs/policies/paged` endpoint. #639
- Cleanup in IrsApplicationTest.generatedOpenApiMatchesContract
(removed obsolete ignoringFields, improved assertion message)

## [5.4.0] - 2024-07-22

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,14 @@ void generatedOpenApiMatchesContract() throws Exception {
final Map<String, Object> generatedYamlMap = mapper.readerForMapOf(Object.class).readValue(generatedYaml);

try {
// To correctly display both documentations examples - manual and generated by annotations -
// we need to remove verification for some "examples", otherwise one or another won't display correctly
assertThat(generatedYamlMap)

.usingRecursiveComparison()

.ignoringFields("components.schemas.PageResult.example")
.ignoringFields("components.schemas.AspectModels.example")
.ignoringFields("components.schemas.BatchOrderResponse.example")
.ignoringFields("components.schemas.Jobs.example")
.ignoringFields("components.schemas.Policy")
.ignoringFields("components.schemas.BatchResponse.example")

.isEqualTo(definedYamlMap);
} catch (AssertionError e) {
// write changed API to file for easier comparison
Files.writeString(Paths.get("../docs/src/api/irs-api.actual.yaml"), generatedYaml);
throw e;
throw new AssertionError("Please compare the generated irs-api.actual.yaml "
+ "with irs-api.yaml to find the differences easily!", e);
}

}
Expand Down

0 comments on commit e2c1db4

Please sign in to comment.