Skip to content

Document and discuss route-path-to-function-name rename mapping #258

Open
@kadamwhite

Description

@kadamwhite

As noted in #257 by @gambry, we make some pretty broad assumptions about how to map route identifiers and post type names into setter names—converting for example (?P<revision_id>[\d]+) into a camel-cased setter method .revisionId(). #257 adds support to map kebab-case identifiers into the same camelCasing, but @gambry notes

Ideally the exact regexp should be [^a-z]+, in order to cover any future changes and plugins creating weird endpoints.

This issue is a placeholder for discussion of whether the regex should be changed for broader future compatibility, although the current regexp should account for all valid CPT identifiers and for the names in PCRE named capture groups. (Note that we would need [^a-z0-9], as both identifiers support alphanumeric strings, not just alphabetical strings).

However this remapping can be considered slightly "magical", so this issue can also serve to discuss whether this behavior is still desirable, or if there are better ways to enable consumers of the library to map values in a more powerful way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions