docs: resolve example tag in DML properties (#14383)
This commit is contained in:
@@ -607,12 +607,14 @@ class DefaultKindGenerator<T extends ts.Node = ts.Node> {
|
||||
sinceTag: ts.JSDocTag | undefined
|
||||
featureFlagTag: ts.JSDocTag | undefined
|
||||
summary: string | undefined
|
||||
example: ts.JSDocTag | undefined
|
||||
} {
|
||||
const nodeComments = ts.getJSDocCommentsAndTags(node)
|
||||
let deprecatedTag: ts.JSDocTag | undefined
|
||||
let sinceTag: ts.JSDocTag | undefined
|
||||
let featureFlagTag: ts.JSDocTag | undefined
|
||||
let summary: string | undefined
|
||||
let example: ts.JSDocTag | undefined
|
||||
|
||||
nodeComments.forEach((comment) => {
|
||||
if (!("tags" in comment)) {
|
||||
@@ -637,6 +639,10 @@ class DefaultKindGenerator<T extends ts.Node = ts.Node> {
|
||||
if (tag.tagName.getText() === "featureFlag") {
|
||||
featureFlagTag = tag
|
||||
}
|
||||
|
||||
if (tag.tagName.getText() === "example") {
|
||||
example = tag
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -645,6 +651,7 @@ class DefaultKindGenerator<T extends ts.Node = ts.Node> {
|
||||
sinceTag,
|
||||
featureFlagTag,
|
||||
summary,
|
||||
example,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ class DmlKindGenerator extends DefaultKindGenerator<ts.CallExpression> {
|
||||
)
|
||||
const isBoolean = propertyTypeStr.includes("BooleanProperty")
|
||||
const relationName = isRelation ? camelToWords(propertyName) : undefined
|
||||
const { summary, sinceTag, deprecatedTag, featureFlagTag } =
|
||||
const { summary, sinceTag, deprecatedTag, featureFlagTag, example } =
|
||||
this.getInformationFromTags(propertyNode)
|
||||
|
||||
let propertyDescription =
|
||||
@@ -286,6 +286,12 @@ class DmlKindGenerator extends DefaultKindGenerator<ts.CallExpression> {
|
||||
}`
|
||||
}
|
||||
|
||||
if (example) {
|
||||
propertyDescription += `\n\n@example ${
|
||||
this.formatJSDocTag(example) ?? ""
|
||||
}`
|
||||
}
|
||||
|
||||
properties[propertyName] = propertyDescription
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user