You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I install and use kirkbushell/eloquence's HasCamelCasing, this library still generates snake case TypeScript interfaces.
Because the models are serialized with camel case attributes, my interfaces don't reflect how the model actually looks and I either end up with failing type checks or runtime errors due to wrong field names.
I appreciate if first party support for integration isn't desirable - Would you be open to adding a setting for typescriptable.eloquent.printer_class then changing EloquentType.php:38 from
This will allow me to subclass \Kiwilan\Typescriptable\Typed\Eloquent\Printer\PrinterEloquentTypescript and hook in with my own printer where I can transform attribute names to camel case :) (Tested locally and working)
I'm unable to open a pull request, happy to fork, I'd prefer to contribute rather than fork if possible.
How to reproduce the bug
Install this package
Install kirbushell/eloquence
Make a model with some snake case fields in the DB
Use the HasCamelCasing trait on one of your models
Run artisan typescriptable
Observe that the generated interfaces have the snake case names
Package Version
3.1.05
PHP Version
8.4
Which operating systems does with happen with?
Linux
Notes
No response
The text was updated successfully, but these errors were encountered:
What happened?
When I install and use
kirkbushell/eloquence
'sHasCamelCasing
, this library still generates snake case TypeScript interfaces.Because the models are serialized with camel case attributes, my interfaces don't reflect how the model actually looks and I either end up with failing type checks or runtime errors due to wrong field names.
I appreciate if first party support for integration isn't desirable - Would you be open to adding a setting for
typescriptable.eloquent.printer_class
then changingEloquentType.php:38
from$type->typescript = PrinterEloquentTypescript::make($type->app()->models());
to
$type->typescript = ($type->config()->printerClass)::make($type->app()->models());
This will allow me to subclass
\Kiwilan\Typescriptable\Typed\Eloquent\Printer\PrinterEloquentTypescript
and hook in with my own printer where I can transform attribute names to camel case :) (Tested locally and working)I'm unable to open a pull request, happy to fork, I'd prefer to contribute rather than fork if possible.
How to reproduce the bug
kirbushell/eloquence
HasCamelCasing
trait on one of your modelsartisan typescriptable
Package Version
3.1.05
PHP Version
8.4
Which operating systems does with happen with?
Linux
Notes
No response
The text was updated successfully, but these errors were encountered: