docs-util: support models implemented with DML in typedoc custom plugins (#7847)
- Support generating reference for models implemented with DML - Support resolving and generating mermaid diagram for relations The Currency Module was used an example so its reference is generated to showcase the work of this PR.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { DeclarationReflection, ReferenceType, ReflectionType } from "typedoc"
|
||||
|
||||
export function isDmlEntity(reflection: DeclarationReflection) {
|
||||
if (reflection.type?.type !== "reference") {
|
||||
return false
|
||||
}
|
||||
|
||||
return reflection.type.name === "DmlEntity"
|
||||
}
|
||||
|
||||
export function getDmlProperties(
|
||||
reflectionType: ReferenceType
|
||||
): DeclarationReflection[] {
|
||||
if (
|
||||
!reflectionType.typeArguments?.length ||
|
||||
reflectionType.typeArguments[0].type !== "intersection"
|
||||
) {
|
||||
return []
|
||||
}
|
||||
|
||||
const schemaType = reflectionType.typeArguments[0].types[0] as ReflectionType
|
||||
|
||||
return schemaType.declaration.children || []
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from "./dml-utils"
|
||||
export * from "./get-type-children"
|
||||
export * from "./get-project-child"
|
||||
export * from "./get-type-str"
|
||||
|
||||
Reference in New Issue
Block a user