When attempting to create a view that upcasts a parameter, you get an error when entering anything other than a simple key: value string in the "Options" section of the route. This appears to be the most common purpose of this module -- the example in the README shows a YAML string, but in recent versions of Drupal core, these settings are validated against the schema, and fail.

I get this exception:

InvalidArgumentException: The configuration property display.page_1.display_options.display_extenders.views_advanced_routing_route.route.options.parameters.commerce_product doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php).

... when entering this option yaml:

parameters:
  commerce_product:
    type: 'entity:commerce_product'
CommentFileSizeAuthor
#2 views_advanced_routing-3102832-2.patch555 bytesfreelock

Comments

freelock created an issue. See original summary.

freelock’s picture

StatusFileSize
new555 bytes

I'm not at all sure what the best approach is to creating a schema for arbitrary configs imported like this -- perhaps we should make use of "type: ignore"?

Without doing that, the attached patch appears to work in Drupal 8.8.1, at least to allow saving parameter upcasting options (and also appears to not break simple string options).

freelock’s picture

Status: Active » Needs review

(forgot to update status)...

andypost’s picture

Confirm this bug, patch helps to save the view but config_inspector still complains

For example no_cache: 'TRUE' option

display.page_1.display_options.display_extenders.views_advanced_routing_route.route.options.no_cache
 	Sequence
 	sequence
 	TRUE
 	variable type is string but applied schema class is Drupal\Core\Config\Schema\Sequence
andypost’s picture

As there's no way to predict allowed options the `type: ignore` could be solution

\Drupal\views_advanced_routing\Plugin\views\display_extender\AdvancedRouting::validateOptionsForm() also could extend validation to prevent WSOD

dpi credited heddn.

dpi’s picture

Collecting credits from schema issues 1 2

dpi’s picture

Version: 8.x-1.0 » 2.x-dev

  • dpi committed ff53517 on 2.x authored by freelock
    Issue #3102832 by freelock, heddn: Cannot create a parameter upcasting...
dpi’s picture

Status: Needs review » Fixed

As suggested by #2, the ignore type seems to work fine for this purpose.

Committed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.