Skip to content

Commit adf8ddd

Browse files
authored
Merge pull request #2358 from frantuma/task-2312
ref #2312 - requiredProperties and `not` support
2 parents c864f1b + f5d2778 commit adf8ddd

File tree

3 files changed

+261
-251
lines changed

3 files changed

+261
-251
lines changed

modules/swagger-core/src/main/java/io/swagger/jackson/ModelResolver.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,14 @@ else if(PrimitiveType.fromType(type) != null) {
632632
}
633633
Class<?> not = schemaAnnotation.not();
634634
if (!Void.class.equals(not)) {
635-
model.not((new Schema().$ref(context.resolve(not.getClass()).getName())));
635+
model.not((new Schema().$ref(context.resolve(not).getName())));
636+
}
637+
if (schemaAnnotation.requiredProperties() != null &&
638+
schemaAnnotation.requiredProperties().length > 0 &&
639+
StringUtils.isNotBlank(schemaAnnotation.requiredProperties()[0])) {
640+
for (String prop: schemaAnnotation.requiredProperties()) {
641+
model.addRequiredItem(prop);
642+
}
636643
}
637644
}
638645

0 commit comments

Comments
 (0)