Skip to content

docs: document naming convention and YAML usage for custom route predicates#4204

Open
won-seoop wants to merge 1 commit into
spring-cloud:mainfrom
won-seoop:doc-3463-custom-predicate-naming-convention
Open

docs: document naming convention and YAML usage for custom route predicates#4204
won-seoop wants to merge 1 commit into
spring-cloud:mainfrom
won-seoop:doc-3463-custom-predicate-naming-convention

Conversation

@won-seoop

Copy link
Copy Markdown
Contributor

Summary

Closes #3463

The Developer Guide explained how to write a custom RoutePredicateFactory and how to reference custom GatewayFilters in YAML configuration, but there was no equivalent guidance for custom predicates. Users were left guessing whether the same naming convention applied.

Added a [[naming-custom-predicates-and-references-in-configuration]] subsection immediately after the custom predicate class example that mirrors the existing filter naming section:

  • Documents the RoutePredicateFactory suffix naming convention (strips RoutePredicateFactory → predicate name used in config)
  • Shows both shortcut (- My=argument) and fully-expanded (name: My, args: ...) YAML forms
  • Notes that shortcutFieldOrder() must be overridden for the shortcut form to work
  • Adds a WARNING about non-standard names (no suffix), consistent with the existing filter warning

Test plan

  • Docs build with Antora renders without errors
  • YAML examples are syntactically valid
  • Section placement logically follows the predicate factory class example

…icates (spring-cloudGH-3463)

The Developer Guide showed how to write a custom RoutePredicateFactory and how to
reference custom GatewayFilters in configuration, but had no equivalent guidance
for predicates. Added a "Naming Custom Predicates And References In Configuration"
section right after the custom predicate class example, covering:

- The RoutePredicateFactory suffix naming convention
- Shortcut and fully-expanded YAML configuration examples
- A WARNING about unsupported non-standard naming

Closes spring-cloudgh-3463

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

The predicate factory must override `shortcutFieldOrder()` to define the order of shortcut arguments and `Config` fields must match the keys used in the `args` map.

WARNING: It is possible to create a predicate named without the `RoutePredicateFactory` suffix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not even mention this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ambiguity in section 19 of the documentation - Spring Cloud Gateway - Custom Route Predicate

3 participants