raml-org / raml-java-parser

(deprecated) A RAML parser based on SnakeYAML written in Java
Other
174 stars 121 forks source link

Accessing trait details #430

Open KevinMitchell opened 7 years ago

KevinMitchell commented 7 years ago

From a RAML 1 model I can access the list of traits defined in the model. But for each trait, an instance of org.raml.v2.api.model.v10.methods.Trait, all I seem to have access to is the name and usage. How do I access all the other information associated with a trait from the model? This seems a fairly fundamental requirement, so I'm obviously misunderstanding something. I realise the trait information gets expanded out when the trait is referenced from a resource etc, and so the information isn't lost. But I want to know the contents of an individual trait independent of any usage. Thanks

Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-74

KevinMitchell commented 6 years ago

Has anyone figured out how to access the details for the declared traits? It looks like for the 08 Trait definition it inherited from MethodBase, so the various parts of the trait could be accessed. The 10 Trait definition doesn't do this. So how are we supposed to get these details from a RAML 1.0 model?

Does anyone know of another Java parser for RAML 1.0 that builds a cleaner and more accurate model for RAML 1.0 specifications?

hamza-busuri commented 4 years ago

Hi there, did you manage to figure this out?

hamza-busuri commented 4 years ago

Hey Kevin, I think to resolve this issue, you might want to use the latest web-api parser. Gives you access to many other methods and you can extract details like your traits.

gmartinezg077 commented 4 years ago

Hi, anyone knows how to access queryParameters info contained in Trait, currently the v10 model do not allow to access a part from name or usage. if anyone figured out another way to access the info contained in Trait model that will be great.

machaval commented 4 years ago

The only way to get the Traits is by using the Nodes api where you can navigate the AST nodes