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

Example is generated incorrectly for linked resources. #89

Closed dimatkach closed 4 years ago

dimatkach commented 4 years ago
resource Foo {
   id: int
}

resource Bar {
   id: int
   foo: linked Foo
   bar: date
   baz: int
}

This generates schema for Bar looking like:

    BarInput:
      type: object
      properties:
        foo:
          type: integer
          format: int32
          example: Link to Foo resource via its id
        bar:
          type: string
          format: ISO8601 UTC date
          example: '2019-04-13'
        baz:
          type: integer
          format: int32

Note, that the example for foo is (1) a string, and (2) not quoted unlike bar. (2) results in openapi-generator creating invalid (test) code (at least in python), albeit the yml is valid. And (1) just seems to be semantically wrong: an example should be a sample valid input, not a description of the purpose of the field. Perhaps, this string is better suited for a (default) descritption rather than example?

liveandrew commented 4 years ago

fixed by movinginto description field, rather than example...