-
Notifications
You must be signed in to change notification settings - Fork 52
Spike on the raml2obj schema #491
Comments
That'd be great! Make sure to check the develop branch of raml2obj btw. |
I would apply the following changes:
On the other hand, there are some transformations that I would not use in general case:
|
@kevinrenskers whats your opinion for the points Konst highlighted around transformation he wouldn't do. My take:
examples:
hello:
cat: hello examples:
hello:
value:
cat: hello In general, we should always provide the same output regardless if someone uses special shortcuts or syntactic sugar. For example, I should get the same output for these RAMLs: #%RAML 1.0
title: Traits
baseUri:
value: http://api.com
types:
Cat:
/test:
get:
body:
application/json:
type: object
properties:
cats: Cat[] and #%RAML 1.0
title: Traits
baseUri: http://api.com
types:
Cat:
/test:
get:
body:
application/json:
type: object
properties:
cats:
type: array
items: Cat Both are exactly the same but I used different syntactical aspects. The output though should give you a single consistent output. That also encompass Would love to hear more opinions. |
I agree with you. My biggest problems with the parser are indeed the inconsistencies of the output, exactly like you described. Like types and examples. Also, there's And like already mentioned plenty times before, just make the output easier to work with. So no wrapped objects inside of arrays and stuff. I would definitely switch maps to arrays as well. The fact that maps are closer to input RAML doesn't really matter to anyone actually working with the output? I would like the addition of Most of all though, any type of type expansion should be handled by the official parser, as it's just much to hard too get this right myself (basically all bug reports for RAML 1 support in raml2html are about type handling, specifically arrays and inheritance). Output size really shouldn't be a concern I think? You can always do it behind a parameter if you don't always want to do it. My bet is that basically everyone will use that flag to auto expand though :) |
Making stuff like |
1. I do not have anything to say against
In such cases definition of each parameter is inserted in all the subsequent resources, and thus, JSON size is a polynomial function of maximal resource depth. It does not seem to be unsafe in most cases, but one can easily imagine a critical case. 2. @sichvoge , we were discussing the maps vs arrays choice in September, and we ended with maps finaly (wich is variant "C" here). Thus I do not quite understand the reason of useing maps for 'types', 'traits', 'resourceTypes', 'annotationTypes', 'securitySchemes'; and arrays -- for 'responses', 'body', 'queryParameters', 'headers', 'properties', 'baseUriParameters', 'annotations'. 3. @sichvoge Right now
when you obtain
How would we turn
?
4. Ok, I it seems reasonable to have uniform access to examples disregarding the facet used, but lets not loose specified facets of ExampleSpec (@sichvoge, I'm talking about how it is implemented in raml2obj). So, I suggest always moving the single
|
Another improvement: for example, |
@sichvoge Agree, let's use array for |
Thanks Konst. Do we have any issue or document somewhere that highlights all the changes? If not, what would be the best place? cc/ @ddenisenko |
No, I do not have a special place. The changes are enumerated only in the present issue. I guess, we could create an issue or a google doc. |
I'd go for a new issue and update it when ever we've done a decision. Can you start with that and consolidate any changes we discussed so far and bring that into some kind of table format? For example:
We can extend this table when ever there is a new decision. Please link to the new issue here. |
Ok |
Once again about the difference between foramts of Actually, I do not like both of them. I would use a map under the
What do you think, guys? |
I guess this one can be closed. Please reopen if there are still matters to discuss. |
It looks like https://github.com/raml2html/raml2obj has a number of improvements to the parser JSON format, we should check it and see if we can add some of those to the next generation of parser output.
The text was updated successfully, but these errors were encountered: