raml-java-parser
raml-java-parser copied to clipboard
Should inner object properties be disallowed for form params ?
Affects: 1.0.0
Issue
It is currently possible to describe web forms with nested properties (e.g. the form defining a parameter org that itself has a name and an address). I'm wondering if the parser should prevent it or add additional information to know how the values of the nested property should be serialized in the payload.
How to reproduce
RAML file
#%RAML 1.0
title: My API
/resource:
put:
body:
multipart/form-data:
properties:
objectProperty:
properties:
innerStringProperty: string
innerIntegerProperty: integer
stringProperty: string
Java file
package com.restlet.definitions.raml10.reader;
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-119