Skip to content

Commit 41e3e3f

Browse files
committed
feat(code-gen): add expected patterns to docs if no docs exist on T.uuid(), T.date().{timeOnly,dateOnly}()
1 parent 9744e6c commit 41e3e3f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/code-gen/src/processors/doc-string.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ export function docStringCleanup(generateContext) {
2020

2121
type.docString = normalizeIndentationAndTrim(src);
2222

23+
if (type.docString.trim().length === 0) {
24+
// Add default patterns to the doc string.
25+
if (type.type === "date") {
26+
if (type.specifier === "dateOnly") {
27+
type.docString = `Expected pattern: yyyy-MM-dd`;
28+
} else if (type.specifier === "timeOnly") {
29+
type.docString = `Expected pattern: HH:mm(:ss(.SSS))`;
30+
}
31+
} else if (type.type === "uuid") {
32+
type.docString += `Expected pattern: UUID (v4)`;
33+
}
34+
}
35+
2336
callback(type);
2437
}
2538
},

0 commit comments

Comments
 (0)