Skip to content

Commit

Permalink
Some documentation for why SchemaLike with Anyschema exists.
Browse files Browse the repository at this point in the history
Added to make sure we need to check as little as possible for validation purposes.
  • Loading branch information
hamnis committed Oct 10, 2022
1 parent 379af18 commit c623062
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apispec-model/src/main/scala/sttp/apispec/Schema.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package sttp.apispec

import scala.collection.immutable.ListMap

/** Algebraic data type for all possible schemas
*/
sealed trait SchemaLike

sealed trait AnySchema extends SchemaLike
Expand All @@ -13,7 +15,13 @@ object AnySchema {
case object Boolean extends Encoding
}

/** Json schema can be represented by the values `true` or `{}` ( empty object). This represents any json value.
*/
case object Anything extends AnySchema

/** Json schema can be represented by the values `false` or `{"not": {}}` (object with a single property "not" which
* has a single value with must be the empty object" This represents no json value.
*/
case object Nothing extends AnySchema
}

Expand Down

0 comments on commit c623062

Please sign in to comment.