-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix for #486, @JsonProperty not honored for property names
- Loading branch information
Showing
3 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
modules/swagger-core/src/test/scala/converter/JsonPropertyModelTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package converter | ||
|
||
import models._ | ||
|
||
import com.wordnik.swagger.converter._ | ||
|
||
import com.wordnik.swagger.core.util._ | ||
|
||
import java.util.Date | ||
|
||
import org.junit.runner.RunWith | ||
import org.scalatest.junit.JUnitRunner | ||
import org.scalatest.FlatSpec | ||
import org.scalatest.matchers.ShouldMatchers | ||
|
||
@RunWith(classOf[JUnitRunner]) | ||
class JsonPropertyModelTest extends FlatSpec with ShouldMatchers { | ||
val models = ModelConverters.readAll(classOf[ModelWithJsonProperty]) | ||
JsonSerializer.asJson(models) should be ("""[{"id":"ModelWithJsonProperty","properties":{"theCount":{"type":"integer","format":"int32"}}}]""") | ||
} |
15 changes: 15 additions & 0 deletions
15
modules/swagger-core/src/test/scala/converter/models/ModelWithJsonProperty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package converter.models; | ||
|
||
import com.fasterxml.jackson.annotation.*; | ||
public class ModelWithJsonProperty { | ||
@JsonProperty("theCount") | ||
private Integer count; | ||
|
||
public void setCount(Integer count) { | ||
this.count = count; | ||
} | ||
|
||
public Integer getCount() { | ||
return count; | ||
} | ||
} |