Skip to content

Conversation

@vim89
Copy link

@vim89 vim89 commented Nov 11, 2025

docs: Add article compile-time data contracts article with Scala 3 macros and schema validation

Copy link
Collaborator

@daniel-ciocirlan daniel-ciocirlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very valuable article. I've added some comments about explanations and phrasing. Otherwise nice 👍 👍

@vim89
Copy link
Author

vim89 commented Nov 12, 2025

docs: address all PR review comments - alphabetize tags, add headings, convert mermaid diagrams to SVG, fix Scala 3 braces syntax, add external tool links, enhance Spark drift example, standardize formatting

Copy link
Collaborator

@daniel-ciocirlan daniel-ciocirlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the fixes!
I marked some more blocks to use braces - I know they are compact and look a little better with braceless, but consistency is more valuable and longer code blocks (10+ lines) are much less readable with braceless.

If-then-else is fine 👍

private inline def summonTypeName[T]: String = constValue["" + T]

private inline def zip[L <: Tuple, R <: List[String]](labels: L, types: List[String]): List[(String, String)] =
inline labels match
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly please


final case class User(id: Long, email: String, note: Option[String])

@main def checkShape(): Unit =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly please

### Inspector 1: Is this a case class?

```scala
def isCaseClass(t: TypeRepr): Boolean =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly please

t =:= TypeRepr.of[String] // false

// 3. Pattern matching: Break it apart
t match
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly please

### Inspector 2: What are the type arguments?

```scala
def appliedArgs(t: TypeRepr): List[TypeRepr] = t match
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly please

### Inspector 4: Is this a sequence?

```scala
def seqArg(t: TypeRepr): Option[TypeRepr] =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly please

```scala
def mapArgs(t: TypeRepr): Option[(TypeRepr, TypeRepr)] =
if t <:< TypeRepr.of[Map[?, ?]] then
appliedArgs(t) match
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly please

### Handling case classes:

```scala
if isCaseClass(t) then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly please

import scala.deriving.Mirror

final case class Field(name: String, tpe: String, hasDefault: Boolean = false, isOptional: Boolean = false)
trait Shape[A]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are a bunch of other blocks, I'll mark them

@vim89
Copy link
Author

vim89 commented Nov 30, 2025

Done, converted all braceless syntax to use braces.

@vim89
Copy link
Author

vim89 commented Nov 30, 2025

Ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants