Skip to content

Commit

Permalink
Merge pull request Azure#821 from jianghaolu/moredev
Browse files Browse the repository at this point in the history
Fix recursive validation
  • Loading branch information
jianghaolu committed Mar 9, 2016
2 parents 1f13aa5 + d75ac2c commit 5071471
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ else if (TypeToken.of(Map.class).isAssignableFrom(propertyType)) {
Validator.validate(entry.getValue());
}
}
else if (parameter.getClass().getDeclaringClass() != propertyType) {
else if (parameterType != propertyType) {
Validator.validate(property);
}
} catch (IllegalArgumentException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
package com.microsoft.rest;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.node.TextNode;

import org.junit.Assert;
import org.joda.time.LocalDate;
import org.junit.Test;
Expand Down Expand Up @@ -130,6 +132,12 @@ public void validateObject() throws Exception {
Validator.validate(product);
}

@Test
public void validateRecursive() throws Exception {
TextNode textNode = new TextNode("\"\"");
Validator.validate(textNode);
}

public final class IntWrapper {
@JsonProperty(required = true)
// CHECKSTYLE IGNORE VisibilityModifier FOR NEXT 2 LINES
Expand Down

0 comments on commit 5071471

Please sign in to comment.