Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Issue getting query parameters from resourceType #683

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2013 (c) MuleSoft, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
package org.raml.v2.api;

import org.junit.Test;
import org.raml.v2.api.model.v10.api.Api;
import org.raml.v2.api.model.v10.datamodel.IntegerTypeDeclaration;
import org.raml.v2.api.model.v10.datamodel.ObjectTypeDeclaration;
import org.raml.v2.api.model.v10.datamodel.TypeDeclaration;

import java.io.File;
import java.io.IOException;
import java.util.List;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

public class ResourceTypeTraitIssue
{

@Test
public void testApi() throws IOException
{
File input = new File("src/test/resources/org/raml/v2/issue/api.raml");
assertTrue(input.isFile());
RamlModelResult ramlModelResult = new RamlModelBuilder().buildApi(input);
assertFalse(ramlModelResult.hasErrors());
Api api = ramlModelResult.getApiV10();

assertEquals(2, api.resources().get(0).methods().get(0).queryParameters().size());
}


}
25 changes: 25 additions & 0 deletions raml-parser-2/src/test/resources/org/raml/v2/issue/api.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#%RAML 1.0
title: test-date-spec
version: v1
baseUri: http://localhost:8081

resourceTypes:
read:
get:

traits:
sercheable:
usage: Apply this trait to resources which supports datetime range searching
queryParameters:
dateFrom:
type: date-only
example: "2017-10-02"
required: false
dateTo:
type: date-only
example: "2018-10-02"
required: false

/testuri:
is: [sercheable]
type: read