smithy4s.deriving.internals.SourcePosition.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api_3 Show documentation
Show all versions of api_3 Show documentation
Open AI API and examples
The newest version!
package smithy4s.deriving.internals
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.int
import smithy4s.schema.Schema.recursive
import smithy4s.schema.Schema.string
import smithy4s.schema.Schema.struct
final case class SourcePosition(path: String, start: Int, startLine: Int, startColumn: Int, end: Int, endLine: Int, endColumn: Int)
object SourcePosition extends ShapeTag.Companion[SourcePosition] {
val id: ShapeId = ShapeId("smithy4s.deriving.internals", "SourcePosition")
val hints: Hints = Hints(
smithy.api.Trait(selector = None, structurallyExclusive = None, conflicts = None, breakingChanges = None),
).lazily
// constructor using the original order from the spec
private def make(path: String, start: Int, startLine: Int, startColumn: Int, end: Int, endLine: Int, endColumn: Int): SourcePosition = SourcePosition(path, start, startLine, startColumn, end, endLine, endColumn)
implicit val schema: Schema[SourcePosition] = recursive(struct(
string.required[SourcePosition]("path", _.path),
int.required[SourcePosition]("start", _.start),
int.required[SourcePosition]("startLine", _.startLine),
int.required[SourcePosition]("startColumn", _.startColumn),
int.required[SourcePosition]("end", _.end),
int.required[SourcePosition]("endLine", _.endLine),
int.required[SourcePosition]("endColumn", _.endColumn),
)(make).withId(id).addHints(hints))
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy