anz-bank / sysl

Sysl (pronounced "sizzle") is a system specification language
https://sysl.io
Apache License 2.0
122 stars 42 forks source link

Sysl can't parse the sysl file generated by the Swagger importer. #945

Closed springwiz closed 4 years ago

springwiz commented 4 years ago

Please do not post any internal, closed source snippets on this public issue tracker!

Description

Sysl can't parse the sysl file generated by the Swagger importer. The following fragment seems to be the problem. The fragment is generated by the swagger importer.

    /rest?method=flickr%2Ephotos%2Esearch:
        GET ?api_key=string&text=string?&tags=string?&user_id=string?&min_upload_date=string?&max_upload_date=string?&min_taken_date=string?&max_taken_date=string?&license=string?&sort=string?&privacy_filter=float?&bbox=string?&accuracy=string?&safe_search=float?&content_type=float?&machine_tags=string?&machine_tag_mode=string?&group_id=string?&contacts=string?&woe_id=string?&place_id=string?&media=string?&has_geo=string?&geo_context=string?&lat=string?&lon=string?&radius=float?&radius_units=string?&is_commons=bool?&in_gallery=bool?&is_getty=bool?&per_page=float?&page=float?:
            | Return a list of photos matching some criteria.
            return ok <: PhotoResource

Steps to Reproduce

  1. Run sysl pb --mode json */flickr.sysl >> flickr.sysl.json

Expected behavior: flickr.sysl.json created.

Actual behavior: Syntax error. line 15:9 mismatched input '?' expecting {COLON, SQ_OPEN} line 15:16 mismatched input '=' expecting COLON line 16:8 mismatched input 'GET ' expecting {'!wrap', '!table', '!type', '!alias', '!enum', '!union', '!view', WHATEVER, MIXIN, '<->', '.. <- ', FORWARD_SLASH, '@', SYSL_COMMENT, TEXT_LINE, Name, E_Name} line 16:20 mismatched input '=' expecting COLON line 16:32 mismatched input '=' expecting COLON line 16:45 mismatched input '=' expecting COLON line 16:61 mismatched input '=' expecting COLON line 16:85 mismatched input '=' expecting COLON line 16:109 mismatched input '=' expecting COLON line 16:132 mismatched input '=' expecting COLON line 16:155 mismatched input '=' expecting COLON line 16:171 mismatched input '=' expecting COLON line 16:184 mismatched input '=' expecting COLON line 16:207 mismatched input '=' expecting COLON line 16:219 mismatched input '=' expecting COLON

Your Environments

$ sysl info
...

$ sysl env
...
version=0.137.0
[flickr.sysl.txt](https://github.com/anz-bank/sysl/files/4895196/flickr.sysl.txt)
[flickr.yaml.txt](https://github.com/anz-bank/sysl/files/4895197/flickr.yaml.txt)
orlade-anz commented 4 years ago

Huh, yeah, all the query params should follow the GET, not the path. It's odd that they're split.

ericzhang6222 commented 4 years ago

Root cause is: method=flickr%2Ephotos%2Esearch:

ericzhang6222 commented 4 years ago

@springwiz how do you use method=flickr%2Ephotos%2Esearch? Does it impact your process if remove method=flickr%2Ephotos%2Esearch as a quick fixing?

springwiz commented 4 years ago

@ericzhang6222 I can't remove that, I don't own that swagger. The downstream system would need that.

ericzhang6222 commented 4 years ago

@ericzhang6222 I can't remove that, I don't own that swagger. The downstream system would need that.

@springwiz @orlade-anz , then it has to change Sysl grammar parser to fix this issue.

ericzhang6222 commented 4 years ago

It is #658 related.