vinejs / vine

VineJS is a form data validation library for Node.js
https://vinejs.dev
MIT License
1.06k stars 21 forks source link

Question: How to make vine work with hyphenated column name #50

Open jasonejavier opened 5 months ago

jasonejavier commented 5 months ago

Package version

^2.0.0

Describe the bug

On our AdonisJS model we have a hyphenated column name like this

Screenshot 2024-05-06 at 8 18 00 AM

And we declare it in our consts file like this:

Screenshot 2024-05-06 at 8 19 03 AM

Vine declaration

Screenshot 2024-05-06 at 8 19 34 AM

We're using the vinejs for checking the body for the CREATE request and when we're passing "avs-address": "Sample Address",

it is giving us the error: SyntaxError: Missing initializer in const declaration

Can someone help with this? Thank you!

Reproduction repo

No response

joao-pedro-braz commented 4 months ago

Having the same issue, seems caused by a failure to compile the async function that validates the field

RomainLanz commented 4 months ago

Does that fix the issue when you convert the fields to camelCase?

https://vinejs.dev/docs/schema_101#converting-the-output-to-camelcase

thetutlage commented 4 months ago

Not sure I entirely get the issue. So it will be nice to have a reproduction of the same

RomainLanz commented 4 months ago

Not sure I entirely get the issue. So it will be nice to have a reproduction of the same

The code generated by Vine when using kebab-case field is invalid. The issue reside inside the compiler. Maybe we should normalize the casing of the field inside the generated code.

thetutlage commented 4 months ago

The code generated by Vine when using kebab-case field is invalid

That is what I am trying to figure out. What is invalid?