Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reference path with dash doesn't validate #17

Open
rgarcia opened this issue Feb 22, 2018 · 1 comment
Open

reference path with dash doesn't validate #17

rgarcia opened this issue Feb 22, 2018 · 1 comment
Labels

Comments

@rgarcia
Copy link

rgarcia commented Feb 22, 2018

Both of these state machines I can create and run in the AWS console w/o error:

{
    "Version": "1.0",
    "StartAt": "start",
    "States": {
        "start": {
            "Type": "Pass",
            "ResultPath": "$.foo",
            "Result": "bar",
            "End": true
        }
    }
}
{
    "Version": "1.0",
    "StartAt": "start",
    "States": {
        "start": {
            "Type": "Pass",
            "ResultPath": "$.foo-result",
            "Result": "bar",
            "End": true
        }
    }
}

However, the second one fails statelint validation with this error:

One error:
 State Machine.States.start.ResultPath is "$.foo-result" but should be a Reference Path

I'm not familiar with Reference Paths, so I'm not sure if this is the AWS console accepting something it shouldn't or statelint improperly rejecting something.

@timbray
Copy link
Contributor

timbray commented Feb 23, 2018

This one is complicated. Part of the problem is that there's no actual official specification for JSONPath. Statelint takes the approach that you can say $.X.Y if X and Y meet the ECMAScript grammar for "name", which "foo-result" doesn't, so statelint wants you to say $["foo-result"]. The AWS Service uses the Jayway JSONPath library, which is OK with foo-result.

I find the Jayway behavior irritating because it means that $.foo-bar is a synonym of $.["foo-bar"] but $.foo.bar isn't a synonym of $.["foo.bar"], so I like ruling out $.foo-bar.

But maybe we should make statelint act like Jayway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants