Skip to content

Unable to parse URL against the pattern when path params contain a hyphen #150

@benorgan

Description

@benorgan

In case anyone else has the same issue we just encountered. We were using hyphens in the path param names (e.g. {organisation-id}) which is valid OpenAPI 3.0 but messes up preg_match (apparently you can't have hyphens in field names: https://stackoverflow.com/a/62207383)

This results in an error like:

preg_match(): Compilation failed: syntax error in subpattern name (missing terminator)
Unable to parse "#/organisations/(?<organisation-id>[^/]+)#" against the pattern "/organisations/{organisation-id}"

This comes from the parseParams method in OperationAddress.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions