Code Monkey home page Code Monkey logo

raml-java-parser's Introduction

RAML.org Website

This repository contains the source code for the raml.org website written in Jekyll

Requirements

Running locally

Pull the code locally:

$ git clone [email protected]:raml-org/raml-org.git

Enter directory:

$ cd raml-org

Install all dependencies:

$ bundle install

Build & run the site:

$ bundle exec jekyll serve

How to add projects to the projects page?

RAML.org includes a projects page that lists tools around RAML that either are community or commercial driven. If you think, your project should be in this list, please fork this repository, add it into the projects.yml file, and send us a PR. We will review and let you know if we will be able to list it.

Another way to make sure your project is linked to our projects page is through assigning topics to your Github project. Links to each topics are below the list of projects on the projects page. The following topics are available:

Topic Description
raml-design Includes projects that specifically support people with the design of RAML documents.
raml-document Includes projects that focus on the documentation of APIs using RAML documents.
raml-build Includes projects that focus on build client or server code based on RAML documents.
raml-parser Includes projects that parses/validates RAML documents.
raml-test Includes projects that support people testing APIs based on RAML documents.
raml-utilities Includes other projects that do not fall into the other topics like converters.

Topics need to be assigned and managed by the owner of a project. Additionally, we still recommend people to search on Github for more projects that might not have these topics assigned.

Contribution

RAML's website is in fact an open source project and your contribution is very much appreciated. Before you start, you should check for open issues or open a fresh issue to start a discussion around an idea that you'd like to see on our website or a bug. If you want to support us fixing issues, please follow the steps below:

  1. Fork the repository on Github and make your changes on the develop branch (or branch off of it).
  2. Run the website to see if you fixed the issue.
  3. Send a pull request (with the develop branch as the target).

We will review your PR, comment if necessary, and merge it into our staging branch stg.

You can contribute to the following:

  • spelling mistakes
  • new projects
  • blog posts
  • and others, after carefully reviewing the issue you created

raml-java-parser's People

Contributors

aamura avatar aiannucci avatar angelbarrera92 avatar dahlej avatar dfmacias avatar dlarralde avatar erecofsky avatar evangelina avatar fbarrios avatar fedeamdan avatar fededonna avatar jpbelang avatar jstoiko avatar juanaller avatar juanchib avatar julianesevich avatar lclement57 avatar lorenasoledad avatar machaval avatar maquinas07 avatar martincousido avatar mauriarroqui avatar moliva avatar olegdokuka avatar pacafuentes avatar pmantellini avatar rtarda avatar sichvoge avatar svacas avatar svc-scm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raml-java-parser's Issues

Raml Emitter truncates trait definition

We are seeing a behavior where we put traits in single file inline. When I am calling the dump using emitter it is emitting empty traits with just display name . I am using version 0.8.9.
Please help.

Steps:

  1. Create Raml object with proper traits using RamlDocumentBuilder

2.Feed Raml object with traits to emitter
2. call dump method on emitter
3. You will see empty traits
4. Emitted raml has traits with just displayname and missing the main definition

Code
RamlDocumentBuilder ramlBuilder = new RamlDocumentBuilder();
RamlEmitter re = new RamlEmitter();
try (Reader r =
new FileReader(new File(getClass().getClassLoader()
.getResource("test.raml").getFile())))
{
Raml raml = ramlBuilder.build(r, null);
System.out.print(re.dump(raml));

}
finally
{

}

Input Trait sample
traits:

tokenTrait: headers: authToken: description: A valid authToken is required required: true type: string authVerifier: description: A valid authVerifier string is required required: true type: string authTokenSecret: description: A valid authTokenSecret string is required required: true type: string

Output from emitter

traits:

"tokenTrait":
displayName: "tokenTrait"

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

java.lang.NoSuchFieldError: VALUE for v0.8.11

A while back I incorporated v0.8.11 into an application of mine running on Play v2.3.8 and just yesterday upgraded to Play v2.4.0, where it seems to have reattempted to download the RAML parser (still v0.8.11). Now, when I start up my application, I get the following exception:

[ERROR] [07/01/2015 22:51:04.416] [application-akka.actor.default-dispatcher-2] [ActorSystem(application)] Uncaught fatal error from thread [application-akka.actor.default-dispatcher-2] shutting down ActorSystem [application]
java.lang.NoSuchFieldError: VALUE
    at org.raml.parser.utils.NodeUtils.<clinit>(NodeUtils.java:34)
    at org.raml.parser.visitor.NodeVisitor.resolveTag(NodeVisitor.java:164)
    at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:139)
    at org.raml.parser.visitor.NodeVisitor.visitDocument(NodeVisitor.java:209)
    at org.raml.parser.visitor.YamlDocumentBuilder.build(YamlDocumentBuilder.java:90)
    at org.raml.parser.visitor.YamlDocumentBuilder.build(YamlDocumentBuilder.java:107)
...

It seems as though one of your most recent commits has something to do with the removal of the Tag.VALUE static member - would this perhaps have anything to do with the new error I'm getting? None of my code usage of the RAML parser has changed.

QueryParameters do not set display name

After parsing, the display name for a given QueryParameter is null, when it should be the name of the QP.

For example a query parameter 'owner' maps the string 'owner' to some QueryParameter object. That QueryParameter should have a displayName of 'owner', but currently it is simply null.

URI Parameters are only populated with the last URI Parameter

I've been using the raml-jaxrs-codegen project and found an issue with the PathParam generation.

Let's say my RAML file has the following URIs:

/posts:
  /{postId}:
    /{commentId}:

In the generated interface, the method corresponding to the {commendId} will ONLY contain a single PathParam, but I expect 2 PathParams (one for postId, one for commentId).

This issue stems from a class in the raml-java-parser project -- to be specific, the class "org.raml.parser.visitor.RamlDocumentBuilder" and the function "populateDefaultUriParameters"
In this function, URI Parameters are only created for the last URI parameter, instead of all the URI parameters.
Existing code:

Matcher matcher = pattern.matcher(resource.getRelativeUri());

My proposed fix to this line of code:

Matcher matcher = pattern.matcher(resource.getParentUri() + resource.getRelativeUri());

Resource.getResolvedUriParameters() does not return all inherited URI parameters and they are in unexpected order

This method has two bugs.

Issue 1: It returns URI parameters for the current resources and only the immediately parent. This is contrary to the javadoc which says "all URI parameters defined in the resource hierarchy".

Issue 2: It returns the result in an unordered Map (HashMap). Instead, it should return the URI parameters in order (LinkedHashMap). This way, when iterating over the entries in the map, I get the parameters in order as they appear in the resource path.

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

Errors with insufficient information about code position.

Hi, guys.

Some places in the parser throw exceptions which do not provide information about code position. For example:

java.lang.ClassCastException: org.yaml.snakeyaml.nodes.ScalarNode cannot be cast to org.yaml.snakeyaml.nodes.MappingNode
at org.raml.parser.visitor.TemplateResolver.loopTemplateSequence(TemplateResolver.java:145)
at org.raml.parser.visitor.TemplateResolver.init(TemplateResolver.java:129)
at org.raml.parser.visitor.RamlValidationService.preValidation(RamlValidationService.java:51)
at org.raml.parser.visitor.YamlValidationService.validate(YamlValidationService.java:64)
at org.raml.parser.visitor.YamlValidationService.validate(YamlValidationService.java:95)
at org.raml.parser.visitor.YamlValidationService.validate(YamlValidationService.java:77)

Being able to see positions and messages describing RAML nature of the error would be nice.

Initially the problem arose with RAML->JAX-RS generator.
mulesoft-labs/raml-for-jax-rs#103
I post this issue as the generator makes use of the 0.9-SNAPSHOT parser.

Regards, Konstantin.

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

crashes if there is a YAML syntax error

I'm trying to use this as a raml-lint tool to do syntax checking on files (since the RAML API-Console does not help when there are syntax errors).

I wrote a main parser class

import org.raml.parser.visitor.RamlValidationService;
import org.raml.parser.rule.ValidationResult;
import java.util.List;

public class Parser {
  public static void main(String args[]) {
    for (String location : args) {
      List<ValidationResult> results = RamlValidationService.createDefault().validate(location);
      if (results != null) {
        for (ValidationResult result : results)
          System.err.println(result);
      }
    }
  }
}

but when I run it on a resource with a yaml syntax error, I get an exception instead of a diagnostic that shows me where the error is:

Exception in thread "main" java.lang.NullPointerException
    at org.raml.parser.rule.ValidationResult.toString(ValidationResult.java:142)
    at java.lang.String.valueOf(String.java:2854)
    at java.io.PrintStream.println(PrintStream.java:821)
    at org.raml.parser.Parser.main(Parser.java:13)

because the result has a null contextPath

Raml parser is not dealing with constructions like

traits:

  • standartErrors: !include traits/standartErrors.raml
  • hasPeriod: !include traits/hasPeriod.raml
    resourceTypes:
  • generalResource: !include resourceTypes/generalResource.raml
  • query: !include resourceTypes/query.raml
  • passwordManagement: !include resourceTypes/passwordManagement.raml
  • queryResults: !include resourceTypes/queryResults.raml

Properly reporting base uri in validation results

I have the following layout (I am using the test files, renamed include-sequence.yaml to *.raml):

layout

I've added an empty description in sequence-trait.yaml:

paged:
    queryParameters:
        offset:
            description:
            type: integer
            default: 0
        limit:
            type: integer
            default: 10
secured:
    headers:
        security:
            type: boolean
            required: true

When validating include-sequence, a warning (validation result) shows up, saying description cannot be empty; the line/col is reported as 4/13.

However, through the validation result object, I couldn't trace the base uri of the file for which the line/col applies (in this case it should be sequence-trait.yaml).

Is there a way to resolve the offending uri?

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

RAML parser null pointer exception

I'm attempting to validate a RAML file but as soon as I try to load it using the snippet from the readme I get a NullPointerException.

Here's the stacktrace:

Exception in thread "main" java.lang.NullPointerException
at java.io.Reader.(Unknown Source)
at java.io.InputStreamReader.(Unknown Source)
at org.raml.parser.utils.StreamUtils.reader(StreamUtils.java:37)
at org.raml.parser.visitor.YamlValidationService.validate(YamlValidation
Service.java:82)
at org.raml.parser.visitor.YamlValidationService.validate(YamlValidation
Service.java:72)
at com.company.ramlvalidator.Generator.parseArgs(Generator.java:50)
at com.company.ramlvalidator.Generator.main(Generator.java:28)

File is saved as UTF-8.

Relevant Code:

        File f = new File(ramlLocation);
        if (f.exists()) {
               List<ValidationResult> validationResults = RamlValidationService.createDefault().validate(ramlLocation);
        }

!include for schemas in project directory

Having trouble getting some relative !includes to work.

RAML looks like this:

schemas:
    - schema1.json: !include schema/schema1.json
    - schema2.json: !include schema/schema2.json

and these schemas are referenced within the RAML for specific methods.

the RAML is located in the root of the project, as is the schema folder.

The validation errors look like this:

ERROR Include cannot be resolved schema/schema1.json (line 6, col 22 to 45)
ERROR Include cannot be resolved schema/schema2.json (line 7, col 19 to 41)

I've tried absolute paths, and putting the RAML and JSON in the same directory. Seems like this should be pretty straightforward but I'm stumped. Any ideas?

Java 1.5 Compliance and @Override

Is this intended to be compilable under Java 1.5? If so, then don't use @OverRide on interface methods.

If not, then maybe set your source (maven-compiler-plugin) to 1.6, otherwise any default import into Eclipse using M2E will immediately throw up piles of messages because it will assume, as Maven has told it to, that you intended it to be Java 1.5 compliant.

