Skip to content

Commit 21ac133

Browse files
committed
fixes and improvements
1 parent d736b70 commit 21ac133

6 files changed

Lines changed: 201 additions & 163 deletions

File tree

www/utils/packages/docs-generator/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"commander": "^11.1.0",
2525
"dotenv": "^16.3.1",
2626
"eslint": "8.56.0",
27+
"fdir": "^6.5.0",
2728
"glob": "^11.0.2",
2829
"minimatch": "^9.0.3",
2930
"openai": "^4.29.1",

www/utils/packages/docs-generator/src/classes/helpers/oas-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ class OasSchemaHelper {
364364
.replace("DTO", "")
365365
.replace(this.schemaRefPrefix, "")
366366
.replace(
367-
/(?<!(AdminProduct|CreateProduct|UpdateProduct|StoreShippingOption|AdminShippingOption|CreateShippingOption|BaseProduct|StoreProduct))Type$/,
367+
/(?<!(AdminProduct|CreateProduct|UpdateProduct|StoreShippingOption|AdminShippingOption|CreateShippingOption|BaseProduct|StoreProduct|AdminCreateShippingOption|AdminUpdateShippingOption))Type$/,
368368
""
369369
)
370370
}

www/utils/packages/docs-generator/src/classes/kinds/default.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class DefaultKindGenerator<T extends ts.Node = ts.Node> {
8888
* @returns {boolean} Whether this generator can be used with the specified node.
8989
*/
9090
isAllowed(node: ts.Node): node is T {
91-
return this.allowedKinds.includes(node.kind)
91+
return !this.isIgnored(node) && this.allowedKinds.includes(node.kind)
9292
}
9393

9494
/**
@@ -638,6 +638,18 @@ class DefaultKindGenerator<T extends ts.Node = ts.Node> {
638638
featureFlagTag,
639639
}
640640
}
641+
642+
/**
643+
* Check if a node is ignored.
644+
*
645+
* @param node - The node to check.
646+
* @returns Whether the node is ignored.
647+
*/
648+
isIgnored(node: ts.Node): boolean {
649+
return ts
650+
.getJSDocTags(node)
651+
.some((tag) => tag.tagName.getText() === "ignore")
652+
}
641653
}
642654

643655
export default DefaultKindGenerator

www/utils/packages/docs-generator/src/classes/kinds/oas.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ class OasKindGenerator extends FunctionKindGenerator {
203203
return false
204204
}
205205

206+
if (this.isIgnored(functionNode)) {
207+
return false
208+
}
209+
206210
const hasCorrectRequestType = this.REQUEST_TYPE_NAMES.some(
207211
(name) => functionNode.parameters[0].type?.getText().startsWith(name)
208212
)
@@ -2653,9 +2657,16 @@ class OasKindGenerator extends FunctionKindGenerator {
26532657
if (
26542658
fnText.includes(`${workflowName}(`) ||
26552659
fnText.includes(`${workflowName} (`) ||
2656-
fnText.includes(`${workflowName}.`)
2660+
fnText.includes(`${workflowName}.`) ||
2661+
fnText.includes(`we.run(${workflowName}`) ||
2662+
fnText.includes(`we.run (${workflowName}`) ||
2663+
fnText.includes(`we.run(
2664+
${workflowName}
2665+
)`)
26572666
) {
2658-
workflow = workflowName
2667+
// workaround for API routes that execute a workflow
2668+
// by its ID. Not very smart but will do for now.
2669+
workflow = workflowName.replace(/Id$/, "")
26592670
}
26602671
})
26612672
})

0 commit comments

Comments
 (0)