raml-java-parser icon indicating copy to clipboard operation
raml-java-parser copied to clipboard

Two URI parameters with the same name on a single resource path

Open quilicicf opened this issue 9 years ago • 0 comments

Affects: 1.0.0

Issue

When defining URI parameters in nested resources, one can use the same name for a URI parameter in the parent resource and the child resource.

That's not that bad when working only with RAML but when importing RAML into other applications, having the same name for two parameters on the same resource can cause problems.

I'm wondering if the parser could enforce a rule to prevent this ?

How to reproduce

RAML file

#%RAML 1.0
title: Resources with query parameters
/parent/{param}:
  uriParameters:
    param: integer

  /child/{param}:
    uriParameters:
      param: string

Java file

package com.restlet.definitions.raml10.reader;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.raml.v2.api.RamlModelBuilder;
import org.raml.v2.api.RamlModelResult;
import org.raml.v2.api.model.v10.api.Api;

import static org.junit.Assert.fail;

public class Test {

    @org.junit.Test
    public void test() throws Exception {
        String savedRamlLocation = Test.class.getResource("fileName").toString();
        RamlModelResult ramlModelResult = new RamlModelBuilder().buildApi(savedRamlLocation);
        if (ramlModelResult.hasErrors()) {
            return;
        }

        fail("Should not pass parser validation");
    }
}

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

quilicicf avatar Aug 19 '16 08:08 quilicicf