Inconsistentency in parsing pattern expression

Assumed I want to use a pattern inside my uri by having a definition like that:

/testPattern{uriParam} :
  uriParameters:
    uriParam:
      type: string
      pattern: ^[a-z]*$

This will work fine and the raml file can be parsed.
When changing the pattern expression to

pattern: [a-z]*

it will fail with:

org.yaml.snakeyaml.scanner.ScannerException: while scanning an alias
in 'reader', line 14, column 21:
          pattern: [a-z]*
                        ^
expected alphabetic or numeric character, but found but found 
 in 'reader', line 14, column 22:
          pattern: [a-z]*
                         ^

at org.yaml.snakeyaml.scanner.ScannerImpl.scanAnchor(ScannerImpl.java:1439)
at org.yaml.snakeyaml.scanner.ScannerImpl.fetchAlias(ScannerImpl.java:918)
at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:366)
at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:226)
at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:558)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143)
at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:226)
at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:155)
at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:233)
at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:155)
at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:233)
at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:155)
at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:233)
at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:155)
at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122)
at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)
at org.yaml.snakeyaml.Yaml.compose(Yaml.java:564)
at org.raml.parser.visitor.YamlDocumentBuilder.build(YamlDocumentBuilder.java:84)
at org.raml.parser.visitor.YamlDocumentBuilder.build(YamlDocumentBuilder.java:94)

Quoting the expression will work fine as well:

      pattern: "[a-z]*"

It seems that the brackets are causing a problem when being the first character of expression.
In the specification nothing is defined about escaping the expression in certain conditions.. "The pattern MAY be enclosed in double quotes for readability and clarity."

Would be nice if any expression will be supported without the need of escaping it. If not possible the specification should get adjusted.

Consider addressing compiler's lint warnings

The current codebase has 143 compilation warnings. It would be neat if it didn't :)

