-
-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for configurable levels of circular reference checking … #173
Merged
Conversation
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
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #173 +/- ##
=======================================
Coverage 99.80% 99.80%
=======================================
Files 148 148
Lines 10643 10673 +30
=======================================
+ Hits 10622 10652 +30
Misses 21 21
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
adding new properties to top level configs should work nicely. Signed-off-by: quobix <dave@quobix.com>
re-enabled missing converage Signed-off-by: quobix <dave@quobix.com>
Signed-off-by: quobix <dave@quobix.com>
Now a document can be pre-configured to ignore polymorphic circular references, and array references. Signed-off-by: quobix <dave@quobix.com>
Signed-off-by: quobix <dave@quobix.com>
Signed-off-by: quobix <dave@quobix.com>
Signed-off-by: quobix <dave@quobix.com>
LGTM @daveshanley |
Rock and roll! |
This was referenced Sep 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Circular references mean different things to different consumers. They may or may not be valid use cases. So after much discussion, I've decided to allow engineers to override my opinions on circular references.
Polymorphic based references, or array based references may or may not be valid circles, an empty array can break the loop for example. This isn't clear in the spec as there can be no way of knowing. The default position of
libopenapi
is to not ignore polymorphic (anyOf
,oneOf
,allOf
) loops, or array based loops.Now this can be configured, Choose to ignore polymorphic loops, or array loops, or both.
To configure the resolver directly, there are two new methods available:
IgnorePolymorphicCircularReferences()
andIgnoreArrayCircularReferences()
The same properties exist on the
datamodel.DocumentConfiguration
struct that allows them to be ignored when building a document. For example:The second update in this release is that the
datamodel.CircularReferenceResult
contains more detail onwhat type of circular reference was located. This is valuable to determine if you should programmatically ignore the loop.
The
IsArrayResult
will be true if the loop has come through an arrayThe
PolymorphicTypeResult
will beoneOf
,anyOf
orallOf
depending on which type was used and theisPolymorphicResult
value will also be true, as before.The docs have been updated for some more detail if required:
https://pb33f.io/libopenapi/circular-references/#circular-reference-results