Custom validation of route parameters I have something like the following on my .routing.yml file:

my.path:
  path: '/my-path/{node}'
  defaults:
    _form: 'Drupal\mymodule\Form\MyForm'
  requirements:
    _entity_access: 'node.update'
    node: \d+


This works fine, it checks that the user has permissions to edit the node and all. Now, I want to restrict this route to work only for nodes of a certain content type. Ideally, something like this as the final line:

    node.bundle: 'article'   # this doesn't work, of course


How can I do this?
I could find three possible ways. Supposing your module name is example and content type to check is article.
1. Validating the argument in the form builder
It is the simplest way.
First define your route as usual:
example.routing.yml
 example.node.edit_form:
  path: /example/{node}/edit
  defaults:
    _form: 'Drupal\example\Form\ExampleNodeForm'
  options:
    _node_operation_route: TRUE
    parameters:
      node:
        type: entity:node
  requirements:
    _permission: 'edit any article content'

Then simply put these lines to Drupal\example\Form\ExampleNodeForm::buildForm before the other code.
if ($node-&gt;getType() != 'article') {
  throw new AccessDeniedHttpException();
}

2. Validate the argument using custom access callback
The route definition is the same as above except custom_access option under the requirements section.
example.routing.yml
 example.node.edit_form:
  path: /example/{node}/edit
  defaults:
    _form: 'Drupal\example\Form\ExampleNodeForm'
  options:
    _node_operation_route: TRUE
    parameters:
      node:
        type: entity:node
  requirements:
    _permission: 'edit any article content'
    _custom_access:  'Drupal\example\Form\ExampleNodeForm::access'

Drupal\example\Form\ExampleNodeForm::access() should return instance of Drupal\Core\Access\AccessResult. This can be done as follows.
return AccessResult::allowedIf($node-&gt;getType() == 'article');

3. Validation the argument with access checker
example.routing.yml
 example.node.edit_form:
  path: /example/{node}/edit
  defaults:
    _form: 'Drupal\example\Form\ExampleNodeForm'
  options:
    _node_operation_route: TRUE
    parameters:
      node:
        type: entity:node
  requirements:
    _permission: 'edit any article content'
    _content_type:  'article'

As you can see this includes _content_type requirement. To make it work you need to implement custom access check service.
example.services.yml
services:
  example.content_type_access_checker:
    class: Drupal\example\Access\ContentTypeAccessCheck
    tags:
      - { name: access_check, applies_to: _content_type }

Drupal\example\src\Access\ContentTypeAccessCheck.php
namespace Drupal\example\Access;

use Drupal\Core\Access\AccessResult;
use Drupal\Core\Routing\Access\AccessInterface;
use Drupal\node\NodeInterface;
use Symfony\Component\Routing\Route;

/**
 * Checks if node type matches the one provided in the route configuration.
 */
class ContentTypeAccessCheck implements AccessInterface {

  /**
   * Access callback.
   */
  public function access(Route $route, NodeInterface $node) {
    return AccessResult::allowedIf($node-&gt;getType() == $route-&gt;getRequirement('_content_type'));
  }
}

The last approach can be helpful if you want to reuse access control code accross multiple routes.
Documentation: https://www.drupal.org/docs/8/api/routing-system/access-checking-on-routes.