JsonEntitiesFromSchemas
Interpreter for algebra.JsonEntitiesFromSchemas that decodes JSON requests and encodes JSON responses using Akka HTTP.
Type members
Inherited classlikes
- Value parameters:
- entity
Contents of the callback message
- method
HTTP method used for the callback
- response
Expected response
- Inherited from:
- EndpointsWithCustomErrors
- Value parameters:
- callbacks
Callbacks indexed by event name
- deprecated
Indicates whether this endpoint is deprecated or not
- description
Detailed description
- operationId
A unique identifier which identifies this operation
- summary
Short description
- tags
OpenAPI tags
- Inherited from:
- EndpointsWithCustomErrors
Extension methods for Endpoint.
Extension methods for Endpoint.
- Inherited from:
- EndpointsWithCustomErrors
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
Given a parameter name and a query string content, returns a decoded parameter
value of type T
, or Invalid
if decoding failed
Given a parameter name and a query string content, returns a decoded parameter
value of type T
, or Invalid
if decoding failed
- Inherited from:
- Urls
Implicit methods for values of type Record
Implicit methods for values of type Record
- Inherited from:
- JsonSchemas
Inherited types
Callbacks indexed by URL pattern
Callbacks indexed by URL pattern
- See also:
Swagger Documentation at https://swagger.io/docs/specification/callbacks/
- Inherited from:
- EndpointsWithCustomErrors
Errors in a request built by a client
Errors in a request built by a client
- Inherited from:
- Errors
Error raised by the business logic of a server
Error raised by the business logic of a server
- Inherited from:
- Errors
Value members
Concrete methods
Inherited methods
- Definition Classes
- Inherited from:
- EndpointsWithCustomErrors
- Definition Classes
- Inherited from:
- EndpointsWithCustomErrors
- Definition Classes
- Inherited from:
- EndpointsWithCustomErrors
Bad Request (400) response, with an entity of type ClientErrors
.
Bad Request (400) response, with an entity of type ClientErrors
.
- See also:
- Inherited from:
- Responses
- Inherited from:
- EndpointsWithCustomErrors
Format of the response entity carrying the client errors.
Format of the response entity carrying the client errors.
- Inherited from:
- Errors
Convert the ClientErrors type into the endpoints4s internal client error type
Convert the ClientErrors type into the endpoints4s internal client error type
- Inherited from:
- Errors
- Inherited from:
- Urls
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
Helper method to perform DELETE request
Helper method to perform DELETE request
- Type parameters:
- HeadersP
Payload carried by headers
- UrlP
Payload carried by url
- Inherited from:
- Requests
Override this method to customize the behaviour of encoders produced by if(value.==(defaultValue))ujson.Obj.apply()elseujson.Obj.apply[Value](ArrowAssoc[String](name).->[Value](tpe.encoder.encode(value)))($conforms[Value]))else((`value₂`:A)=>ujson.Obj.apply[Value](ArrowAssoc[String](name).->[Value](tpe.encoder.encode(`value₂`)))($conforms[Value])) } (new$anon():Record[A]) }">optFieldWithDefault when encoding a field value that corresponds to the specified default value. By default, the default values are included.
Override this method to customize the behaviour of encoders produced by if(value.==(defaultValue))ujson.Obj.apply()elseujson.Obj.apply[Value](ArrowAssoc[String](name).->[Value](tpe.encoder.encode(value)))($conforms[Value]))else((`value₂`:A)=>ujson.Obj.apply[Value](ArrowAssoc[String](name).->[Value](tpe.encoder.encode(`value₂`)))($conforms[Value])) } (new$anon():Record[A]) }">optFieldWithDefault when encoding a field value that corresponds to the specified default value. By default, the default values are included.
As an example, consider the following Scala class and instances of it.
case class Book(
name: String,
availableAsEBook: Boolean = false
)
val book1 = Book("Complete Imaginary Works", false)
val book2 = Book("History of Writing", true)
With encodersSkipDefaultValues = false
(which is the default), the field
is always encoded, regardless of whether it is also the default value.
This makes encoding performance predictable, but results in larger and
more complicated encoded payloads:
{ "name": "Complete Imaginary Works", "availableAsEBook": false }
{ "name": "History of Writing", "availableAsEBook": true }
With encodersSkipDefaultValues = true
, the field is skipped if its value
if also the field's default value. This means encoding can be slower
(since potentially expensive equality check needs to be performed), but
the encoded payloads are smaller and simpler:
{ "name": "Complete Imaginary Works" }
{ "name": "History of Writing", "availableAsEBook": true }
- Inherited from:
- JsonSchemas
Helper method to perform GET request
Helper method to perform GET request
- Type parameters:
- HeadersP
Payload carried by headers
- UrlP
Payload carried by url
- Inherited from:
- Requests
This method is called by endpoints4s when decoding a request failed.
This method is called by endpoints4s when decoding a request failed.
The provided implementation calls clientErrorsResponse
to complete
with a response containing the errors.
This method can be overridden to customize the error reporting logic.
- Inherited from:
- Urls
This method is called by ''endpoints'' when an exception is thrown during request processing.
This method is called by ''endpoints'' when an exception is thrown during request processing.
The provided implementation uses serverErrorResponse to complete with a response containing the error message.
This method can be overridden to customize the error reporting logic.
- Inherited from:
- EndpointsWithCustomErrors
Convenient constructor for enumerations represented by int values.
Convenient constructor for enumerations represented by int values.
- Inherited from:
- JsonSchemas
Internal Server Error (500) response, with an entity of type ServerError
.
Internal Server Error (500) response, with an entity of type ServerError
.
- See also:
- Inherited from:
- Responses
Convert the endpoints4s internal client error type into the ClientErrors type
Convert the endpoints4s internal client error type into the ClientErrors type
- Inherited from:
- Errors
Simpler alternative to Directive.&()
method
Simpler alternative to Directive.&()
method
- Inherited from:
- Urls
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
- Definition Classes
- Inherited from:
- EndpointsWithCustomErrors
- Definition Classes
- Inherited from:
- EndpointsWithCustomErrors
- Definition Classes
- Inherited from:
- EndpointsWithCustomErrors
OK (200) Response with the given entity
OK (200) Response with the given entity
- Inherited from:
- Responses
- Definition Classes
- if(value.==(defaultValue))ujson.Obj.apply()elseujson.Obj.apply[Value](ArrowAssoc[String](name).->[Value](tpe.encoder.encode(value)))($conforms[Value]))else((`value₂`:A)=>ujson.Obj.apply[Value](ArrowAssoc[String](name).->[Value](tpe.encoder.encode(`value₂`)))($conforms[Value])) } (new$anon():Record[A]) }">JsonSchemas -> JsonSchemas
- Inherited from:
- if(value.==(defaultValue))ujson.Obj.apply()elseujson.Obj.apply[Value](ArrowAssoc[String](name).->[Value](tpe.encoder.encode(value)))($conforms[Value]))else((`value₂`:A)=>ujson.Obj.apply[Value](ArrowAssoc[String](name).->[Value](tpe.encoder.encode(`value₂`)))($conforms[Value])) } (new$anon():Record[A]) }">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
Helper method to perform PATCH request
Helper method to perform POST request
- Inherited from:
- EndpointsWithCustomErrors
- Inherited from:
- EndpointsWithCustomErrors
Format of the response entity carrying the server error.
Format of the response entity carrying the server error.
- Inherited from:
- Errors
Convert the ServerError type into the endpoints4s internal server error type
Convert the ServerError type into the endpoints4s internal server error type
- Inherited from:
- Errors
Convenient constructor for enumerations represented by string values.
Convenient constructor for enumerations represented by string values.
- Inherited from:
- JsonSchemas
Convert the endpoints4s internal server error type into the ServerError type
Convert the endpoints4s internal server error type into the ServerError type
- Inherited from:
- Errors
- Inherited from:
- Urls
Turns a Response[A]
into a Response[Option[A]]
.
Turns a Response[A]
into a Response[Option[A]]
.
Interpreters represent None
with
an empty HTTP response whose status code is 404 (Not Found).
- Inherited from:
- Responses
Inherited fields
Response used by endpoints4s when decoding a request fails.
Response used by endpoints4s when decoding a request fails.
The provided implementation forwards to badRequest
.
- Inherited from:
- Errors
An empty path.
An empty path.
Useful to begin a path definition:
path / "foo" / segment[Int] /? qs[String]("bar")
- Inherited from:
- Urls
Response used by endpoints4s when the business logic of an endpoint fails.
Response used by endpoints4s when the business logic of an endpoint fails.
The provided implementation forwards to internalServerError
- Inherited from:
- Errors
Implicits
Inherited implicits
Extension methods for Endpoint.
Extension methods for Endpoint.
- Inherited from:
- EndpointsWithCustomErrors
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:
- SemigroupalSyntax
Query string parameter containing a Boolean
value
Query string parameter containing a Boolean
value
- Inherited from:
- Urls
Codec for query string parameters of type Double
Codec for query string parameters of type Double
- Inherited from:
- Urls
Ability to define Int
query string parameters
Ability to define Int
query string parameters
- Inherited from:
- Urls
Query string parameter containing a Long
value
Query string parameter containing a Long
value
- Inherited from:
- Urls
- Inherited from:
- Urls
- Inherited from:
- Urls
- Inherited from:
- Urls
Ability to define UUID
query string parameters
Ability to define UUID
query string parameters
- Inherited from:
- Urls