-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sidebar should only show parent resources #27
base: main
Are you sure you want to change the base?
Conversation
|
||
parents(): string[] { | ||
const resource = this.schema["x-aep-resource"] | ||
if ('parents' in resource) { |
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.
could you just do resource.parents || []
?
@@ -90,6 +99,10 @@ class OpenAPI { | |||
return resources; | |||
} | |||
|
|||
parentResources(): ResourceSchema[] { | |||
return this.resources().filter((resource) => resource.parents().length == 0); |
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.
return this.resources().filter((resource) => resource.parents().length == 0); | |
return this.resources().filter((resource) => resource.parents().length != 0); |
Shouldn't this be values of non-zero length?
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.
ah ok, by "parent" are you referring to resources that have no parents? I'd argue that "root" resources are are a better way to describe that.
A parent is a specific relationship to other resources, it's a little confusing to use that in the context of "resources without a parent".
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.
Thanks! I think the code itself is correct, but I worry about the usage of the term "parent' here. Please see my comments.
Here's a PR on a proposal for defining the term "root resource" wdyt? aep-dev/aeps#273 |
Part of #26 #20
This PR adds the following: