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

Attempting to create overlapping URIs results in a parse error #1077

Open
akumria opened this issue Aug 23, 2021 · 0 comments
Open

Attempting to create overlapping URIs results in a parse error #1077

akumria opened this issue Aug 23, 2021 · 0 comments
Labels

Comments

@akumria
Copy link

akumria commented Aug 23, 2021

Description

I am attempting to create three endpoints, one of which redirect to the other. sysl validate returns an error.

Steps to Reproduce

Initial example:

ReportAPI:
    /api/report:
        GET:
            ...

    /api/report/:
	| Redirects to /api/report
        return 301

    /api/report/{id <: int}:
        GET:
            ...

results in:

$ sysl validate -v restfulapi.sysl
DEBU[0000] Logging: {loglevel:debug verbose:true}
DEBU[0000] Attempting to load module:restfulapi.sysl (root:)
DEBU[0000] Parsing: restfulapi.sysl
line 6:16 mismatched input ':' expecting {CURLY_OPEN, DIGITS, TEXT_LINE, Name, E_Name}
INFO[0000] SyntaxError: Token: COLON
line 7:1 mismatched input '|' expecting INDENT
INFO[0000] SyntaxError: Token: PIPE
line 10:4 extraneous input '/' expecting {<EOF>, SYSL_COMMENT, TEXT_LINE, Name, E_Name}
INFO[0000] SyntaxError: Token: FORWARD_SLASH
line 10:8 mismatched input '/' expecting COLON
INFO[0000] SyntaxError: Token: FORWARD_SLASH
line 10:15 mismatched input '/' expecting COLON
INFO[0000] SyntaxError: Token: FORWARD_SLASH
line 10:19 mismatched input ' <: ' expecting COLON
INFO[0000] SyntaxError: Token: LESS_COLON
WARN[0000] restfulapi.sysl has syntax errors

A minmal example:

ReportAPI:
    /api/report:
        GET:
            ...

    /api/report/:
        GET:
            ...

    /api/report/{id <: int}:
        GET:
            ...
$ sysl validate -v restfulapi.sysl
DEBU[0000] Logging: {loglevel:debug verbose:true}
DEBU[0000] Attempting to load module:restfulapi.sysl (root:)
DEBU[0000] Parsing: restfulapi.sysl
line 6:16 mismatched input ':' expecting {CURLY_OPEN, DIGITS, TEXT_LINE, Name, E_Name}
INFO[0000] SyntaxError: Token: COLON
WARN[0000] restfulapi.sysl has syntax errors

Expected behavior

I would like to use sysl to model systems as they are, rather than have to only specify "ideal" systems.

Actual behavior

validation error(s) occur.

Your Environment

$ sysl info
Build:
  Version      : v0.438.0
  Git Commit   : 3550ba28c3dfd16c874be629b8f1f0f3a82a15cf
  Date         : 2021-08-23T00:12:23Z
  Go Version   : go1.16.7 linux/amd64
  OS           : darwin/amd64
@akumria akumria added the bug label Aug 23, 2021
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

1 participant