phoenixnap / springmvc-raml-plugin

Spring MVC - RAML Spec Synchroniser Plugin. A Maven plugin designed to Generate Server & Client code in Spring from a RAML API descriptor and conversely, a RAML API document from the SpringMVC Server implementation.
Apache License 2.0
136 stars 84 forks source link

@Valid not added to query parameters #193

Closed yuranos closed 6 years ago

yuranos commented 6 years ago

If I have a raml like:

    get:
      description: Get the booking details with `bookingRef = {bookingRef}`
      queryParameters:
        siteKey : SiteKey

A controller will not add @Valid to SiteKey method argument.

stojsavljevic commented 6 years ago

Hi @yuranos

So, you're sending complex object (SiteKey) as a request parameter? How does that look like?

@Valid annotation is added when object is submitted through request body. So, in your example that will be something like:

post:
   description: Get the booking details with `bookingRef = {bookingRef}`
   body: 
      application/json:
        type: SiteKey
yuranos commented 6 years ago

@stojsavljevic , Spring MVC just flattens it into a list of query params and does serialisation/deserialisation into a bean out of the box. I will check it and try to create a PR today.

stojsavljevic commented 6 years ago

I understand that Spring is able to map query params to a pojo. My point was that submitting object through query parms is not most logical thing to do. But I assume in some cases it might be useful. So lets proceed with your PR. Thanks!