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

Sidebar should only show parent resources #27

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rambleraptor
Copy link
Member

@rambleraptor rambleraptor commented Jan 20, 2025

Part of #26 #20

This PR adds the following:

  • Sidebar filters out resources that have parents
  • Does some reorganization
  • Creates a test for the resource sidebar list


parents(): string[] {
const resource = this.schema["x-aep-resource"]
if ('parents' in resource) {
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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?

Copy link
Member

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".

Copy link
Member

@toumorokoshi toumorokoshi left a 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.

@toumorokoshi
Copy link
Member

Here's a PR on a proposal for defining the term "root resource" wdyt? aep-dev/aeps#273

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.

2 participants