Skip to content

Commit dcf9410

Browse files
committed
Fixed bugs & enhancement
1 parent c84ff6d commit dcf9410

3 files changed

Lines changed: 22 additions & 21 deletions

File tree

flowforge.g8/src/main/g8/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Generated from flowforge template with **F-polymorphic effects** and **compile-t
99
sbt compile
1010

1111
# 2. Run the complete pipeline
12-
sbt "runMain $organization$;format="word"$.UsersPipelineApp"
12+
sbt "runMain $organization$;format=\"word\".UsersPipelineApp"
1313
```
1414

1515
**Expected Output:**
@@ -225,7 +225,7 @@ val s3Sink = TypedSink[EnrichedUser](
225225
// Add domain-specific quality checks
226226
.addTransform[CleanedUser] { user =>
227227
if (isValidBusinessUser(user)) F.pure(user)
228-
else F.raiseError(new ValidationException(s"Business rule violation: \$user"))
228+
else F.raiseError(new ValidationException(s"Business rule violation:" + user))
229229
}
230230
```
231231

flowforge.g8/src/main/g8/src/main/scala/$organization$/Pipeline.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class FlowForgePipeline[F[_]: EffectSystem] {
104104
val lineageEmitter = $if(include_lineage.truthy)$OpenLineageEmitter.noop[F]$else$OpenLineageEmitter.noop[F]$endif$
105105

106106
F.delay {
107-
PipelineBuilder[F]("$name;format="kebab"$-comprehensive-pipeline")
107+
PipelineBuilder[F]("$name$")
108108
.withDescription("Complete CSV→Parquet→Delta pipeline with contracts & quality")
109109
.withLineageEmitter(lineageEmitter)
110110
.addTypedSource[RawUser, RawUser, SchemaPolicy.Exact](
@@ -201,7 +201,7 @@ class FlowForgePipeline[F[_]: EffectSystem] {
201201
def runPipeline(): F[Unit] = {
202202
val sparkConfig = Map(
203203
"spark.master" -> "local[*]",
204-
"spark.app.name" -> "FlowForge-$name;format="Camel"$",
204+
"spark.app.name" -> "FlowForge-$name$",
205205
"spark.sql.extensions" -> "io.delta.sql.DeltaSparkSessionExtension",
206206
"spark.sql.catalog.spark_catalog" -> "org.apache.spark.sql.delta.catalog.DeltaCatalog",
207207
"spark.serializer" -> "org.apache.spark.serializer.KryoSerializer"
@@ -263,7 +263,7 @@ object PipelineApp extends cats.effect.IOApp.Simple {
263263
val rawUser = SimpleRawUser(1L, "Alice Johnson", "alice@example.com", Some(28), "USA", true)
264264

265265
val pipeline = FlowForgePipeline[IO, SimpleRawUser, SimpleCleanedUser](
266-
name = "$name;format=\"kebab\"$-direct-pipeline",
266+
name = "$name$",
267267
source = DataSource.local("input.csv", DataFormat.CSV),
268268
sink = DataSink.local("output.parquet", DataFormat.Parquet),
269269
transformation = Kleisli[IO, SimpleRawUser, SimpleCleanedUser](raw => IO.pure(sampleTransformation(raw))),

modules/contracts/src/main/scala/com/flowforge/contracts/syntax/ContractDSL.scala

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ case class ContractBuilder(name: String) {
5757

5858
def build: ContractSchema = {
5959
versionOpt.getOrElse(ContractVersion(1, 0, 0))
60-
val finalMetadata = metadata ++
60+
val finalMetadata = metadata ++
6161
slaOpt.map("sla" -> _) ++
6262
ownerOpt.map("owner" -> _)
6363

@@ -75,7 +75,8 @@ case class ContractBuilder(name: String) {
7575
*/
7676
case class FieldBuilder(name: String, parent: ContractBuilder) {
7777
private var fieldType: Option[FieldType] = None
78-
78+
79+
private var isRequired: Boolean = false
7980
private var isOptional: Boolean = false
8081
private var constraints: List[FieldConstraint] = List.empty
8182
private var descriptionOpt: Option[String] = None
@@ -123,7 +124,7 @@ case class FieldBuilder(name: String, parent: ContractBuilder) {
123124
* Typed Field Builder that provides type-specific methods
124125
*/
125126
case class TypedFieldBuilder(fieldBuilder: FieldBuilder) {
126-
127+
127128
// Basic types
128129
def string: StringFieldBuilder = {
129130
fieldBuilder.setFieldType(FieldType.StringType)
@@ -170,7 +171,7 @@ case class TypedFieldBuilder(fieldBuilder: FieldBuilder) {
170171
* String-specific field builder with string constraints
171172
*/
172173
class StringFieldBuilder(fieldBuilder: FieldBuilder) extends FieldTerminator(fieldBuilder) {
173-
174+
174175
def minLength(length: Int): StringFieldBuilder = {
175176
fieldBuilder.addConstraint(FieldConstraint.MinLength(length))
176177
this
@@ -219,7 +220,7 @@ class StringFieldBuilder(fieldBuilder: FieldBuilder) extends FieldTerminator(fie
219220
* Numeric field builder with numeric constraints
220221
*/
221222
class NumericFieldBuilder[T](fieldBuilder: FieldBuilder) extends FieldTerminator(fieldBuilder) {
222-
223+
223224
def min(minValue: Double): NumericFieldBuilder[T] = {
224225
fieldBuilder.addConstraint(FieldConstraint.Range(minValue, Double.MaxValue))
225226
this
@@ -250,7 +251,7 @@ class NumericFieldBuilder[T](fieldBuilder: FieldBuilder) extends FieldTerminator
250251
* Field terminator that allows returning to contract building
251252
*/
252253
case class FieldTerminator(fieldBuilder: FieldBuilder) {
253-
254+
254255
def field(name: String): FieldBuilder = {
255256
fieldBuilder.parent.field(name)
256257
}
@@ -281,7 +282,7 @@ case class FieldTerminator(fieldBuilder: FieldBuilder) {
281282
* DSL entry points and syntax extensions
282283
*/
283284
object ContractDSL {
284-
285+
285286
/**
286287
* Create a new contract with the given name
287288
*/
@@ -304,11 +305,11 @@ object ContractDSL {
304305
* Example usage demonstrations
305306
*/
306307
object Examples {
307-
308+
308309
/**
309310
* User contract with comprehensive field definitions
310311
*/
311-
def userContract: ContractSchema =
312+
def userContract: ContractSchema =
312313
Contract("user")
313314
.field("id").required.long.positive
314315
.field("email").required.string.email.maxLength(255)
@@ -360,32 +361,32 @@ object ContractDSL {
360361
* Implicit conversions for seamless integration
361362
*/
362363
object ContractSyntax {
363-
364+
364365
implicit class ContractOps(contract: ContractSchema) {
365366
def toDataContract[A]: DataContract[A] = {
366367
new DataContract[A] {
367368
def validate(data: A): cats.data.ValidatedNel[ContractViolation, A] = {
368369
// Basic validation - in practice this would introspect the data structure
369370
data.validNel
370371
}
371-
372+
372373
def schema: ContractSchema = contract
373374
def version: ContractVersion = ContractVersion(1, 0, 0)
374-
def rules: NonEmptyList[ValidationRule[A]] =
375+
def rules: NonEmptyList[ValidationRule[A]] =
375376
NonEmptyList.one(ValidationRules.custom[A]("schema_valid")(_ => ().validNel))
376377
}
377378
}
378379
}
379-
380+
380381
implicit class StringFieldOps(name: String) {
381382
def requiredString: StringFieldBuilder = {
382383
val builder = ContractBuilder(name).field(name)
383384
builder.required.string
384385
}
385-
386+
386387
def optionalString: StringFieldBuilder = {
387-
val builder = ContractBuilder(name).field(name)
388+
val builder = ContractBuilder(name).field(name)
388389
builder.optional.string
389390
}
390391
}
391-
}
392+
}

0 commit comments

Comments
 (0)