@@ -117,7 +117,7 @@ import org.springframework.http.ResponseEntity;
117117""" )
118118 }
119119
120- void " writes RequestParam import" () {
120+ void " writes @ RequestParam import" () {
121121 def apiItf = new Interface (name : ' name' , endpoints : [
122122 new Endpoint (path : ' path' , method : HttpMethod . GET , responses : [new EmptyResponse ()],
123123 parameters : [
@@ -135,7 +135,7 @@ import org.springframework.web.bind.annotation.RequestParam;
135135""" )
136136 }
137137
138- void " does not write @RequestParam annotation import of request parameter that does not want the annotation" () {
138+ void " does not write @RequestParam annotation import of parameter that does not want the annotation" () {
139139 def endpoint = new Endpoint (path : ' /foo' , method : HttpMethod . GET , responses : [
140140 new Response (contentType : ' application/json' , responseType : new NoneDataType ())
141141 ], parameters : [
@@ -159,6 +159,30 @@ import org.springframework.web.bind.annotation.RequestParam;
159159""" )
160160 }
161161
162+ void " writes import of request parameter data type" () {
163+ def endpoint = new Endpoint (path : ' /foo' , method : HttpMethod . GET , responses : [
164+ new Response (contentType : ' application/json' , responseType : new NoneDataType ())
165+ ], parameters : [
166+ new QueryParameter (name : ' foo' , required : false , dataType : new ObjectDataType (
167+ pkg : ' model' , type : ' Foo' , properties : [
168+ foo1 : new StringDataType (),
169+ foo2 : new StringDataType ()
170+ ]
171+ ))
172+ ])
173+
174+ def apiItf = new Interface (name : ' name' , endpoints : [endpoint])
175+
176+ when :
177+ writer. write (target, apiItf)
178+
179+ then :
180+ def result = extractImports (target. toString ())
181+ result. contains(""" \
182+ import model.Foo;
183+ """ )
184+ }
185+
162186 void " writes model import" () {
163187 def pkg = ' model.package'
164188 def type = ' Model'
0 commit comments