Skip to content

Form validation rules for Asset fieldtypes show incorrectly in GraphQL #7986

Open
@notnek

Description

@notnek

Bug description

If you add one of these validation rules to an Asset Fieldtype in a Form, the GraphQL response for that field's validation rules is an empty object instead of the original rule:

  • dimensions
  • image
  • max_filesize:foo
  • mimes:foo,bar
  • mimetypes:foo,bar
  • min_filesize:foo

How to reproduce

Blueprint

sections:
  main:
    display: Main
    fields:
      -
        handle: asset_field
        field:
          mode: list
          container: assets
          restrict: false
          allow_uploads: true
          show_filename: true
          display: 'Asset Field'
          type: assets
          icon: assets
          listable: hidden
          instructions_position: above
          visibility: visible
          validate:
            - 'mimetypes:application/pdf'

GraphQL Query

{
  form(handle: "asset_form_example") {
    rules
  }
}

GraphQL Response

{
  "data": {
    "form": {
      "rules": {
        "asset_field": [
          {},
          "array",
          "nullable"
        ]
      }
    }
  }
}

Logs

No response

Environment

Environment
Application Name: Sample Site
Laravel Version: 9.48.0
PHP Version: 8.1.8
Composer Version: 2.3.5
Environment: local
Debug Mode: ENABLED
URL: sample-site.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED

Drivers
Broadcasting: null
Cache: redis
Database: mysql
Logs: stack / daily,
Mail: log
Queue: redis
Session: file

Statamic
Addons: 0
Antlers: runtime
Stache Watcher: Disabled
Static Caching: Disabled
Version: 3.4.5 PRO

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

None

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions