Graphqlbundle: Unrecognized option "validation"

Created on 27 Jan 2020  路  4Comments  路  Source: overblog/GraphQLBundle

| Q | A
| ---------------- | -----
| Bug report? | no
| Feature request? | no
| BC Break report? | no
| RFC? | no
| Version/Branch | the latest

I'm trying to add simple validation in my type ItemBrand, but that throws an error saying Unrecognized option "validation" under "overblog_graphql_types.CreateItemBrandInput._input_object_config.fields.name". Available options are "defaultValue", "description", "type".

My ItemBrand.yaml type:

ItemBrand:
  type: object
  config:
    description: "An item brand"
    fields:
      id:
        type: "Int!"
        description: "The unique ID of the item brand."
      name:
        type: "String"
        description: "A name of an item brand"

ItemBrandQuery:
  type: object
  config:
      description: "ItemBrand ORM repository"
      fields:
        itemBrand:
          type: "ItemBrand"
          resolve: "@=resolver('ItemBrand', [args])"
          args:
            id:
              description: "Resolves using the item brand id"
              type: "Int"

ItemBrandMutation:
  type: object
  config:
    fields:
      createItemBrand:
        type: CreateItemBrandPayload!
        resolve: "@=mutation('create_item_brand', [args['input']['name']])"
        #validation:
        #  link: App\Entity\ItemBrand # targeting the class
        args:
          #using input object type is optional, we use it here to be iso with relay mutation example.
          input:
            type: CreateItemBrandInput!

# ItemBrand
CreateItemBrandPayload:
  type: object
  config:
    fields:
      # id:      
      #   description: "Resolves using the item brand id"
      #   type: "Int"
      itemBrand:
        type: ItemBrand

CreateItemBrandInput:
  type: input-object
  config:
    fields:
      name:
        type: "String!"
        validation:
         - NotBlank: ~
         - Length: { min: 6, max: 32 }

What am I doing wrong please?

Most helpful comment

Validation was added in 0.13.* you are using 0.12.* version. 0.13 requires Symfony 4.3 or higher.

All 4 comments

Can you provide the bundle and Symfony version you're using please? You can use composer info for more details.

Hey @mcg-web , thank you for your reply.
This is the whole my composer.json please:

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "doctrine/doctrine-bundle": "^1.11",
        "overblog/graphql-bundle": "^0.12.5",
        "sensio/framework-extra-bundle": "^5.3",
        "sonata-project/admin-bundle": "^3.48",
        "sonata-project/doctrine-orm-admin-bundle": "^3.9",
        "sonata-project/translation-bundle": "^2.4",
        "sonata-project/user-bundle": "^4.3",
        "symfony/asset": "4.2.*",
        "symfony/console": "4.2.*",
        "symfony/dotenv": "4.2.*",
        "symfony/flex": "^1.1",
        "symfony/framework-bundle": "4.2.*",
        "symfony/monolog-bundle": "^3.5",
        "symfony/orm-pack": "^1.0",
        "symfony/security-bundle": "4.2.*",
        "symfony/swiftmailer-bundle": "^3.2",
        "symfony/twig-bundle": "4.2.*",
        "symfony/webpack-encore-bundle": "^1.7",
        "symfony/yaml": "4.2.*"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.2.*"
        }
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^3.2",
        "overblog/graphiql-bundle": "^0.2.0",
        "symfony/browser-kit": "4.2.*",
        "symfony/css-selector": "4.2.*",
        "symfony/maker-bundle": "^1.11",
        "symfony/phpunit-bridge": "4.2.*",
        "symfony/profiler-pack": "^1.0",
        "symfony/web-server-bundle": "4.2.*"
    }
}

Validation was added in 0.13.* you are using 0.12.* version. 0.13 requires Symfony 4.3 or higher.

Thank you so much @mcg-web , I will do upgrade than.

Was this page helpful?
0 / 5 - 0 ratings