Attributes
- Companion
- object
- Source
- EndpointGen.scala
- Graph
-
- Supertypes
Members list
Type members
Classlikes
Attributes
- Source
- EndpointGen.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Source
- EndpointGen.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Value members
Concrete methods
Attributes
- Source
- EndpointGen.scala
Attributes
- Source
- EndpointGen.scala
Value parameters
- wrapped
-
primitive type to be aliased as
name
Attributes
- Returns
-
Code.File that have the following structure (e.g. for name="Name", and wrapped = String):
package base.components import zio.prelude.Newtype import zio.schema.Schema object Name extends Newtype[String] { implicit val schema: Schema[Name.Type] = Schema.primitive[String].transform(wrap, unwrap) } - Source
- EndpointGen.scala
Attributes
- Source
- EndpointGen.scala
Given a function to alter a case class, this function will apply it to any structure recursively.
Given a function to alter a case class, this function will apply it to any structure recursively.
Value parameters
- code
-
the structure to apply transformation of case classes on
- f
-
function to transform a zio.http.gen.scala.Code.CaseClass
Attributes
- Returns
-
the transformed structure
- Source
- EndpointGen.scala
Attributes
- Source
- EndpointGen.scala
The types may not be valid in case we reference a concrete subtype of a sealed trait, as the subtype is defined as an inner class encapsulated inside the trait's companion. Therefore, we can alter the type to include the enclosing trait/object's name. The following function will be used to alter the type of all fields needed. The mapCaseClasses helper takes a function that alters a case class, and lifts it such that we can apply it to any structure, and it'll take care to recurse when needed.
The types may not be valid in case we reference a concrete subtype of a sealed trait, as the subtype is defined as an inner class encapsulated inside the trait's companion. Therefore, we can alter the type to include the enclosing trait/object's name. The following function will be used to alter the type of all fields needed. The mapCaseClasses helper takes a function that alters a case class, and lifts it such that we can apply it to any structure, and it'll take care to recurse when needed.
Another issue we fix here, is when we have aliased primitives. In that case we need to append .Type to the aliased primitive type.
Value parameters
- codeStructureToAlter
-
the structure to modify
- getEncapsulatingName
-
used to get the name of the code structure we operate on (Object/CaseClass/Enum)
- subtypeToTraits
-
mappings of subtypes to their mixins - if theres only one, we assume subtype is nested.
Attributes
- Returns
-
the modified structure
- Source
- EndpointGen.scala
Given the type parameter of a field, we may want to alter it, e.g. by prepending the enclosing trait/object's name. This function will recursively alter the type of a field. Recursion is needed for types that contain a type parameter. e.g. transforming:
Given the type parameter of a field, we may want to alter it, e.g. by prepending the enclosing trait/object's name. This function will recursively alter the type of a field. Recursion is needed for types that contain a type parameter. e.g. transforming:
Chunk[Option[Zebra]]
to
Chunk[Option[Animal.Zebra]]
Value parameters
- f
-
a function that may alter the type, None means no altering is needed.
- sType
-
the original type we want to alter
Attributes
- Returns
-
The altered type, or gives back the input if no modification was needed.
- Source
- EndpointGen.scala
Attributes
- Source
- EndpointGen.scala
Attributes
- Source
- EndpointGen.scala