c

sttp.apispec.validation

SchemaComparator

class SchemaComparator extends AnyRef

Utility for comparing schemas for compatibility. See compare for more details.

Since this class contains a cache of comparison results, it is meant to be reused between multiple schema comparisons.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SchemaComparator
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SchemaComparator(writerNamedSchemas: Map[String, Schema], readerNamedSchemas: Map[String, Schema])
  2. new SchemaComparator(writerSchemaResolver: SchemaResolver, readerSchemaResolver: SchemaResolver)

    writerSchemaResolver

    can resolve named schemas which may be referred to by the writer schema

    readerSchemaResolver

    can resolve named schemas which may be referred to by the reader schema

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  6. def compare(writerSchema: SchemaLike, readerSchema: SchemaLike): List[SchemaCompatibilityIssue]

    Compares two schemas for compatibility.

    Compares two schemas for compatibility. More precisely, checks if data that is valid according to writerSchema is also valid according to readerSchema. If not, a list of compatibility issues is returned.

    Determining compatibility (or incompatibility) of arbitrary schemas with certainty is non-trivial, or outright impossible in general. For this reason, this method works in a "best effort" manner, assuming that the schemas match one of the typical schema patterns generated by libraries like tapir. In more complex situations, the comparator simply falls back to comparing schemas by plain equality, or returns a GeneralSchemaMismatch, which indicates comparator's inability to definitely determine compatibility or incompatibility of the schemas.

    In practice, the comparator is designed to detect typical changes that may appear in schemas during API evolution, e.g. adding new fields, changing types, etc.

    Before being compared, all schemas are stripped of keywords which do not affect the comparison, e.g. annotations like title, description, etc.

    writerSchema

    schema of the data being written

    readerSchema

    schema of the data being read

    returns

    a list of incompatibilities between the schemas

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  19. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped