@@ -29,6 +29,7 @@ class SwaggerScalaModelConverter extends ModelResolver(SwaggerScalaModelConverte
2929 SwaggerScalaModelConverter
3030
3131 private val logger = LoggerFactory .getLogger(classOf [SwaggerScalaModelConverter ])
32+ private val VoidClass = classOf [Void ]
3233 private val EnumClass = classOf [scala.Enumeration ]
3334 private val OptionClass = classOf [scala.Option [_]]
3435 private val IterableClass = classOf [scala.collection.Iterable [_]]
@@ -79,20 +80,24 @@ class SwaggerScalaModelConverter extends ModelResolver(SwaggerScalaModelConverte
7980 val introspector = BeanIntrospector (cls)
8081 val erasedProperties = ErasureHelper .erasedOptionalPrimitives(cls)
8182 introspector.properties.foreach { property =>
82-
8383 val propertyClass = getPropertyClass(property)
8484 val isOptional = isOption(propertyClass)
85-
86- erasedProperties.get(property.name).foreach { erasedType =>
87- val primitiveType = PrimitiveType .fromType(erasedType)
88- if (primitiveType != null && isOptional) {
89- updateTypeOnSchema(schema, primitiveType, property.name)
90- }
91- if (primitiveType != null && isIterable(propertyClass) && ! isMap(propertyClass)) {
92- updateTypeOnItemsSchema(schema, primitiveType, property.name)
85+ val propertyAnnotations = getPropertyAnnotations(property)
86+ val schemaOverrideClass = propertyAnnotations.collectFirst {
87+ case s : SchemaAnnotation if s.implementation() != VoidClass => s.implementation()
88+ }
89+ if (schemaOverrideClass.isEmpty) {
90+ erasedProperties.get(property.name).foreach { erasedType =>
91+ val primitiveType = PrimitiveType .fromType(erasedType)
92+ if (primitiveType != null && isOptional) {
93+ updateTypeOnSchema(schema, primitiveType, property.name)
94+ }
95+ if (primitiveType != null && isIterable(propertyClass) && ! isMap(propertyClass)) {
96+ updateTypeOnItemsSchema(schema, primitiveType, property.name)
97+ }
9398 }
9499 }
95- getPropertyAnnotations(property) match {
100+ propertyAnnotations match {
96101 case Seq () => {
97102 if (isOptional && schema.getRequired != null && schema.getRequired.contains(property.name)) {
98103 schema.getRequired.remove(property.name)
0 commit comments