Skip to content

Literal syntax for CSJ in .fg files #3

@KayEss

Description

@KayEss

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions