LiveRamp / reslang

A language for describing resource-oriented APIs & turning them into Swagger or resource diagrams. Oriented around the concepts we want to expose in the APIs.
Apache License 2.0
23 stars 7 forks source link

Comments claim "TEST" is the default environment for a server, but environment is required (can't be defaulted) #172

Closed rupertchen closed 2 years ago

rupertchen commented 3 years ago

Describe The Bug

Comments in the grammar for the servers block claim the optionally defined "environment" attribute defaults to TEST, when in fact, the implementation defaults to PROD and the grammar requires an environment be specified.

  1. The comment about default environment value being TEST.
  2. The constructor in code generation defaulted to PROD.
  3. The grammar requires environment be present; there is no ?.

To Reproduce

  1. Checkout LiveRamp/api-specs.
  2. Go to specs-draft/field-mapper and add a servers block with no environment set to api.reslang:

    servers {
       /REST
           server = "https://api-staging.liveramp.com"
    }
  3. Generate the spec while specifying the TEST environment:

    $ ./generate-specs.sh ./specs-draft/field-mapper/ --env TEST
    master: Pulling from liveramp-eng/reslang
    Digest: sha256:5dc87e0c713e444a780cf15c5ff9a2d4706a582f93eea365429fbecbf97c45bf
    Status: Image is up to date for gcr.io/liveramp-eng/reslang:master
    gcr.io/liveramp-eng/reslang:master
    Reslang error:  Problem parsing file /app/reslang/specs/field-mapper/api.reslang: Expected "/*", "//", "environment", or [ \t\r\n] but "}" found., location: 10, 1

Expected Behavior

Expect the spec to be generated.

Reslang Version

Master/Latest