Effect CommunityEC
Effect Community3y ago
7 replies
Jules

Working with Data Structures and Schemas

I just discovered that effect/data as a Data.Case that we can extend to generate "case class"-like data strucutures.
For now, I'm defining my domain in a "schema first" way:
export const ApiKeyMetadataSchema = S.struct({
  name: ApiKeyNameSchema,
  createdAt: S.dateFromString(S.string),
  lastUsedAt: S.optional(S.dateFromString(S.string)).toOption(),
})

export type ApiKeyMetadata = S.To<typeof ApiKeyMetadataSchema>

That doesn't seem to allow me to use this Data.Case thing.
So, what's the advised way to work with data structures and Schemas?
Was this page helpful?