fix(ibm-api-symmetry): handle dictionaries and top-level schemas #715
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This rule was subject to both false positives, as it flagged any schema with a
dictionary property (even when inappropriate), and false negatives, as it did
not check top-level schemas, only schema properties. This fix resolves both
issues and cleans up the rule logic on the whole.
Additionally, changes are made to the rule's logging. The code
to determine if one schema is a graph fragment of the other
uses a depth-first algorithm that prints a log, if it determines the
schema to violate the graph fragment pattern, with the reason behind
the violation. Due to the depth-first nature of the algorithm, the
logs are currently printed in depth first order, which is not as
coherent for the user to read.
This change introduces a stack to collect the logs during processing
and print them in reverse order afterwards to give the user a
better sense of what happened during the processing.
Resolves #699