Skip to content

Commit

Permalink
fix: enforce lowercase optional, no 'Optional' allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Jun 4, 2019
1 parent 25e2a09 commit 3bb5f99
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/markdown-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,11 @@ const convertNestedListToTypedKeys = (list: List): TypedKey[] => {
'optionality for a typed key should be defined before the "-" and after the type',
);

const isRootOptional = / ?\(optional\) ?/i.test(rawType);
const isRootOptional = / ?\(optional\) ?/.test(rawType);
expect(rawType).not.to.match(
/ ?\(Optional\) ?/,
'optionality should be defined with "(optional)", all lower case, no capital "O"',
);
const cleanedType = rawType.replace(/ ?\(optional\) ?/i, '').replace(/_.+?_/g, '');
const subTypedKeys = item.nestedList ? convertNestedListToTypedKeys(item.nestedList) : null;
const type = rawTypeToTypeInformation(cleanedType.trim(), rawDescription, subTypedKeys);
Expand Down

0 comments on commit 3bb5f99

Please sign in to comment.