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

Fields with reserved keywords are incorrectly parsed. #24

Closed davinchia closed 4 years ago

davinchia commented 4 years ago

Given the following struct,

request-resource SegmentIngestionRequest {
    id: string
    segmentId: linked Segment
    inputDataURL: url

    createdAt: datetime output
    status: StatusEnum output 
    completedAt: datetime output optional
    outputMetaData: SIROutputMetadata output optional  

    /operations
    GET POST
}

the following swagger is generated:

SegmentIngestionRequestOutput:
     .... (certain fields omitted for clarity)
        completedAt:
          description: ''
          type: string
          format: ISO8601 UTC date-time
          example: '2019-04-13T03:35:34Z'
        MetaData:
          description: ''
          $ref: '#/components/schemas/SIROutputMetadata'
      required:
        - id
        - segmentId
        - inputDataURL
        - createdAt
        - status

Instead of outputMetaData, the swagger has a field named MetaData. I suspect this is because the output keyword is reserved and thus being dropped.

liveandrew commented 4 years ago

yeah this shouldn't happen. looking now

liveandrew commented 4 years ago

this is an easy one - it's basically because my whitespace grammar rule allows no whitespace. your hunch was right. checking in after lunch along with megafix for many other fixes

liveandrew commented 4 years ago

fixed in anydepth-mark-2 branch. awaiting merge. https://github.com/LiveRamp/reslang/commit/7472ce48e358dc209c2f79b8053f259df7252d38