Reputation: 668
I am having this warning:
Warning |The [addPeople] action accepts a parameter of type [org.codehaus.groovy.grails.web.json.JSONObject] which has not been marked with @Validateable. Data binding will still be applied to this command object but the instance will not be validateable.
def addPeople(JSONObject jsonsito) {
If I change JSONObject for def, the warning dissapear. I am sure the reference is a JSONObject. I am doing this to avoid future PermGem error.
Anyone can explain how can I mark with @Validateable this OBJ?
Thanks in advance.
Upvotes: 3
Views: 1524
Reputation: 27255
Anyone can explain how can I mark with @Validateable this OBJ?
You can't. The JSONObject
class is not part of your code so you don't get to make it @Validateable
.
When a controller action accepts a parameter at compile time Grails generates a bunch of code for you. In summary, the generated code does the following:
@Validateable
, then invoke .validate()
Step 4 is conditional and will only happen if the object is @Validateable
. In your case it won't be, which is fine. The warning is just letting you know that.
As a side note, the process described above is different if the parameter type is a domain class, String
, one of the 8 primitive types or one of the 8 type wrappers. What I described above is how the system behaves for all other types.
Upvotes: 6