Closed Wicpar closed 4 years ago
Added support for transforming and validating annotations during serialization.
Currently Supported: @LowerCase applies .toLowerCase on String @Trim applies .trim on String
New validators can be added by declaring a new openapi module in the search path:
in the config:
install(OpenAPIGen) { ... scanPackagesForModules = arrayOf("com.example") }
in com.example.TestValidator
com.example.TestValidator
@Retention(AnnotationRetention.RUNTIME) @Target(AnnotationTarget.PROPERTY) annotation class TestAnnot object AnyValidator : AValidator<Any, TestAnnot>(Any::class, TestAnnot::class) { override fun validate(subject: Any?, annotation: TestAnnot): Any? { println(subject) // return transformed object or throw exceptions that you will handle with the route exception handlers return subject } }
Added support for transforming and validating annotations during serialization.
Currently Supported: @LowerCase applies .toLowerCase on String @Trim applies .trim on String
New validators can be added by declaring a new openapi module in the search path:
in the config:
in
com.example.TestValidator