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

Use "type: integer" for int attributes, pagination, and http status codes #4

Closed dquenne closed 4 years ago

dquenne commented 4 years ago

Context

Got some funny situations where auto-generated examples would generate these long decimals for things that should definitely be integers. Depending on how you generate your documentation and auto-generated examples, you get something like this for the response for a POST: image Or for some of our stats use cases, you can specify the maximum members in a segment ("cap"), which is always going to be an integer, but we got image

I realized it's because of this in genswagger.ts:

            case "int":
                schema.type = "number" // should be "integer"
                break

Changes

The only important changes are in src/genswagger.ts. Specifically, I changed so that the following are type: integer instead of type: number:

The other changes are just updating swagger.expecteds for tests. I'm not sure what you want to do about models/direct2dist/distribution.yaml and concepts/distribution-swagger.yaml, or the actual open API spec that dist has in their repo, for that matter.