Class UiApiContract
java.lang.Object
com.kingsrook.qqq.middleware.javalin.tools.UiApiContract
The UI API contract check, shared by core's UiApiContractTest and by the
contract tests of modules and qbits that register extensions.
Given the freshly generated document, the committed document and
(optionally) the release baseline, it reports:
- any difference between generated and committed (regenerate and commit);
- any breaking change from baseline to committed (needs /qqq/v{N+1});
- a changed document whose info.version was not bumped past the baseline;
- a MAJOR that does not match the URL version.
See docs/UI-API-CHANGELOG.md.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheck(String generatedYaml, String committedYaml, String baselineYaml, int expectedMajor, String regenerateHint) Run the contract checks.check(String generatedYaml, String committedYaml, String baselineYaml, int expectedMajor, String regenerateHint, List<String> acceptedBreakingChanges) Run the contract checks, accepting listed breaking-change reports.static StringgenerateCoreYaml(AbstractMiddlewareVersion middlewareVersion) The core document of a middleware version, as PublishAPI writes it (properties sorted, for stable diffs).static StringgenerateExtensionYaml(AbstractMiddlewareVersion middlewareVersion, MiddlewareSpecExtension extension) The document of one extension alone, as a module or qbit commits it.static StringSerialize an OpenAPI model the way the committed files are written.
-
Constructor Details
-
UiApiContract
public UiApiContract()
-
-
Method Details
-
generateCoreYaml
public static String generateCoreYaml(AbstractMiddlewareVersion middlewareVersion) throws QException The core document of a middleware version, as PublishAPI writes it (properties sorted, for stable diffs). Extensions are not included.- Throws:
QException
-
generateExtensionYaml
public static String generateExtensionYaml(AbstractMiddlewareVersion middlewareVersion, MiddlewareSpecExtension extension) throws QException The document of one extension alone, as a module or qbit commits it.- Throws:
QException
-
toYaml
-
check
public static List<String> check(String generatedYaml, String committedYaml, String baselineYaml, int expectedMajor, String regenerateHint) Run the contract checks. Returns the problems found (empty when the contract holds).- Parameters:
generatedYaml- the document generated from the code nowcommittedYaml- the committed documentbaselineYaml- the document as of the last release (null to skip the compatibility and version checks)expectedMajor- the URL major version (1 for /qqq/v1)regenerateHint- how to regenerate, for the message
-
check
public static List<String> check(String generatedYaml, String committedYaml, String baselineYaml, int expectedMajor, String regenerateHint, List<String> acceptedBreakingChanges) Run the contract checks, accepting listed breaking-change reports. An accepted change is a correction of the document to what the server always did (so no client could have relied on the old description); each entry is a substring of the reported change. Accepted changes are cleared when the baseline is refreshed. See docs/UI-API-CHANGELOG.md.
-