Modules

ModuleResponsibility
nomos-bomBill of Materials — pins dependency versions for consumers
nomos-runtimeRuntime that generated code depends on: the JSON model (dev.cjfravel.nomos.json), the template type model, codecs, and the validator + registries
nomos-coreThe generator: template parser, code generator, template serializer, and the Nomos facade
nomos-maven-pluginScans templates and invokes the core to generate sources at build time
nomos-exampleEnd-to-end consumer used as an integration test

Generation pipeline

Template JSON → TemplateParser → MultiTemplate (model) → CodeGenerator → GeneratedFile(s) → FileWriter

The type model

A MultiTemplate holds project settings and a list of TemplateDefinitions, each with a TemplateType:

sealed trait TemplateType
// StringType, NumberType, IntType, LongType, DecimalType, BooleanType,
// DateType, DateTimeType, ArrayType, MapType, UnionType, ObjectType,
// ReferenceType, RecursiveRef, ExternalType, EnumType, TypeDiscriminator

Object and discriminator field order is preserved with ListMap, so generated case-class fields match the template.

Template embedding

Rather than ship a schema file, the generator serializes the MultiTemplate into the generated NomosFormats object and builds a validator from it. This keeps the model and its validation in one artifact and guarantees they agree — there is no second copy to drift.

Adding a feature

A new template capability usually touches the same five seams, in this order:

  1. model — add or extend a TemplateType / field.
  2. parser — recognize the new template syntax.
  3. generator — emit the corresponding Scala.
  4. validator — enforce it at runtime.
  5. serializer — round-trip it into the embedded template.

Write the failing test first, thread the change through these seams, then prove it compiles and runs in nomos-example.

Back to Contributing.