Skip to content
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

Bubble up circular reference errors #39

Merged
merged 1 commit into from
Dec 7, 2022

Conversation

wdullaer
Copy link
Contributor

@wdullaer wdullaer commented Dec 7, 2022

First of: thanks for the library, it is an amazing parser.

I got here through restish, which recently started using libopenapi.
The issue I'm trying to solve here is that our APIs have circular references, but we don't really consider those to be errors.

The change here is to enable the client to make a choice whether circular references are errors or not: in case of circular references BuildVxModel will return both the list of errors and the Model.

An alternative implementation could be to have BuildVxModel take a boolean parameter allowCircularReferences which will prevent the circular reference check from happening. This feels more elegant to me, but is more disruptive for existing clients, so I chose not to go this way.

@codecov-commenter
Copy link

Codecov Report

Base: 99.70% // Head: 99.69% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (ebdd103) compared to base (cbfb051).
Patch coverage: 80.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #39      +/-   ##
==========================================
- Coverage   99.70%   99.69%   -0.02%     
==========================================
  Files         135      135              
  Lines        7529     7533       +4     
==========================================
+ Hits         7507     7510       +3     
- Misses         22       23       +1     
Flag Coverage Δ
unittests 99.69% <80.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
document.go 86.15% <80.00%> (-2.38%) ⬇️
what-changed/model/security_requirement.go 100.00% <0.00%> (+1.61%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@daveshanley
Copy link
Member

Thanks very much for your contribution and the compliments!

I'm happy with this implementation, it may need updating if other checks are required down the road, but it works in a non-breaking way. Thank you for helping make libopenapi better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants