Skip to content

Commit 544edcd

Browse files
committed
#340 - Patch ALPS serialization property order
Side effect of upgrading Jackson appears to be arbitrary change in order of property serialization. This commit forces the order to match the spec and fixes the related test cases.
1 parent fda3f31 commit 544edcd

File tree

2 files changed

+5
-2
lines changed
  • src

2 files changed

+5
-2
lines changed

src/main/java/org/springframework/hateoas/alps/Alps.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import org.springframework.hateoas.alps.Doc.DocBuilder;
2525
import org.springframework.hateoas.alps.Ext.ExtBuilder;
2626

27+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
28+
2729
/**
2830
* An ALPS document.
2931
*
@@ -34,6 +36,7 @@
3436
*/
3537
@Value
3638
@Builder(builderMethodName = "alps")
39+
@JsonPropertyOrder({"version", "doc", "descriptors"})
3740
public class Alps {
3841

3942
private final String version = "1.0";

src/test/resources/org/springframework/hateoas/alps/reference.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"version" : "1.0",
23
"doc" : {
34
"href" : "http://example.org/samples/full/doc.html"
45
},
@@ -27,6 +28,5 @@
2728
"href" : "http://alps.io/ext/range",
2829
"value" : "summary,detail"
2930
}
30-
} ],
31-
"version" : "1.0"
31+
} ]
3232
}

0 commit comments

Comments
 (0)