Skip to content

Commit

Permalink
fix(core/transform): fixes normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Oct 15, 2019
1 parent 7314761 commit 039a929
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/core/src/transform/normalize/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ export function normalize<T extends CollectionTree>(
const name = transform(route[route.length - 1], true);

if (isElementType(element)) {
if (!name) {
throw Error(`Empty strings are not permitted as type names`);
}
if (/[^\w]/.exec(name)) {
throw Error(
`Non word characters are not permitted for type names: ${name}`
);
}

if (element.kind !== 'response' || !element.children) {
return element;
}
Expand Down

0 comments on commit 039a929

Please sign in to comment.