Description Resource    Path    Location    Type
TupleRule is a raw type. References to generic type TupleRule should be parameterized  ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 61 Java Problem
Type safety: The method setParentTupleRule(TupleRule) belongs to the raw type TupleRule. References to generic type TupleRule should be parameterized  ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 60 Java Problem
Type safety: The expression of type List needs unchecked conversion to conform to Collection    ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 46 Java Problem
List is a raw type. References to generic type List should be parameterized  ReflectionUtils.java    /raml-parser/src/main/java/org/raml/parser/utils    line 66 Java Problem
Type safety: The method validateKey(Node) belongs to the raw type TupleRule. References to generic type TupleRule should be parameterized  ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 46 Java Problem
Type safety: The method add(Object) belongs to the raw type List. References to generic type List should be parameterized    ReflectionUtils.java    /raml-parser/src/main/java/org/raml/parser/utils    line 66 Java Problem
Type safety: The method validateValue(Node) belongs to the raw type NodeRule. References to generic type NodeRule should be parameterized    ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 147    Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 113    Java Problem
Type safety: The method setNestedRules(Map) belongs to the raw type TupleRule. References to generic type TupleRule should be parameterized    ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 94 Java Problem
Type safety: The method setParentTupleRule(TupleRule) belongs to the raw type TupleRule. References to generic type TupleRule should be parameterized  ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 63 Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 33 Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 31 Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 30 Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 44 Java Problem
Map is a raw type. References to generic type Map should be parameterized  ReflectionUtils.java    /raml-parser/src/main/java/org/raml/parser/utils    line 70 Java Problem
Type safety: The method put(Object, Object) belongs to the raw type Map. References to generic type Map should be parameterized    ReflectionUtils.java    /raml-parser/src/main/java/org/raml/parser/utils    line 70 Java Problem
Type safety: The expression of type List needs unchecked conversion to conform to Collection    ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 43 Java Problem
Type safety: The method validateKey(Node) belongs to the raw type TupleRule. References to generic type TupleRule should be parameterized  ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 43 Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 33 Java Problem
HashSet is a raw type. References to generic type HashSet should be parameterized    NodeUtils.java  /raml-parser/src/main/java/org/raml/parser/utils    line 34 Java Problem
Type safety: The constructor HashSet(Collection) belongs to the raw type HashSet. References to generic type HashSet should be parameterized NodeUtils.java  /raml-parser/src/main/java/org/raml/parser/utils    line 34 Java Problem
Set is a raw type. References to generic type Set should be parameterized    NodeUtils.java  /raml-parser/src/main/java/org/raml/parser/utils    line 34 Java Problem
List is a raw type. References to generic type List should be parameterized  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 119    Java Problem
List is a raw type. References to generic type List should be parameterized  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 145    Java Problem
List is a raw type. References to generic type List should be parameterized  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 103    Java Problem
List is a raw type. References to generic type List should be parameterized  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 103    Java Problem
Class is a raw type. References to generic type Class should be parameterized    MapWithListValueTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 30 Java Problem
List is a raw type. References to generic type List should be parameterized  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 187    Java Problem
Map is a raw type. References to generic type Map should be parameterized  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 199    Java Problem
List is a raw type. References to generic type List should be parameterized  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 162    Java Problem
List is a raw type. References to generic type List should be parameterized  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 168    Java Problem
Map is a raw type. References to generic type Map should be parameterized  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 245    Java Problem
Map is a raw type. References to generic type Map should be parameterized  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 227    Java Problem
Map is a raw type. References to generic type Map should be parameterized  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 227    Java Problem
List is a raw type. References to generic type List should be parameterized  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 205    Java Problem
List is a raw type. References to generic type List should be parameterized  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 265    Java Problem
Map.Entry is a raw type. References to generic type Map.Entry should be parameterized RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 258    Java Problem
Type safety: Unchecked cast from Set to Set  RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 258    Java Problem
Map.Entry is a raw type. References to generic type Map.Entry should be parameterized RamlEmitter.java    /raml-parser/src/main/java/org/raml/emitter line 258    Java Problem
Type safety: The expression of type List needs unchecked conversion to conform to Collection    ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 147    Java Problem
NodeRule is a raw type. References to generic type NodeRule should be parameterized  YamlDocumentValidator.java  /raml-parser/src/main/java/org/raml/parser/visitor  line 191    Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 148    Java Problem
Type safety: The method validateValue(Node) belongs to the raw type NodeRule. References to generic type NodeRule should be parameterized    ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 150    Java Problem
Type safety: The expression of type List needs unchecked conversion to conform to Collection    ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 150    Java Problem
Type safety: The expression of type List needs unchecked conversion to conform to Collection    ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 159    Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 160    Java Problem
Type safety: The expression of type List needs unchecked conversion to conform to Collection    ContributionTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 162    Java Problem
Enum is a raw type. References to generic type Enum should be parameterized  EnumHandler.java    /raml-parser/src/main/java/org/raml/parser/resolver line 28 Java Problem
Type safety: Unchecked invocation valueOf(Class, String) of the generic method valueOf(Class, String) of type Enum  EnumHandler.java    /raml-parser/src/main/java/org/raml/parser/resolver line 41 Java Problem
TupleBuilder is a raw type. References to generic type TupleBuilder should be parameterized    Scalar.java /raml-parser/src/main/java/org/raml/parser/annotation   line 33 Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  Scalar.java /raml-parser/src/main/java/org/raml/parser/annotation   line 31 Java Problem
The method getOtherName(String, String) from the type Inflector is never used locally   Inflector.java  /raml-parser/src/main/java/org/raml/parser/utils    line 284    Java Problem
The method getIdName(String) from the type Inflector is never used locally  Inflector.java  /raml-parser/src/main/java/org/raml/parser/utils    line 268    Java Problem
The method shortName(String) from the type Inflector is never used locally  Inflector.java  /raml-parser/src/main/java/org/raml/parser/utils    line 263    Java Problem
The method tableize(String) from the type Inflector is never used locally   Inflector.java  /raml-parser/src/main/java/org/raml/parser/utils    line 188    Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  Mapping.java    /raml-parser/src/main/java/org/raml/parser/annotation   line 33 Java Problem
NodeBuilder is a raw type. References to generic type NodeBuilder should be parameterized    SequenceTupleBuilder.java   /raml-parser/src/main/java/org/raml/parser/builder  line 57 Java Problem
TupleBuilder is a raw type. References to generic type TupleBuilder should be parameterized    Mapping.java    /raml-parser/src/main/java/org/raml/parser/annotation   line 35 Java Problem
ArrayList is a raw type. References to generic type ArrayList should be parameterized    SequenceTupleBuilder.java   /raml-parser/src/main/java/org/raml/parser/builder  line 51 Java Problem
Set is a raw type. References to generic type Set should be parameterized    ResourceTypesTraitsTestCase.java    /raml-parser/src/test/java/org/raml/parser/builder  line 51 Java Problem
Enum is a raw type. References to generic type Enum should be parameterized  EnumHandler.java    /raml-parser/src/main/java/org/raml/parser/resolver line 26 Java Problem
The static method parseRaml(String) from the type AbstractRamlTestCase should be accessed in a static way   TraitsTestCase.java /raml-parser/src/test/java/org/raml/parser/builder  line 61 Java Problem
The static method parseRaml(String) from the type AbstractRamlTestCase should be accessed in a static way   TraitsTestCase.java /raml-parser/src/test/java/org/raml/parser/builder  line 37 Java Problem
The static method parseRaml(String) from the type AbstractRamlTestCase should be accessed in a static way   TraitsTestCase.java /raml-parser/src/test/java/org/raml/parser/builder  line 54 Java Problem
The static method parseRaml(String) from the type AbstractRamlTestCase should be accessed in a static way   TraitsTestCase.java /raml-parser/src/test/java/org/raml/parser/builder  line 47 Java Problem
Type safety: Unchecked cast from Node to V  DefaultTupleRule.java   /raml-parser/src/main/java/org/raml/parser/rule line 108    Java Problem
NodeBuilder is a raw type. References to generic type NodeBuilder should be parameterized    DefaultTupleBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 94 Java Problem
NodeBuilder is a raw type. References to generic type NodeBuilder should be parameterized    DefaultTupleBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 112    Java Problem
The method toString(Stack>) from the type RamlDocumentBuilder is never used locally  RamlDocumentBuilder.java    /raml-parser/src/main/java/org/raml/parser/visitor  line 90 Java Problem
NodeBuilder is a raw type. References to generic type NodeBuilder should be parameterized    RamlDocumentBuilder.java    /raml-parser/src/main/java/org/raml/parser/visitor  line 93 Java Problem
The serializable class ParseException does not declare a static final serialVersionUID field of type long   ParseException.java /raml-parser/src/main/java/org/raml/parser  line 18 Java Problem
NodeBuilder is a raw type. References to generic type NodeBuilder should be parameterized    RamlDocumentBuilder.java    /raml-parser/src/main/java/org/raml/parser/visitor  line 100    Java Problem
Class is a raw type. References to generic type Class should be parameterized    DefaultTupleRule.java   /raml-parser/src/main/java/org/raml/parser/rule line 118    Java Problem
Class is a raw type. References to generic type Class should be parameterized    RamlDocumentBuilder.java    /raml-parser/src/main/java/org/raml/parser/visitor  line 106    Java Problem
NodeBuilder is a raw type. References to generic type NodeBuilder should be parameterized    DefaultTupleBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 54 Java Problem
DefaultTupleBuilder is a raw type. References to generic type DefaultTupleBuilder should be parameterized  DefaultTupleBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 58 Java Problem
NodeBuilder is a raw type. References to generic type NodeBuilder should be parameterized    SequenceBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 33 Java Problem
The serializable class User does not declare a static final serialVersionUID field of type long User.java   /raml-parser/src/test/java/org/raml/tagresolver line 35 Java Problem
TupleBuilder is a raw type. References to generic type TupleBuilder should be parameterized    DefaultTupleBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 60 Java Problem
NodeBuilder is a raw type. References to generic type NodeBuilder should be parameterized    TupleBuilder.java   /raml-parser/src/main/java/org/raml/parser/builder  line 32 Java Problem
Class is a raw type. References to generic type Class should be parameterized    ImplicitMapEntryRule.java   /raml-parser/src/main/java/org/raml/parser/rule line 37 Java Problem
Class is a raw type. References to generic type Class should be parameterized    ImplicitMapEntryRule.java   /raml-parser/src/main/java/org/raml/parser/rule line 34 Java Problem
Class is a raw type. References to generic type Class should be parameterized    ImplicitMapEntryRule.java   /raml-parser/src/main/java/org/raml/parser/rule line 71 Java Problem
HashSet is a raw type. References to generic type HashSet should be parameterized    TemplateResolver.java   /raml-parser/src/main/java/org/raml/parser/visitor  line 702    Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  NodeRuleFactory.java    /raml-parser/src/main/java/org/raml/parser/rule line 231    Java Problem
Type safety: The expression of type ArrayList needs unchecked conversion to conform to List  TemplateResolver.java   /raml-parser/src/main/java/org/raml/parser/visitor  line 679    Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  NodeRuleFactory.java    /raml-parser/src/main/java/org/raml/parser/rule line 191    Java Problem
Enum is a raw type. References to generic type Enum should be parameterized  NodeRuleFactory.java    /raml-parser/src/main/java/org/raml/parser/rule line 166    Java Problem
ArrayList is a raw type. References to generic type ArrayList should be parameterized    TemplateResolver.java   /raml-parser/src/main/java/org/raml/parser/visitor  line 679    Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  NodeRuleFactory.java    /raml-parser/src/main/java/org/raml/parser/rule line 229    Java Problem
Set is a raw type. References to generic type Set should be parameterized    TemplateResolver.java   /raml-parser/src/main/java/org/raml/parser/visitor  line 691    Java Problem
Type safety: The constructor HashSet(Collection) belongs to the raw type HashSet. References to generic type HashSet should be parameterized TemplateResolver.java   /raml-parser/src/main/java/org/raml/parser/visitor  line 702    Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  NodeRuleFactory.java    /raml-parser/src/main/java/org/raml/parser/rule line 191    Java Problem
NodeBuilder is a raw type. References to generic type NodeBuilder should be parameterized    PojoTupleBuilder.java   /raml-parser/src/main/java/org/raml/parser/builder  line 54 Java Problem
The import org.raml.model.parameter.QueryParameter is never used    ParameterEmptyTestCase.java /raml-parser/src/test/java/org/raml/parser/builder  line 35 Java Problem
The import org.junit.Assert is never used   ParameterEmptyTestCase.java /raml-parser/src/test/java/org/raml/parser/builder  line 30 Java Problem
Type safety: The constructor ArrayList(Collection) belongs to the raw type ArrayList. References to generic type ArrayList should be parameterized   TemplateResolver.java   /raml-parser/src/main/java/org/raml/parser/visitor  line 679    Java Problem
The import org.raml.parser.rule.ValidationMessage is never used BaseURIRuleTestCase.java    /raml-parser/src/test/java/org/raml/parser/rules    line 28 Java Problem
Class is a raw type. References to generic type Class should be parameterized    MapTupleBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 67 Java Problem
TupleBuilder is a raw type. References to generic type TupleBuilder should be parameterized    MapTupleBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 46 Java Problem
Class is a raw type. References to generic type Class should be parameterized    MapTupleBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 30 Java Problem
The import org.raml.model.ParamType.BOOLEAN is never used   ParameterEmptyTestCase.java /raml-parser/src/test/java/org/raml/parser/builder  line 22 Java Problem
The import org.raml.model.ActionType.GET is never used  ParameterEmptyTestCase.java /raml-parser/src/test/java/org/raml/parser/builder  line 20 Java Problem
The import org.raml.model.ParamType.INTEGER is never used   ParameterEmptyTestCase.java /raml-parser/src/test/java/org/raml/parser/builder  line 24 Java Problem
The import org.raml.model.ParamType.DATE is never used  ParameterEmptyTestCase.java /raml-parser/src/test/java/org/raml/parser/builder  line 23 Java Problem
The import org.raml.model.ParamType.STRING is never used    ParameterEmptyTestCase.java /raml-parser/src/test/java/org/raml/parser/builder  line 26 Java Problem
The import org.raml.model.ParamType.NUMBER is never used    ParameterEmptyTestCase.java /raml-parser/src/test/java/org/raml/parser/builder  line 25 Java Problem
DefaultTupleRule is a raw type. References to generic type DefaultTupleRule should be parameterized    SequenceTupleNullsAllowedRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 22 Java Problem
Type safety: Unchecked cast from Class to Class    TupleBuilderFactory.java    /raml-parser/src/main/java/org/raml/parser/builder  line 172    Java Problem
Enum is a raw type. References to generic type Enum should be parameterized  TupleBuilderFactory.java    /raml-parser/src/main/java/org/raml/parser/builder  line 172    Java Problem
Class is a raw type. References to generic type Class should be parameterized    TupleBuilderFactory.java    /raml-parser/src/main/java/org/raml/parser/builder  line 151    Java Problem
Class is a raw type. References to generic type Class should be parameterized    TupleBuilderFactory.java    /raml-parser/src/main/java/org/raml/parser/builder  line 155    Java Problem
TupleBuilder is a raw type. References to generic type TupleBuilder should be parameterized    TupleBuilderFactory.java    /raml-parser/src/main/java/org/raml/parser/builder  line 38 Java Problem
NodeBuilder is a raw type. References to generic type NodeBuilder should be parameterized    TemplateBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 93 Java Problem
Type safety: The method setNestedBuilders(Map) belongs to the raw type TupleBuilder. References to generic type TupleBuilder should be parameterized   TupleBuilderFactory.java    /raml-parser/src/main/java/org/raml/parser/builder  line 76 Java Problem
ArrayList is a raw type. References to generic type ArrayList should be parameterized    TemplateBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 68 Java Problem
TupleBuilder is a raw type. References to generic type TupleBuilder should be parameterized    Sequence.java   /raml-parser/src/main/java/org/raml/parser/annotation   line 33 Java Problem
TupleRule is a raw type. References to generic type TupleRule should be parameterized  Sequence.java   /raml-parser/src/main/java/org/raml/parser/annotation   line 31 Java Problem
Class is a raw type. References to generic type Class should be parameterized    MapTupleRule.java   /raml-parser/src/main/java/org/raml/parser/rule line 34 Java Problem
DefaultTupleRule is a raw type. References to generic type DefaultTupleRule should be parameterized    RamlDocumentValidator.java  /raml-parser/src/main/java/org/raml/parser/visitor  line 89 Java Problem
DefaultTupleRule is a raw type. References to generic type DefaultTupleRule should be parameterized    RamlDocumentValidator.java  /raml-parser/src/main/java/org/raml/parser/visitor  line 100    Java Problem
DefaultTupleRule is a raw type. References to generic type DefaultTupleRule should be parameterized    RamlDocumentValidator.java  /raml-parser/src/main/java/org/raml/parser/visitor  line 98 Java Problem
Class is a raw type. References to generic type Class should be parameterized    MapTupleRule.java   /raml-parser/src/main/java/org/raml/parser/rule line 38 Java Problem
DefaultTupleRule is a raw type. References to generic type DefaultTupleRule should be parameterized    MapTupleRule.java   /raml-parser/src/main/java/org/raml/parser/rule line 69 Java Problem
NodeBuilder is a raw type. References to generic type NodeBuilder should be parameterized    NodeBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 43 Java Problem
Class is a raw type. References to generic type Class should be parameterized    MapTupleRule.java   /raml-parser/src/main/java/org/raml/parser/rule line 74 Java Problem
Class is a raw type. References to generic type Class should be parameterized    MapTupleRule.java   /raml-parser/src/main/java/org/raml/parser/rule line 87 Java Problem
Class is a raw type. References to generic type Class should be parameterized    RamlDocumentValidator.java  /raml-parser/src/main/java/org/raml/parser/visitor  line 111    Java Problem
Class is a raw type. References to generic type Class should be parameterized    RamlDocumentValidator.java  /raml-parser/src/main/java/org/raml/parser/visitor  line 129    Java Problem
TupleBuilder is a raw type. References to generic type TupleBuilder should be parameterized    MapWithListValueTupleBuilder.java   /raml-parser/src/main/java/org/raml/parser/builder  line 39 Java Problem
Class is a raw type. References to generic type Class should be parameterized    SequenceTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 54 Java Problem
DefaultTupleRule is a raw type. References to generic type DefaultTupleRule should be parameterized    SequenceTupleRule.java  /raml-parser/src/main/java/org/raml/parser/rule line 73 Java Problem
The method getExplicitRoot() from the type DumperOptions is deprecated  YamlDocumentBuilder.java    /raml-parser/src/main/java/org/raml/parser/visitor  line 293    Java Problem
NodeBuilder is a raw type. References to generic type NodeBuilder should be parameterized    YamlDocumentBuilder.java    /raml-parser/src/main/java/org/raml/parser/visitor  line 158    Java Problem
Type safety: Unchecked cast from NodeBuilder to TupleBuilder YamlDocumentBuilder.java    /raml-parser/src/main/java/org/raml/parser/visitor  line 133    Java Problem
Class is a raw type. References to generic type Class should be parameterized    NodeRuleFactory.java    /raml-parser/src/main/java/org/raml/parser/rule line 162    Java Problem
Type safety: Unchecked cast from Class to Class    NodeRuleFactory.java    /raml-parser/src/main/java/org/raml/parser/rule line 166    Java Problem
Type safety: The method put(Object, Object) belongs to the raw type Map. References to generic type Map should be parameterized    ImplicitMapEntryBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 66 Java Problem
Class is a raw type. References to generic type Class should be parameterized    NodeRuleFactory.java    /raml-parser/src/main/java/org/raml/parser/rule line 158    Java Problem
NodeBuilder is a raw type. References to generic type NodeBuilder should be parameterized    ImplicitMapEntryBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 47 Java Problem
Class is a raw type. References to generic type Class should be parameterized    ImplicitMapEntryBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 35 Java Problem
Map is a raw type. References to generic type Map should be parameterized  ImplicitMapEntryBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 63 Java Problem
Map is a raw type. References to generic type Map should be parameterized  ImplicitMapEntryBuilder.java    /raml-parser/src/main/java/org/raml/parser/builder  line 60 Java Problem

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

