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

Validation issues with object that have dots in the object keys #82

Closed
kaldray opened this issue Nov 25, 2024 · 2 comments
Closed

Validation issues with object that have dots in the object keys #82

kaldray opened this issue Nov 25, 2024 · 2 comments

Comments

@kaldray
Copy link

kaldray commented Nov 25, 2024

Package version

2.1.0

Describe the bug

When I try to validate a payload that have dot on the object key, the vine compiler reports an issue. Like this :

{
  'hub.mode': "string",
  'hub.challenge': "string",
  'hub.verify_token': "string",
}

First I tried :

const verificationRequestSchema = vine.object({
  'hub.mode': vine.literal('subscribe'),
  'hub.challenge': vine.number(),
  'hub.verify_token': vine.literal('env'),
})

It gave me a compiler error.

As a workaround, I tried to do this :

const verificationRequestSchema = vine.object({
  hub: vine.object({
    mode: vine.literal('subscribe'),
    challenge: vine.number(),
    verify_token: vine.literal("value"),
  })
})

But it didn't work, it redirects me to base path instead and no error.

To reproduce the bug, you have to visit after starting the project : bug reproduction

You can find a link to the issue on the Discord here : Discord discussion

Reproduction repo

https://github.com/kaldray/vine-dot-values

@thetutlage
Copy link
Contributor

How does the data object look at your end that you expect to pass the validation?

@kaldray
Copy link
Author

kaldray commented Nov 27, 2024

If I follow the parameters passed on the reproduction link, it should be like :

{
  "hub.mode":"subscribe",
  "hub.challenge":1158201444,
  "hub.verify_token":"meatyhamhock"
}

thetutlage added a commit that referenced this issue Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants