Package org.raml.model

Examples of org.raml.model.MimeType


{

    @Test
    public void roundtrip()
    {
        MimeType mimeType = new MimeType();
        mimeType.setFormParameters(buildMap(Collections.singletonList(new FormParameter())));

        Action action = new Action();
        action.setBody(buildMap(mimeType));
        action.setResponses(buildMap(new Response()));
View Full Code Here


            Map<ActionType,Action> actionMap = resource.getActions();
            for (Action action : actionMap.values())
            {
                if (action.getBody() != null && action.getBody().isEmpty())
                {
                    action.getBody().put(mediaType, new MimeType(mediaType));
                }
                for (Response response : action.getResponses().values())
                {
                    if (response.getBody() != null && response.getBody().isEmpty())
                    {
                        response.getBody().put(mediaType, new MimeType(mediaType));
                    }
                }
            }
            setBodyDefaultMediaType(resource.getResources());
        }
View Full Code Here

        assertThat(pageQueryParam.getMinimum(), is(new BigDecimal(1)));

        //action body types
        assertThat(action.getBody().size(), is(3));
        String jsonMime = "application/json";
        MimeType jsonBody = action.getBody().get(jsonMime);
        assertThat(jsonBody.getType(), is(jsonMime));
        assertThat(jsonBody.getSchema(), containsString("\"input\": {"));
        assertThat(jsonBody.getExample(), is("{ \"input\": \"hola\" }"));

        String formMime = "multipart/form-data";
        MimeType formBody = action.getBody().get(formMime);
        assertThat(formBody.getType(), is(formMime));
        assertThat(formBody.getFormParameters().size(), is(2));
        List<FormParameter> form1Param = formBody.getFormParameters().get("form-1");
        assertThat(form1Param.get(0).getDisplayName(), is("form 1"));
        assertThat(form1Param.get(0).getDescription(), is("form 1 description"));
        assertThat(form1Param.get(0).getType(), is(NUMBER));
        assertThat(form1Param.get(0).isRequired(), is(true));
        assertThat(form1Param.get(0).getMinimum(), is(new BigDecimal("9.5")));
View Full Code Here

TOP

Related Classes of org.raml.model.MimeType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.