Skip to content

Commit

Permalink
Support binary input body params and binary response - use format "bi…
Browse files Browse the repository at this point in the history
…nary" in swagger file
  • Loading branch information
b_sapir authored and b_sapir committed Aug 6, 2015
1 parent 3fee1a0 commit a18409e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ModelSerializerTest extends FlatSpec with Matchers {
}

it should "deserialize a model" in {
val json = """{"required":["intValue"],"properties":{"dateValue":{"type":"string","format":"date"},"longValue":{"type":"integer","format":"int64"},"dateTimeValue":{"type":"string","format":"date-time"},"intValue":{"type":"integer","format":"int32"},"byteArrayValue":{"type":"string","format":"byte"}}}"""
val json = """{"required":["intValue"],"properties":{"dateValue":{"type":"string","format":"date"},"longValue":{"type":"integer","format":"int64"},"dateTimeValue":{"type":"string","format":"date-time"},"intValue":{"type":"integer","format":"int32"},"byteArrayValue":{"type":"string","format":"binary"}}}"""

val p = m.readValue(json, classOf[Model])
m.writeValueAsString(p) should equal(json)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ public class ByteArrayProperty extends AbstractProperty implements Property {

public ByteArrayProperty() {
super.type = "string";
super.format = "byte";
super.format = "binary";
}

public static boolean isType(String type, String format) {
if("string".equals(type) && "byte".equals(format))
if("string".equals(type) && "binary".equals(format))
return true;
else return false;
}
Expand Down

0 comments on commit a18409e

Please sign in to comment.