Store min/max values in BigDecimal

Currently min/max constraints are stored in Double, which is prone to rounding errors. Use BigDecimal especially knowing that both decimal and integer values are allowed in min/max, which makes Double even less fitted...

RamlEmitter puts quotas around resource path and schema elements

I am using the raml-java-parser to build a RAML document from a WSDL and a WADL. I was planning on using the RAMLEmitter to print out the new document to a file.

Currently the RAMLEmitter puts "quotas" around the Schemas element and the resource path elements.

For example post-sale shouldn't have quotes:
schemas:
-
"post-sale": |
{

Resource Path example:

"/sales":
type: "collection"
post:

Am I abusing the parser and RAMLEmitter or is this a bug?

Nullpointer exception while invoking the RamlDocumentBuilder build method.

Hi,

I have cloned your repo and built an jar using mvn. And then I tried to use it in my java project, where I have this little code:

import org.raml.parser.visitor.RamlDocumentBuilder;

/**
 * Created by anto_belgin on 04/08/15.
 */
public class Raml {
    public static void main(String[] args) {
       new RamlDocumentBuilder().build("/Users/anto_belgin/Downloads/api.yaml");
    }
}

and the content of the api.yaml is :

#%RAML 0.8

---
title: Leagues API
version: v1
baseUri: http://localhost/api
documentation:
    - title: Employees
      content: |
        Welcome to the _Employees API_ Documentation. The _Employees API_
        allows you to view a complete list of your employees. You may also
        add or delete employees to keep the list up to date.
    - title: Contact
      content: |
        If you need support, please contact [email protected].

(taken from your test case examples).

When I run the above java code, I get an error like this:

/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java -Didea.launcher.port=7536 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 14.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/htmlconverter.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Users/anto_belgin/programs/Java/raml-ip/out/production/raml-ip:/Users/anto_belgin/jars/groovy-custom/lib/ant-1.9.4.jar:/Users/anto_belgin/jars/groovy-custom/lib/ant-antlr-1.9.4.jar:/Users/anto_belgin/jars/groovy-custom/lib/ant-junit-1.9.4.jar:/Users/anto_belgin/jars/groovy-custom/lib/ant-launcher-1.9.4.jar:/Users/anto_belgin/jars/groovy-custom/lib/bsf-2.4.0.jar:/Users/anto_belgin/jars/groovy-custom/lib/commons-cli-1.2.jar:/Users/anto_belgin/jars/groovy-custom/lib/commons-logging-1.2.jar:/Users/anto_belgin/jars/groovy-custom/lib/gpars-1.2.1.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-ant-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-bsf-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-console-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-docgenerator-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-groovydoc-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-groovysh-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-jmx-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-json-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-jsr223-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-nio-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-servlet-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-sql-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-swing-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-templates-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-test-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-testng-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/groovy-xml-2.5.0-SNAPSHOT.jar:/Users/anto_belgin/jars/groovy-custom/lib/hamcrest-core-1.3.jar:/Users/anto_belgin/jars/groovy-custom/lib/ivy-2.4.0.jar:/Users/anto_belgin/jars/groovy-custom/lib/jansi-1.11.jar:/Users/anto_belgin/jars/groovy-custom/lib/jcommander-1.47.jar:/Users/anto_belgin/jars/groovy-custom/lib/jline-2.12.jar:/Users/anto_belgin/jars/groovy-custom/lib/jsp-api-2.0.jar:/Users/anto_belgin/jars/groovy-custom/lib/jsr166y-1.7.0.jar:/Users/anto_belgin/jars/groovy-custom/lib/junit-4.12.jar:/Users/anto_belgin/jars/groovy-custom/lib/multiverse-core-0.7.0.jar:/Users/anto_belgin/jars/groovy-custom/lib/openbeans-1.0.jar:/Users/anto_belgin/jars/groovy-custom/lib/qdox-1.12.1.jar:/Users/anto_belgin/jars/groovy-custom/lib/servlet-api-2.4.jar:/Users/anto_belgin/jars/groovy-custom/lib/testng-6.8.13.jar:/Users/anto_belgin/jars/groovy-custom/lib/xmlpull-1.1.3.1.jar:/Users/anto_belgin/jars/groovy-custom/lib/xstream-1.4.7.jar:/Users/anto_belgin/programs/Java/raml-ip/lib/raml-parser-0.9-SNAPSHOT.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain Raml
Exception in thread "main" java.lang.NullPointerException
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1792)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1769)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1744)
    at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:462)
    at org.raml.parser.utils.StreamUtils.reader(StreamUtils.java:45)
    at org.raml.parser.visitor.YamlDocumentBuilder.build(YamlDocumentBuilder.java:102)
    at org.raml.parser.visitor.YamlDocumentBuilder.build(YamlDocumentBuilder.java:78)
    at Raml.main(Raml.java:8)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

I wonder why its giving NPE. But however, I could able to validate the same yaml file using the same jar:

java -jar aml-parser-0.9-SNAPSHOT.jar api.yaml 

gives me:

Validation Results for api.yaml:
    OK.

Kindly let me know where I'm making mistake!

URI parameters are not extracted if not formally defined

Using sales-enablement-api.yaml as a test bed, with:

Resource simpleResource = raml.getResources().get("/presentations");

Then:

  • simpleResource.getResource("/{presentationId}").getUri() is correctly /presentations/{presentationId}
  • simpleResource.getResource("/{presentationId}").getUriParameters() is an empty map, while the presentationId URI parameter should have been extracted.

Also with full-config.yaml, the following is parsed with a {tagId} resource that has with an empty getUriParameters():

/tags:
    head: !!null
    /{tagId}:
        head: !!null

According to the spec:

If a URI parameter in a resource's relative URI is not explicitly described in a uriParameters property for that resource, it MUST still be treated as a URI parameter with defaults as specified in the Named Parameters section of this specification. Its type is "string", it is required, and its displayName is its name (i.e. without the surrounding curly brackets [{] and [}]).

So I'm expecting that getUriParameters() will return the inferred URI parameter definition using the specified default values.

log4j warnings

When using the parser as a maven dependency for a maven plugin I get the following warnings in logs:

log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.PropertyUtils).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

I am not sure if there is a clean way to resolve this issue if the parser is used as a plugin. I am also no expert on log4j, and could be wrong.

Upgrade to snakeyaml 1.14 please

Can you please upgrade to snakeyaml 1.14 or make raml-java-parser compatible with snakeyaml 1.14, as this is the latest stable release.

The latest Spring boot depends on snakeyaml 1.14, and i have to exclude it to be able to work with raml

Parser does not follow spec for relative includes

The parser does not load relative includes as per the RAML spec. Includes are not processed as being relative to the parent (including) file. RAML Include Spec Reference

This can cause "Include cannot be resolved xxxxx" errors when a relative path is used for includes.

The error can be reproduced by validating base.raml with a user.dir of /.

/raml/base.raml

#%RAML 0.8

---
title: include example
baseUri: http://example.com
version: v1
/resource: !include include/resource.raml

/raml/include/resource.raml

/anotherresource:
    get:
    post:
    put:

Cannot reference an XSD element to use

Hi,
When I declare an XML schema in an external file and that file has multiple elements and complex types declared I cannot choose which one to use. I would expect the below syntax to work (userElement being the element that I want to use):

schemas:
  - user-xml: !include schemas/user.xsd#/userElement

Kind regards,
Jeroen

