Blitz generate should provide functioning forms for a better scaffolding experience.
- Dominant language
- TypeScript
- Stars
- 14.1k
- Forks
- 803
- PR merge metrics
- No merged PRs in 30d
Description
### What do you want and why?
There are some bugs here as well but I feel the generate command needs some attention. At the moment `blitz generate all` will only provide forms with a LabeledTextField component that works with the string, uuid, json?, and datetime types.
When creating a new app and using the generate command to scaffold an idea, it would be great to have a functioning app without modifying any code.
Without any modifications after generating, the following errors occur:
- With int, number, bigint, float, decimal, the form says: `Expected number, received string`.
- WIth boolean, the form says: `Expected boolean, received string`.
- With belongsTo:model, the page fails to compile with error `Module not found: Can't resolve 'src/core/components/LabelSelectField'`. And an additional error since v2.0.2, in the usePaginatedQuery it uses a get query but uses the /src/model/ directory instead of the new /src/app/model/ directory.
- With datetime, it works with the string type if a full ISO 8601 datetime is used. However, this only works after modifying the CreateSchema as there is an extra function call and produces the error `TypeError: zod__WEBPACK_IMPORTED_MODULE_0__.z.string(...).datetime(...) is not a function`
### Possible implementation(s)
I'm suggesting a better defaultCodegenConfig with more starter components. This could include:
- working number input
- date picker for datetime
- simple checkbox input for boolean
- select with options for selecting a parent model
- cloned form for creating a child while creating a parent
Contributor guide
Assessment
This issue has not been assessed yet.