Skip to content

Commit

Permalink
feat(code-gen): add expected patterns to docs if no docs exist on `T.…
Browse files Browse the repository at this point in the history
…uuid()`, `T.date().{timeOnly,dateOnly}()`
  • Loading branch information
dirkdev98 committed May 14, 2023
1 parent 9744e6c commit 41e3e3f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/code-gen/src/processors/doc-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ export function docStringCleanup(generateContext) {

type.docString = normalizeIndentationAndTrim(src);

if (type.docString.trim().length === 0) {
// Add default patterns to the doc string.
if (type.type === "date") {
if (type.specifier === "dateOnly") {
type.docString = `Expected pattern: yyyy-MM-dd`;
} else if (type.specifier === "timeOnly") {
type.docString = `Expected pattern: HH:mm(:ss(.SSS))`;
}
} else if (type.type === "uuid") {
type.docString += `Expected pattern: UUID (v4)`;
}
}

callback(type);
}
},
Expand Down

0 comments on commit 41e3e3f

Please sign in to comment.