Issue with parsing nested URI's

I am using the RAML Parser for Java, and validation fails on a nested URI that follows the spec. Can be reproduced using this RAML sample which is directly copied from the spec:

%RAML 0.8

title: Users API
version: 1
baseUri: https://{apiDomain}.someapi.com
/users:
displayName: retrieve all users
baseUriParameters:
apiDomain:
enum: [ "api" ]
/{userId}/image:
displayName: access users pictures
baseUriParameters:
apiDomain:
enum: [ "static" ]
get:
displayName: retrieve a user's picture
put:
displayName: update a user's picture
baseUriParameters:
apiDomain:
enum: [ "content-update" ]

The RAML validator gives an error on lines 15 and 17:
Unknown key: displayName

RamlEmitter renders the BigDecimal attributes for name parameters as float

Hi,
Using the RamlEmitter to render the RAML (for some reverse meta-model to RAML api scenario).
It occurred to me that the RamlEmitter if renders the Raml instance(org.raml.model.Raml) with given minimum, maximum values for some e.g header parameters renders them as floating point values

  minimum: 5.0
  maximum: 105.0

the whole raml example

#%RAML 0.8
title: "Content services API"
version: "v1"
baseUri: "https://hybris.ondemand.com/{version}/services/cs"
"/root1": 
    get: 
        headers: 
        ..
            "pattern": 
                description: "Some regexp patterm"
                type: string
                required: false
                repeat: false
                pattern: "(?:(?!\*/)[* _/+\\-])*"
                minLength: 5
                maxLength: 105
            "number1": 
                description: "Just showing ranges"
                type: integer
                required: false
                repeat: false
                minimum: 5.0
                maximum: 105.0
            "number2": 
                description: "Just showing ranges"
                type: number
                required: false
                repeat: false
                minimum: 5.0
                maximum: 105.0


This is not blocking anyhow parser - just a inconsistency comparing to raml spec document

https://github.com/raml-org/raml-spec/blob/master/raml-0.8.md

Byte Order Mark (BOM) not handled

Consider this:

#%RAML 0.8
title: BOM bombs
version: v1
schemas:
  - NotNice: !include NotASchema.json 
/test:
  get: 
    responses: 
      200:
        body: 
          application/json: 
            schema: NotNice

The binary view of NotASchema.json is shown below:

raml-bomissue

The validation code:

RamlValidationService svc = RamlValidationService.createDefault();
...
results = svc.validate(raml, location);

The error:

bomissueerror

Removing the BOM from the file fixes the problem.

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

!include not properly resolved when passed as a template variable

Please take a look at the last commit on this branch. It contains a test case that demonstrates what I think is a bug in the includes resolver.

https://github.com/pmbober/raml-java-parser/tree/pmbober/resource-type-example-include-bug

In short, I define a resource type which has an example whose value is passed from the actual type definition. If value passed in is a !include, the example resolves to the name of the include file instead of its contents.

It works, however, if I pass the file name and apply the !include in the template definition. But, this is not what I want to do since I want the ability to pass hard-coded values as well as file references.

Weird Illegal Argument Issue , Please help

I am trying to load a RAML string using
RamlDocumentBuilder ramlBuilder = new RamlDocumentBuilder();
Raml tr = ramlBuilder.build(s.getValue(), null);

On my MAC it works fine and able to load and return RAML object. But when I deploy it on Linux server it throws a illegal argument exception . What could be causing this issue ?

Is RamlDocumentBuilder Thread safe ?

Fix for relative include on windows

Please can you apply the following fix to ContextPath so that it works correctly with Windows paths.

private String getPartentPath()
{
    int idx = includeStack.peek().getIncludeName().lastIndexOf("/") + 1;
    int winIdx = includeStack.peek().getIncludeName().lastIndexOf("\\") + 1;
    if (winIdx > idx)
        idx = winIdx;

    return includeStack.peek().getIncludeName().substring(0, idx);
}

change dependency from commons-validator to commons-beanutils

commons-validator has several superfluous transient dependencies, e.g. xml-apis which can cause problems in some application servers.
The only reason for these dependencies is to use PropertyUtils. This class comes from commons-beanutils.

So it would be cleaner to just use commons-beanutils instead of commons-validator.

Error when parsing JSON schemas

Parsing the following JSON schema as a part of a RAML definition, produces the error:

-1 invalid JSON schema (image): Unexpected character ('i' (code 105)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

This is strange, because the schema validation by diverse JSON schema validators works just fine (http://jsonschemalint.com/, https://github.com/fge/json-schema-validator,...). And, also as in my other ticket, forwarded here by Konstantin from the RAML for JAX-RS team, the output is absolutely insufficient to find the root cause.

The schema:

{
  "$schema": "http://json-schema.org/draft-04/schema",
  "type": "object",
  "required": ["id", "location"],
  "properties": {
    "id": {
      "description": "The ID of the image",
      "type": "string"
    },
    "location": {
      "description": "Location of the image",
      "type": "string"
    }
  }
}

Validator main / main-class?

The first thing I used raml-java-parser for was to run validation; if that's a common use case, having a simple facade class with a main() that lets you invoke validation on a RAML file and see results might be worthwhile, so that each person who wants to do that doesn't have to write their own.

I'd be happy to contribute mine as a starting point. It's uber-simple, but it's still simpler than each person writing their own, and it'd be a starting point for enhancements.

If it turns out that this is the most common use case, it might even make sense to make something like this the Main-Class of the JAR file, although I don't feel like I have a strong sense that that's the most common use case yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.