SchemaReflectionAdapter

An adapter used by ReflectionJsonSchemaInference to customize how Kotlin types and properties are mapped to OpenAPI schema components.

This interface allows overriding the default reflection behavior, such as changing property names, filtering ignored fields, or handling specific nullability rules.

Report a problem

Functions

Link copied to clipboard
open fun getName(property: KProperty1<*, *>): String

Returns the schema property name for the given property. By default, returns the Kotlin property name.

open fun getName(type: KType): String?

Provides a name for the given type to be used as a title in the JSON schema. By default, returns the qualified name for non-generic classes.

Link copied to clipboard
open fun <T : Any> getProperties(kClass: KClass<T>): Collection<KProperty1<T, *>>

Returns the collection of properties for a given kClass that should be included in the schema. By default, returns all member properties.

Link copied to clipboard
open fun isIgnored(property: KProperty1<*, *>): Boolean

Determines if the given property should be excluded from the generated schema. By default, ignores properties annotated with JsonSchema.Ignore.

Link copied to clipboard
open fun isNullable(type: KType): Boolean

Determines if the given type should be marked as nullable in the OpenAPI schema.