@@ -524,6 +524,9 @@ public Paths getPaths(ObjectNode obj, String location, ParseResult result) {
524
524
if (!pathValue .getNodeType ().equals (JsonNodeType .OBJECT )) {
525
525
result .invalidType (location , pathName , "object" , pathValue );
526
526
} else {
527
+ if (!pathName .startsWith ("/" )){
528
+ result .warning (location ," Resource " +pathName + " should start with /" );
529
+ }
527
530
ObjectNode path = (ObjectNode ) pathValue ;
528
531
PathItem pathObj = getPathItem (path ,String .format ("%s.'%s'" , location ,pathName ), result );
529
532
paths .put (pathName , pathObj );
@@ -2682,6 +2685,7 @@ protected static class ParseResult {
2682
2685
private Map <Location , JsonNode > unsupported = new LinkedHashMap <>();
2683
2686
private Map <Location , String > invalidType = new LinkedHashMap <>();
2684
2687
private List <Location > missing = new ArrayList <>();
2688
+ private List <Location > warnings = new ArrayList <>();
2685
2689
private List <Location > unique = new ArrayList <>();
2686
2690
private List <Location > uniqueTags = new ArrayList <>();
2687
2691
@@ -2699,9 +2703,14 @@ public void extra(String location, String key, JsonNode value) {
2699
2703
public void missing (String location , String key ) {
2700
2704
missing .add (new Location (location , key ));
2701
2705
}
2702
-
2706
+
2707
+ public void warning (String location , String key ) {
2708
+ warnings .add (new Location (location , key ));
2709
+ }
2710
+
2703
2711
public void unique (String location , String key ) {
2704
2712
unique .add (new Location (location , key ));
2713
+
2705
2714
}
2706
2715
2707
2716
public void uniqueTags (String location , String key ) {uniqueTags .add (new Location (location ,key ));}
@@ -2735,6 +2744,11 @@ public List<String> getMessages() {
2735
2744
String message = "attribute " + location + l .key + " is missing" ;
2736
2745
messages .add (message );
2737
2746
}
2747
+ for (Location l : warnings ) {
2748
+ String location = l .location .equals ("" ) ? "" : l .location + "." ;
2749
+ String message = "attribute " + location +l .key ;
2750
+ messages .add (message );
2751
+ }
2738
2752
for (Location l : unsupported .keySet ()) {
2739
2753
String location = l .location .equals ("" ) ? "" : l .location + "." ;
2740
2754
String message = "attribute " + location + l .key + " is unsupported" ;
0 commit comments