Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[legacy-framework] show an error if model name is invalid in blitz generate #2802

Merged
merged 10 commits into from
Oct 11, 2021
3 changes: 3 additions & 0 deletions packages/cli/src/commands/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ export class Generate extends Command {
`Names ${RESERVED_MODEL_NAMES} or their plurals cannot be used as model names`,
)
}
if (!/^[A-Za-z][A-Za-z0-9_]*$/.test(modelName)) {
throw new Error(`Model name cannot contain any special characters`)
martinsaxa marked this conversation as resolved.
Show resolved Hide resolved
}
}

async run() {
Expand Down