JsonSchemas
An interpreter for endpoints4s.algebra.JsonSchemas that produces Play JSON play.api.libs.json.Reads
and play.api.libs.json.Writes
.
Type members
Classlikes
Inherited classlikes
Extension methods for values of type F[A]
for which there is an implicit
InvariantFunctor[F]
instance.
Extension methods for values of type F[A]
for which there is an implicit
InvariantFunctor[F]
instance.
- Inherited from:
- InvariantFunctorSyntax
Documentation related methods for annotating schemas. Encoder and decoder interpreters ignore this information.
Documentation related methods for annotating schemas. Encoder and decoder interpreters ignore this information.
- Inherited from:
- JsonSchemas
Implicit methods for values of type JsonSchema
Implicit methods for values of type JsonSchema
- Inherited from:
- JsonSchemas
- Inherited from:
- PartialInvariantFunctorSyntax
Implicit methods for values of type Record
Implicit methods for values of type Record
- Inherited from:
- JsonSchemas
Types
Value members
Concrete methods
- Definition Classes
- Definition Classes
- Definition Classes
Inherited methods
Default discriminator field name for sum types.
Default discriminator field name for sum types.
It defaults to "type", but you can override it twofold:
- by overriding this field you can change default discriminator name algebra-wide
- by using
withDiscriminator
you can specify discriminator field name for specific sum type
- Inherited from:
- JsonSchemas
Convenient constructor for enumerations represented by int values.
Convenient constructor for enumerations represented by int values.
- Inherited from:
- JsonSchemas
A schema for a statically known value.
A schema for a statically known value.
- Decoder interpreters first try to decode incoming values with the given
tpe
schema, and then check that it is equal to the givenvalue
, - Encoder interpreters always produce the given
value
, encoded according totpe
, - Documentation interpreters enrich the JSON schema with a
const
property documenting its only possible value (or anenum
property with a single item).
This is useful to model schemas of objects containing extra fields that are absent from their Scala representation. For example, here is a schema for a GeoJSON point:
case class Point(lon: Double, lat: Double)
val pointSchema = (
field("type")(literal("Point")) zip
field[(Double, Double)]("coordinates")
).xmap(Point.tupled)(p => (p.lon, p.lat))
- Inherited from:
- JsonSchemas
The JSON schema of a record with a single optional field with the given name
The JSON schema of a record with a single optional field with the given name
- Decoders fallback to the
defaultValue
if the field is absent from the decoded JSON object. They fail if the field is present but has an invalid value, - Encoders must emit the field if it is not
defaultValue
, but can choose to omit it when it has thedefaultValue
- Documentation interpreters produce the JSON schema of a JSON object with an
optional property of the given
name
.
- Inherited from:
- JsonSchemas
The JSON schema of a coproduct that share the same parent type and thus can be widened to that parent type
The JSON schema of a coproduct that share the same parent type and thus can be widened to that parent type
- Inherited from:
- JsonSchemas
Convenient constructor for enumerations represented by string values.
Convenient constructor for enumerations represented by string values.
- Inherited from:
- JsonSchemas
Implicits
Implicits
Inherited implicits
Extension methods for values of type F[A]
for which there is an implicit
InvariantFunctor[F]
instance.
Extension methods for values of type F[A]
for which there is an implicit
InvariantFunctor[F]
instance.
- Inherited from:
- InvariantFunctorSyntax
Implicit methods for values of type JsonSchema
Implicit methods for values of type JsonSchema
- Inherited from:
- JsonSchemas
- Inherited from:
- PartialInvariantFunctorSyntax
Implicit methods for values of type Record
Implicit methods for values of type Record
- Inherited from:
- JsonSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas
- Inherited from:
- TuplesSchemas