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

Literal syntax for CSJ in .fg files #3

Open
KayEss opened this issue Jun 4, 2017 · 0 comments
Open

Literal syntax for CSJ in .fg files #3

KayEss opened this issue Jun 4, 2017 · 0 comments

Comments

@KayEss
Copy link
Member

KayEss commented Jun 4, 2017

It's quite annoying that CSJ used for tests must always be loaded from an external file. These are harder to write and it's then harder to deal with them. Also the JSON form that's used where CSJ is returned is really a pain.

This is from films.t1.fg:

GET film.slug /t1/tags 200 {"columns": ["tag"],
    "rows": [["action"], ["adventure"], ["dystopian"], ["robots"], ["sci-fi"], ["time-travel"]]}

What I'd like to be able to write instead is something more along the lines of this:

GET film.slug /t1/tags 200 """
    "tag"
    "action"
    "adventure"
    "dystopian"
    "robots"
    "sci-fi"
    "time-travel"
    """

The triple double quote is copied from Python. It's nice in that the sequence cannot occur in CSJ so it's clear where things start and end, but the problem is that it blends into the double quotes already used by JSON.

An alternative would be single quotes:

GET film.slug /t1/tags 200 '''
    "tag"
    "action"
    "adventure"
    "dystopian"
    "robots"
    "sci-fi"
    "time-travel"
    '''

But maybe back ticks are even better:

GET film.slug /t1/tags 200 ```"tags"
    "action"
    "adventure"
    "dystopian"
    "robots"
    "sci-fi"
    "time-travel"```

This is the only one where I can really remove the blank line at the start/end without making it look confusing.

There's probably an even better idea. Any thoughts @tleekkul?

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

No branches or pull requests

1 participant