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

Make array elements order to be stable and follow yaml Node #59

Closed
wants to merge 2 commits into from

Conversation

bitomaxsp
Copy link
Contributor

Test to confirm #58

@bitomaxsp bitomaxsp changed the title Add test that checks allOf fields order Make array elements order to be stable and follow yaml Node Dec 30, 2022
@codecov-commenter
Copy link

Codecov Report

Base: 99.77% // Head: 99.77% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (f24a517) compared to base (1a65c08).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #59      +/-   ##
==========================================
- Coverage   99.77%   99.77%   -0.01%     
==========================================
  Files         136      136              
  Lines        7851     7838      -13     
==========================================
- Hits         7833     7820      -13     
  Misses         18       18              
Flag Coverage Δ
unittests 99.77% <100.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
datamodel/high/base/schema.go 100.00% <100.00%> (ø)
datamodel/low/base/schema.go 100.00% <100.00%> (ø)
utils/utils.go 100.00% <100.00%> (ø)
what-changed/model/comparison_functions.go 98.33% <0.00%> (-0.06%) ⬇️
what-changed/model/example.go 100.00% <0.00%> (ø)
what-changed/model/document.go 100.00% <0.00%> (ø)
what-changed/model/operation.go 100.00% <0.00%> (ø)
what-changed/model/path_item.go 100.00% <0.00%> (ø)
what-changed/model/components.go 100.00% <0.00%> (ø)

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.

Copy link
Member

@daveshanley daveshanley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, just need some benchmarks per the comments and I think this should be all good

buildSchema := func(sch lowmodel.ValueReference[*base.SchemaProxy], bChan chan *SchemaProxy) {
p := &SchemaProxy{schema: &lowmodel.NodeReference[*base.SchemaProxy]{
// for every item, build schema sync since it is an array
buildSchema := func(sch lowmodel.ValueReference[*base.SchemaProxy]) *SchemaProxy {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a very real chance this behavior could result in a performance hit on the library, I understand why it's been moved to a sync model, I just want to ensure that before changing it permanently, it's not going to slow down applications with seriously large schemas.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be able to A/B test this change in a benchmark with some of the sample specs in test_specs.

the k8s or Stripe APIs are generally a good benchmark to check.

},
v: *res,
}
// We need to build arrays sequentially so call it in the loop instead of goroutines
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like my previous comment, to be sure this doesn't cost us performance (speed is essential for my use cases), I want to make sure this move to a sync model does not cost us anything. I don't think it will - but I need to be sure. Could you add some A/B benchmarks to ensure we're not slowing down?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @daveshanley . Sorry, i was on vacation.I tried doing benchmark, but on both (stripe and k8s) specs lib finds circular refs. (I followed BenchmarkNewDocument example for benchmarking)

I assume I need to wait for #64 to be merged. Or there is another approach: fork k8s spec and fix circular there then base test on it. What do you prefer ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Just jumping in to note that the Stripe API spec that's in the repo does actually contain some invalid infinite circular references, so that will still fail to load until I get around to adding the options to treat these as warnings rather than errors. The k8s spec should work correctly once our PR is completed.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BenjaminNolan Do you have any ETA on PR being merged?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey just want to jump in here, I have been working on an alternate PR that retains the async building nature but still retains the original order so shouldn't have an impact on performance. I am happy to continue with that and get that PR up ASAP which should reduce the need for benchmarking as we won't be changing the performance characteristics

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR here #66

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TristanSpeakEasy Fantastic. When can you merge #66?

@bitomaxsp
Copy link
Contributor Author

Closed in favor of #66

@bitomaxsp bitomaxsp closed this Jan 10, 2023
@bitomaxsp bitomaxsp deleted the test-allof-order branch January 10, 2023 11:28
This pull request was closed.
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.

5 participants