raml-org/raml-js-parser-2

Option to create JSON output in the same structure as the 0.8 parser

oberlies opened this issue · 7 comments

The parser for RAML 0.8 parser produces a JavaScript object that has a different structure than the RAML file itself. E.g. resources are grouped in an "resources" property.

The new parser should have an option to produce the same format, e.g. for compatibility with raml2html

@oberlies this is important question for discussion, thanks for reporting it here. We definitely can create some kind of converter , but it will not help you much with implementing actual support for RAML 1.0 features.

Regards,
Pavel

A major difference in the output is that the resources are stored as raw properties by the 1.0 parser and not grouped in a "resources" property. This makes the output of the 1.0 parser a lot harder to consume.

Are there any plans to re-introduce the "resources" property in the parser output? BTW, is there a specification of the structure produced by the parser?

I can't help you with your first question, but you can find the structure here. Let me know if that is what you were looking for. We are still improving the parser and how people consume it, so every feedback is very welcome. ;)

@sichvoge Thanks a lot for this link - this is very helpful.

I'm really interested in this topic. I was thinking about adding a property like parse0.8 into toJSON serializeOptions because of resources that @oberlies comented that are not nested now. IS very different vs 0.8 parser because it makes the collection harder to iterate, and personally, inconsistent with the rest of the toJSON structure that is usually encapsulated

Also i checked that some properties are read as string instead of boolean or number such as required property. This may also be changed so json structure is better.

What do you think?

toJSON output is pretty similar to 0.8 at this point, so closing this. Please report if you see something that still needs improvement.

Regards,
Pavel

@petrochenko-pavel-a which commit or tag gave you the confidence to close this issue?