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

Id is not a required attribute for singleton resources #2

Closed dquenne closed 5 years ago

dquenne commented 5 years ago

Seems like this is the intended behavior anyway, but assigning idType outside the if (!singleton) clause meant it was still required for singleton resources. Lmk if I'm missing some context here, but this seems to work for me.

liveandrew commented 5 years ago

ah singletons shouldn't require an id attr at all. looks like a bug on my part

liveandrew commented 5 years ago

did the tests still run? let me check because i have a singleton test

liveandrew commented 5 years ago

this currently fails on parent singletons that have no ids.

e.g. change the example in models/singleton to:

singleton asset-resource Resource { name: string

/operations
    PUT GET

}

can fix?

dquenne commented 5 years ago

Took a stab at reworking genswagger.ts a bit to have special logic around subresources of singleton resources. Lmk what you think.

Updated the singleton resource examples (and expected parsed.expected and swagger.expected) to produce the following routes:

image