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

fixing non-oneof inline struct handling in schemas #1904

Merged
merged 11 commits into from
Apr 2, 2019

Conversation

balopat
Copy link
Contributor

@balopat balopat commented Apr 2, 2019

Fixes #1900, #1901.
And adds unit tests for schema generation + zero-type checking in skaffold fix (fixing a panic case).

@codecov-io
Copy link

codecov-io commented Apr 2, 2019

Codecov Report

Merging #1904 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1904      +/-   ##
==========================================
+ Coverage   49.46%   49.47%   +0.01%     
==========================================
  Files         174      174              
  Lines        8036     8038       +2     
==========================================
+ Hits         3975     3977       +2     
  Misses       3683     3683              
  Partials      378      378
Impacted Files Coverage Δ
pkg/skaffold/schema/v1beta1/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1beta2/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/latest/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1beta5/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1beta6/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1alpha3/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1alpha5/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1beta4/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1beta3/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1alpha1/config.go 100% <ø> (ø) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 05e15dd...670b22f. Read the comment docs.

@balopat
Copy link
Contributor Author

balopat commented Apr 2, 2019

I just realized that with this change we have to add "oneOf" tag to all the oneOf fields in old schema versions as well - I'll do that soon.

hack/schemas/main.go Outdated Show resolved Hide resolved
hack/schemas/testdata/inline-anyof/input.go Outdated Show resolved Hide resolved
Copy link
Member

@tejal29 tejal29 left a comment

Choose a reason for hiding this comment

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

Few other test scenarios:

  1. What if an Inline Struct is a combination of oneof and other fields? shd this result as an error
  2. Inline Struct contains another Inline?

hack/schemas/main.go Outdated Show resolved Hide resolved
hack/schemas/main.go Outdated Show resolved Hide resolved
hack/schemas/main.go Outdated Show resolved Hide resolved
hack/schemas/main.go Outdated Show resolved Hide resolved
@balopat
Copy link
Contributor Author

balopat commented Apr 2, 2019

Few other test scenarios:

  1. What if an Inline Struct is a combination of oneof and other fields? shd this result as an error

this should be validated by schema unit tests - they are not currently tested.

  1. Inline Struct contains another Inline?

I would think this wouldn't work with schemagen yet, but haven't tried it - we should create an issue to explore/cover/validate against this edge case but doesn't belong to this PR.

@tejal29 tejal29 merged commit 1304708 into GoogleContainerTools:master Apr 2, 2019
@tejal29 tejal29 mentioned this pull request Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

json schema generator incorrectly assumes that inline fields are oneOf fields
5 participants