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

Validators - wrong nested properties types #119

Open
Ovoda opened this issue Aug 16, 2024 · 0 comments
Open

Validators - wrong nested properties types #119

Ovoda opened this issue Aug 16, 2024 · 0 comments

Comments

@Ovoda
Copy link

Ovoda commented Aug 16, 2024

Hello,

It looks like the types generated from a deeply nested validator are wrong.

Let me know if you need more information. I'm down to help, not sure how tho.

version 3.61.0
used with @requestBody <labelCreateValidator>

Example:

export const labelCreateValidator = vine.compile(
  vine.object({
    // level 1
    string1: vine.string(),
    object1: vine.object({
      // level 2
      string2: vine.string(),
      object2: vine.object({
        // level 3
        string3: vine.string(),
        object3: vine.object({
          // level 4
          string4: vine.string(),
        }),
      }),
    }),
  })
)
labelCreateValidator:
  type: "object"
  properties:
    string1:
      type: "string"
      example: "Lorem Ipsum"
      required: true
    object1:
      type: "object"
      properties:
        string2:
          type: "string"
          example: "Lorem Ipsum"
          required: true
        object2:
          type: "object"
          properties:
            string3:
              type: "number" # <- wrong type here
              example: 964
              required: true
            object3:
              type: "object"
              properties:
                string4:
                  type: "number" # <- wrong type here
                  example: 109
                  required: true
              required: true
          required: true
         # Not sure why they appear here again, with the right types
          string3:
            type: "string"
            example: "Lorem Ipsum"
          object3:
            string4:
              type: "string"
              example: "Lorem Ipsum"
@Ovoda Ovoda changed the title Validators - nested properties only generates numbers Validators - wrong nested properties types Aug 16, 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

1 participant