raml-org / raml-java-parser

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

Parser doesn't provide abstraction for nested Resources on Model level #100

Open bademux opened 8 years ago

bademux commented 8 years ago

Parser doesn`t provide abstraction for nested resources as it should. Basically it maps data to POJO and leaves you with handling specification on your own. Not the behavior I supposed to get from the official parser.

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

svacas commented 8 years ago

Can you describe the behavior you would like to have?

bademux commented 8 years ago

I'm currently working on POC codegenerator for SparkFramework.

The main idea is a parser shares with consumer (JavaPoet writer in my case) only Model. Parser -> Model -> Consumer By saying "Model" I mean list of immutable

Action{
 Uri;
 HttpMethod;
 Name;
 Request{
  Mime
  Header[]
  Param[]; //Query, Form, Uri
  ...
 };
 Response{
  Mime
  HttpCode
  Header[]
  ...
 };
 .....
}

The Model was flatten as much as possible to have few dependant models. I can represent model to any kind of consumer without going by the spec in this way. Cost is data duplication: Action is created as permutation of all important fields (Uri, HttpMethod, Name), it seems reasonable trade off, imno.

Writer feature (edition abilities) seem superfluous to me and can be implemented as additional tool.

Looking for your comment! updated Action on 2016-03-10 11:34 UTC

eleonoraortega commented 7 years ago

Could you please verify this model in V2 version ? thanks