add toYamlCustomized / toJsonCustomized methods, that expose jackson's now-preferred Builder objects to be configured on instead of doing config directly on mapper objects.

This commit is contained in:
2025-07-15 08:48:57 -05:00
parent 01f1e074e2
commit b78519aa55
5 changed files with 130 additions and 6 deletions

View File

@ -104,7 +104,7 @@ public class PublishAPI implements Callable<Integer>
// subsets of it (e.g., grouped by table mostly) - then we'll write out each such file //
/////////////////////////////////////////////////////////////////////////////////////////////////
OpenAPI openAPI = middlewareVersion.generateOpenAPIModel("qqq");
String yaml = YamlUtils.toYaml(openAPI, mapper ->
String yaml = YamlUtils.toYamlCustomized(openAPI, mapperBuilder ->
{
if(sortFileContentsForHuman)
{
@ -114,7 +114,7 @@ public class PublishAPI implements Callable<Integer>
}
else
{
mapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
mapperBuilder.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
}
});

View File

@ -112,9 +112,9 @@ public class ValidateAPIVersions implements Callable<Integer>
// generate a new spec based on current code in codebase //
///////////////////////////////////////////////////////////
OpenAPI openAPI = middlewareVersion.generateOpenAPIModel("qqq");
String yaml = YamlUtils.toYaml(openAPI, mapper ->
String yaml = YamlUtils.toYamlCustomized(openAPI, mapperBuilder ->
{
mapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
mapperBuilder.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
});
/////////////////////////////////////////////////////////////////////