chore: improve JS Client TSDoc comments (#5582)
* add oas schema to tsdoc parser * add tsdoc (part 1) * Finished tsdoc in js client * general fixes * added tsdoc in core medusa package * parse schema tags in model files * added maxlevel option * added more tsdoc * added tsdoc in core * added TSDoc in core package * generated client types * support featureFlag and expandable tags * added support for resource feature flag note * fix api ignore plugin * added eslint plugin * support feature flag and expandable badges * adjusted overview page + generated reference * revert generated files * added changeset * add details about new typedoc options * fix broken link
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import {
|
||||
DeclarationReflection,
|
||||
ProjectReflection,
|
||||
ReflectionKind,
|
||||
} from "typedoc"
|
||||
|
||||
export function getProjectChild(
|
||||
project: ProjectReflection,
|
||||
childName: string
|
||||
): DeclarationReflection | undefined {
|
||||
let reflection: DeclarationReflection | undefined = project.getChildByName(
|
||||
childName
|
||||
) as DeclarationReflection
|
||||
const splitChildName = childName.split(".")
|
||||
|
||||
if (!reflection && splitChildName.length > 1) {
|
||||
reflection = getProjectChild(
|
||||
project,
|
||||
splitChildName[splitChildName.length - 1]
|
||||
)
|
||||
}
|
||||
|
||||
if (
|
||||
!reflection &&
|
||||
project.parent &&
|
||||
project.parent instanceof ProjectReflection
|
||||
) {
|
||||
reflection = getProjectChild(project.parent, childName)
|
||||
}
|
||||
|
||||
if (!reflection) {
|
||||
const modules = project.getChildrenByKind(ReflectionKind.Module)
|
||||
for (const module of modules) {
|
||||
reflection = module.getChildByName(childName) as DeclarationReflection
|
||||
|
||||
if (reflection) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return reflection
|
||||
}
|
||||
Reference in New Issue
Block a user