Skip to content

Bug: regex fails to detect JSONPath refs with brackets or quotes #42

@adamsubf

Description

@adamsubf

The current logic for finding !ref(...) expressions:
for (const match of input.matchAll(/\!ref\((\$.[\w\.]+)\)/g)) {

doesn’t correctly detect all valid JSONPath references especially those that use bracket notation or quoted keys eg

Example that doesn’t work:
test !ref($.state['testkeyhere'].result.url)

Proposed fix
for (const match of input.matchAll(/\!ref\((\$.[\w\.\[\]'"@?!=()_\-]+)\)/g)) {

This version supports [ ] ' characters used in JSONPath

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions