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

Multi level Input-object validation issue #1168

Open
morkers opened this issue Mar 25, 2024 · 1 comment
Open

Multi level Input-object validation issue #1168

morkers opened this issue Mar 25, 2024 · 1 comment

Comments

@morkers
Copy link

morkers commented Mar 25, 2024

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Version/Branch 0.13.7

There seems to be an issue validating array of input-objects.

Having a simple mutation:

Mutation:
    type: object
    config:
        fields:
            testMutation:
                type: Boolean
                resolve: "@=mutation('testMutation', [args])"
                args:
                    fields:
                        type: '[TestInput]'
                        validation: cascade
TestInput:
    type: input-object
    config:
        fields:
            subField:
                type: SubTestInput
                validation: cascade

SubTestInput:
    type: input-object
    config:
        fields:
            price:
                type: Float
                validation:
                    -  Positive: ~

Then sending mutation i don't get the error i expect. The first SubTestInput is not validated.

mutation{
    testMutation(fields: [
        {
            subField: {
                price: -1
            }
        },
        {
        }
    ])
}

As the second/last TestInput does not have SubTestInput defined, validation metadata is overriden with metadata that doesn't have any constraints registered and validation for first SubTestInput is not done.

@Vincz
Copy link
Collaborator

Vincz commented Mar 30, 2024

I'm not familiar with the validator component. Maybe @murtukov can look into it?

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