-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add Category
loading from YAML source with validation
#449
base: dg/refactor-modelindex
Are you sure you want to change the base?
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
[parent] + parent.ancestors | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ancestors array is being built in the wrong order. The current code returns ancestors from child to root, but the tests expect root to child order. Change to parent.ancestors + [parent]
to match test expectations.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one's not correct, the tests expect child to root order. (This line was copied from the existing code to keep existing behaviour.)
Category#load_from_source
Category
loading from YAML source with validation
ef16427
to
0a82d86
Compare
# Iterate over the category and all its descendants | ||
# | ||
# @yield [Category] | ||
def traverse(&block) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume usage of this will come in later PRs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I've been using it for debugging, ex. for recursively printing out the taxonomy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
Similar to #443, but for categories: this PR adds the ability to load
Category
objects from a YAML source with validation.This implementation fully supports secondary paths to a given category defined using a
secondary_children
key in the YAML source containing an array. Example:The approach to loading categories is also different from the prototype:
load_from_source
takes the parsed YAML objects for all verticals (not just one). This was needed because: