SerialSchemaIgnore

annotation class SerialSchemaIgnore(source)

Excludes the annotated @Serializable class from schema generation.

Unlike @SchemaIgnore, this annotation carries @SerialInfo so it is preserved in SerialDescriptor and is automatically recognized by the serialization-based schema generator.

When applied to a sealed subtype, the subtype is omitted from the parent's polymorphic oneOf schema. The class remains fully functional at runtime — only schema generation is affected.

Example:

@Serializable
sealed class Event {
@Serializable
data class Click(val x: Int, val y: Int) : Event()

@Serializable
@SerialSchemaIgnore
data class Internal(val trace: String) : Event()
}

See also