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

Reslang generates invalid schema for custom events #183

Closed JacobCrofts closed 2 years ago

JacobCrofts commented 3 years ago

Medium priority, not high, because even though the spec is invalid, no functionality is lost. We just get an annoying error message alongside our otherwise working docs.

Describe The Bug

When I say custom events, this is an example of what I mean:

event SegmentIngestionCompleted {
    /payload
        segmentIngestionRequest: value-of SegmentIngestionRequest
}
produces SegmentIngestionCompleted

Reslang produces an invalid AsyncAPI schema for custom events. You can see the errors at the top of this page.

The problem is that the UI tool we are using does not accept the following with an empty enum:

    SegmentIngestionRequestHeader:
      type: object
      properties:
        verb:
          description: ''
          type: string
          enum: [] # delete this line and it will be valid

After fixing this single issue manually, the AsyncAPI editor seems to be happy.

To Reproduce

see top of this page

Expected Behavior

Doc portal page linked above displays no errors. This most likely means updating reslang so that it excludes empty request header enums. We could also consider removing that field entirely, as it's not obvious to me how it would be useful. Normally the enum is populated with HTTP verbs.

Reslang Version

Master/Latest

elvis-xianghai-fan commented 3 years ago

This issue looks related to the comment here.