raml-org / raml-java-parser

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

Parsing error when a RAML has an attribute (uriParameter, data type, property, ...) name which only contains digits #426

Open guiblondeau opened 7 years ago

guiblondeau commented 7 years ago

Issue

When I import a RAML with an attribute (uriParameter, data type, property, ...) name which only contains digits, parsing fails.

Stack trace

java.lang.ClassCastException: org.raml.yagi.framework.nodes.snakeyaml.SYIntegerNode cannot be cast to org.raml.yagi.framework.nodes.StringNode
    at org.raml.v2.internal.impl.commons.nodes.PropertyUtils.getName(PropertyUtils.java:28)
    at org.raml.v2.internal.impl.v10.nodes.PropertyNode.getName(PropertyNode.java:40)
    at org.raml.v2.internal.impl.v10.type.ObjectResolvedType.overwriteFacets(ObjectResolvedType.java:143)
    at org.raml.v2.internal.impl.commons.nodes.TypeDeclarationNode.resolveTypeDefinition(TypeDeclarationNode.java:99)
    at org.raml.v2.internal.impl.commons.nodes.TypeDeclarationNode.getResolvedType(TypeDeclarationNode.java:85)
    at org.raml.v2.internal.impl.v10.type.ObjectResolvedType.validateCanOverwriteWith(ObjectResolvedType.java:209)
    at org.raml.v2.internal.impl.commons.nodes.TypeDeclarationNode.validateCanOverwrite(TypeDeclarationNode.java:143)
    at org.raml.v2.internal.impl.commons.phase.TypeValidationPhase.apply(TypeValidationPhase.java:48)
    at org.raml.v2.internal.impl.v10.Raml10Builder.runPhases(Raml10Builder.java:114)
    at org.raml.v2.internal.impl.v10.Raml10Builder.build(Raml10Builder.java:93)
    at org.raml.v2.internal.impl.RamlBuilder.build(RamlBuilder.java:117)
    at org.raml.v2.internal.impl.RamlBuilder.build(RamlBuilder.java:99)
    at org.raml.v2.api.RamlModelBuilder.buildApi(RamlModelBuilder.java:125)
    at org.raml.v2.api.RamlModelBuilder.buildApi(RamlModelBuilder.java:104)

Example

Here's an example of a failing RAML (it contains a uriParameter with digits):

#%RAML 1.0
title: "Untitled"
description: "No description"
version: "1.0.0"
mediaType:
- "application/json"
/test/{123}:
  uriParameters:
    123:
      type: "string"

To reproduce the issue, just run new RamlModelBuilder().buildApi(ramlExampleFile);

Version used

We currently use version 1.0.13 of the raml-java-parser (but it seems that the bug has not been fixed between version 1.0.13 and version 1.0.15)

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

jplegoff commented 6 years ago

Hi

Do you have any update on this issue?

Thanks