File tree Expand file tree Collapse file tree 3 files changed +53
-9
lines changed
main/java/io/zenwave360/jsonrefparser
java/io/zenwave360/jsonrefparser Expand file tree Collapse file tree 3 files changed +53
-9
lines changed Original file line number Diff line number Diff line change @@ -139,13 +139,13 @@ public class $RefParser {
139139 }
140140
141141 private void mergeAllOf (Object value , String [] paths , URI currentFileURL ) {
142- var visitedNodeRef = String .format ("%s%s" , currentFileURL .toString (), jsonPointer (paths ));
143- log .trace ("{}visiting {}" , indent (), visitedNodeRef );
144- if (visited .contains (value )) {
145- log .trace ("{}skipping visited {}" , indent (), visitedNodeRef );
146- return ;
147- }
148- visited .add (value );
142+ // var visitedNodeRef = String.format("%s%s", currentFileURL.toString(), jsonPointer(paths));
143+ // log.trace("{}visiting {}", indent(), visitedNodeRef);
144+ // if(visited.contains(value)) {
145+ // log.trace("{}skipping visited {}", indent(), visitedNodeRef);
146+ // return;
147+ // }
148+ // visited.add(value);
149149 if (paths .length > 0 && "allOf" .equals (paths [paths .length -1 ])) {
150150 List allOf = (List ) value ;
151151 List <String > required = new ArrayList <>();
Original file line number Diff line number Diff line change @@ -36,6 +36,15 @@ private void assertNoRefs(Object object) throws JsonProcessingException {
3636 Assert .assertFalse (hasRefs );
3737 }
3838
39+ private void assertNoAllOfs (Object object ) throws JsonProcessingException {
40+ String json = mapper .writerWithDefaultPrettyPrinter ().writeValueAsString (object );
41+ boolean hasRefs = json .contains ("allOf" );
42+ if (hasRefs ) {
43+ System .out .println (json );
44+ }
45+ Assert .assertFalse (hasRefs );
46+ }
47+
3948 @ Test
4049 public void testDereferenceAsyncapiNestedSchemas () throws IOException {
4150 File file = new File ("src/test/resources/asyncapi/schemas/json-schemas-payload.yml" );
@@ -272,12 +281,14 @@ public void testDereferenceRecursiveSimplest() throws IOException {
272281 }
273282
274283 @ Test
284+ @ Ignore
275285 public void testMergeAllOfRecursive () throws IOException {
276286 File file = new File ("src/test/resources/asyncapi/orders-model.yml" );
277287 $RefParser parser = new $RefParser (file ).parse ();
278288 $Refs refs = parser .dereference ().mergeAllOf ().getRefs ();
279- // System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(refs.schema()));
280- // assertNoRefs(refs.schema());
289+ System .out .println (mapper .writerWithDefaultPrettyPrinter ().writeValueAsString (refs .schema ()));
290+ assertNoRefs (refs .schema ());
291+ assertNoAllOfs (refs .schema ());
281292 }
282293
283294 @ Test
Original file line number Diff line number Diff line change @@ -18,3 +18,36 @@ components:
1818 type : " array"
1919 items :
2020 $ref : " #/components/schemas/CustomerOrder"
21+ CustomerOrderPaginated :
22+ allOf :
23+ - $ref : " #/components/schemas/Page"
24+ - x-business-entity-paginated : " CustomerOrder"
25+ - properties :
26+ content :
27+ type : " array"
28+ items :
29+ $ref : " #/components/schemas/CustomerOrder"
30+ Page :
31+ type : object
32+ required :
33+ - " content"
34+ - " totalElements"
35+ - " totalPages"
36+ - " size"
37+ - " number"
38+ properties :
39+ number :
40+ type : integer
41+ minimum : 0
42+ numberOfElements :
43+ type : integer
44+ minimum : 0
45+ size :
46+ type : integer
47+ minimum : 0
48+ maximum : 200
49+ multipleOf : 25
50+ totalElements :
51+ type : integer
52+ totalPages :
53+ type : integer
You can’t perform that action at this time.
0 commit comments