-
Notifications
You must be signed in to change notification settings - Fork 80
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
Ben/multi org #107
Ben/multi org #107
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 8c05da2:
|
324b7e1
to
1ee5406
Compare
cwd: openapiPath, | ||
ignore: GlobExcludeDefault, | ||
}) | ||
).filter((x) => !x.includes("_category_")); // todo: regex exclude? |
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 think _category_
should be excluded by GlobExcludeDefault
above, which excludes anything that starts with an underscore?
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.
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 yea looks like it doesn't ignore json files with _
// Ignore files starting with _
'**/_*.{js,jsx,ts,tsx,md,mdx}',
// Ignore folders starting with _ (including folder content)
'**/_*/**',
// Ignore tests
'**/*.test.{js,jsx,ts,tsx}',
'**/__tests__/**',
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.
maybe try something like this then:
[...GlobExcludeDefault, '**/_*.{json,yaml,yml}']
Can we rename |
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.
Looking good, I still need to look over the category tree stuff
source: prototype?.source, | ||
sourceDirName: prototype?.sourceDirName ?? ".", |
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 makes me a little uncomfortable having the existence of source being tied to the existence of api.info
. Maybe we should just use items[0].source
and items[0].sourceDirName
? However, with hardcoding zero index we have to think if there is ever a case were items
is an empty array? Maybe an empty directory, or spec that wouldn't generate any pages, etc... We should probably have a case that skips creating the category/subitems if we don't have the right info
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.
If there is ever a case were items is an empty array?
I don't think so but can mull on it.
The current implementation (for all of multi-spec) relies on the folder structure being generated from OpenAPI Specs (& these lines are only hit if there are > 1 spec files).
Arbitrary markdown files aren't supported. Introductions are automatically generated from the info.description
field so in all cases a section is only created for an openapi spec. Here we're ignoring the auto-generated markdown file from being used to select the sidebar label after being grouped by source.
The fn input items[] is a flattened array of ["auto-generated markdown for spec a", "openapi path for spec a"]. The .find fn is getting not the zero index, but the first element in the group which is non-markdown & has the openapi spec info. If falsy, defaults to filename.
7754c84
to
ee39469
Compare
…itle else filename
…itle else filename
Co-authored-by: Nick Bourdakos <bourdakos1@gmail.com>
b2b910f
to
fe03340
Compare
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.
Looks good! We can investigate potential issues with an empty array of pages later
Add recursive folder structure reading & labeling support.
#82