fix: allow multiple docs in one yaml#58
Merged
Merged
Conversation
arnarg
reviewed
Sep 16, 2025
arnarg
left a comment
Owner
There was a problem hiding this comment.
Thank you for this contribution! It looks good but could you also add a unit test for this change in ./pkgs/generators/crd/test_crd2jsonschema.py? :)
Contributor
Author
|
@arnarg Thank you for the review and an amazing project! I've added a test, LMK if there's anything else you'd like me to look at. |
This file contains hidden or 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
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.
I was trying to follow the Typed Resources Docs to create a definition for IPAddressPools and L2Advertisements from MetalLB.
I was unable to find a better source of their CRDs other than this one: https://github.com/metallb/metallb/blob/aa2fa5744e4bcd7ce5c44c8d3ba60c4fa360d303/config/manifests/metallb-native.yaml which seems to contain all of the CRDs in one file.
This resulted in the following error:
I've noticed that you're using
pyyaml.safe_load(), so I've just converted that piece of code to usepyyaml.safe_load_all()instead and then iterate over the documents within the file.However this caused another issue, as there is no real detection that we're looking at a CRD, so I've added a basic check for that as well.
The PR is just these 3 lines:
the rest is just indented to match.
With this change I was able to properly generate and use the MetalLB resources.