docs: fixes for core workflows reference (#11056)

* docs: fix step input / output description not showing

* fix generated example for array types

* show workflow summary in diagram

* fix workflow node width

* hide undefined types
This commit is contained in:
Shahed Nasser authored and GitHub committed 2025-01-20 17:34:02 +02:00
1 parent af350c3a8b
commit 0d18d5854a
484 files changed
+1172 -1128

No files matched your search

@@ -25,6 +25,7 @@ export default function (theme: MarkdownTheme) {
project: this.project || options.data.theme.project,
maxLevel,
wrapObject: true,
isReturn: false,
})
if (!input.length) {
@@ -25,6 +25,7 @@ export default function (theme: MarkdownTheme) {
project: this.project || options.data.theme.project,
maxLevel,
wrapObject: true,
isReturn: false,
})
if (!output.length) {
@@ -98,11 +98,16 @@ function getStep({
(theme.project ? getProjectChild(theme.project, document.name) : undefined)
const depth = getDocumentTagValue(document, `@workflowDepth`) || `${index}`
const summary =
associatedReflection?.comment?.blockTags.find(
(tag) => tag.tag === `@summary`
)?.content || associatedReflection?.comment?.summary
return {
type,
name: document.name,
description: associatedReflection?.comment?.summary
? Handlebars.helpers.comment(associatedReflection.comment.summary)
description: summary
? Handlebars.helpers.comment(summary)
: associatedReflection?.comment
? Handlebars.helpers.comments(associatedReflection.comment, true)
: "",
@@ -98,7 +98,7 @@ export function getReflectionTypeParameters({
: undefined
if (
typeArgs &&
!isOnlyVoid(typeArgs as unknown as SomeType[]) &&
!isEmpty(typeArgs as unknown as SomeType[]) &&
canRetrieveChildren
) {
typeArgs.forEach((typeArg) => {
@@ -237,6 +237,8 @@ export function getReflectionTypeParameters({
? componentItem[parentKey - 1].children?.push(childParameter)
: componentItem.push(childParameter)
})
} else if (isEmpty([reflectionType])) {
return []
} else {
const parentKey = wrapObject
? componentItem.push(formatParameter())
@@ -278,8 +280,12 @@ export function loadComment(
return ""
}
export function isOnlyVoid(reflectionTypes: SomeType[]) {
export function isEmpty(reflectionTypes: SomeType[]) {
return reflectionTypes.every(
(type) => type.type === "intrinsic" && type.name === "void"
(type) =>
type.type === "intrinsic" &&
(type.name === "void" ||
type.name === "never" ||
type.name === "undefined")
)
}
@@ -130,6 +130,15 @@ function getReflectionTypeFakeValue({
})
}
}
// try to retrieve the type from the reflection
if (reflectionType.reflection.type) {
return getReflectionTypeFakeValue({
reflectionType: reflectionType.reflection.type,
name,
level: level + 1,
})
}
}
children.forEach((child) => {