@@ -91,6 +91,7 @@ public void visit(@Nonnull OpenApiSpecification spec) {
91
91
.flatMap (Optional ::stream )
92
92
.map (Map ::values )
93
93
.flatMap (Collection ::stream )
94
+ .filter (o -> o .getDeprecation ().map (d -> d .getVersion ().isGreaterThan (Versions .V1_0_0 )).orElse (true ))
94
95
.forEach (operation -> {
95
96
var group = operation .getOperationGroup ();
96
97
if (!matcher .matches (group )) {
@@ -608,6 +609,9 @@ private void visitInto(OpenApiSchema schema, EnumShape shape) {
608
609
} else if (schema .hasConst ()) {
609
610
var value = (String ) schema .getConst ().orElseThrow ();
610
611
shape .addVariant (title .orElse (value ), value , schema .getDescription ().orElse (null ), isDeprecated );
612
+ } else if (schema .isBoolean ()) {
613
+ shape .addVariant (title .orElse ("true" ), "true" , schema .getDescription ().orElse (null ), isDeprecated );
614
+ shape .addVariant (title .orElse ("false" ), "false" , schema .getDescription ().orElse (null ), isDeprecated );
611
615
}
612
616
}
613
617
@@ -843,7 +847,18 @@ private static boolean isEnum(OpenApiSchema schema) {
843
847
return schema .hasEnums () || schema .hasConst ();
844
848
}
845
849
if (schema .getOneOf ().isPresent ()) {
846
- return schema .getOneOf ().get ().stream ().allMatch (SpecTransformer ::isEnum );
850
+ var enumCount = 0 ;
851
+ var booleanCount = 0 ;
852
+ var totalCount = 0 ;
853
+ for (var s : schema .getOneOf ().orElseThrow ()) {
854
+ if (s .isBoolean ()) {
855
+ booleanCount ++;
856
+ } else if (isEnum (s )) {
857
+ enumCount ++;
858
+ }
859
+ totalCount ++;
860
+ }
861
+ return enumCount == totalCount || (booleanCount == 1 && enumCount == totalCount - 1 );
847
862
}
848
863
return false ;
849
864
}
0 commit comments