Skip to content

Releases: fisayoafolayan/kiln

v0.1.12

Choose a tag to compare

@fisayoafolayan fisayoafolayan released this 09 Apr 17:30

Switch from cask to brews

v0.1.11

Choose a tag to compare

@fisayoafolayan fisayoafolayan released this 09 Apr 17:12

Update releaser flow

update releaser flow

Choose a tag to compare

@fisayoafolayan fisayoafolayan released this 09 Apr 16:59

v0.1.10 - update releaser flow

v0.1.9

Choose a tag to compare

@fisayoafolayan fisayoafolayan released this 09 Apr 16:44

v0.19 - adds homebrew tap

Fix optional fields with database defaults.

Choose a tag to compare

@fisayoafolayan fisayoafolayan released this 28 Mar 20:40

Fix optional fields with database defaults.

Fix M2M queries and enum validation

Choose a tag to compare

@fisayoafolayan fisayoafolayan released this 28 Mar 19:49

v0.1.7

Bug Fixes

  • Fix M2M link/unlink/list queries on Postgres. to match Bob's RawQuery.
  • Fix validation on optional enum fields.** Columns with both a CHECK constraint and a DEFAULT value (e.g. status TEXT DEFAULT 'draft' CHECK (status IN ('draft', 'published'))) generated a oneof= validation
    tag without omitempty.

Internal

  • Remove gin framework scaffolding from router and config.
  • Simplify config internals. Replace cached map lookups with direct slice scans.
  • Remove unused ForeignKey.OnDelete and ForeignKey.OnUpdate fields.
  • Add router generator tests (11 tests covering CRUD, FK nested routes, M2M routes, operation disabling, endpoint overrides).
  • Add IR tests for IsReadOnly, ValidationTag, UpdateValidationTag, IsFilterable, and SupportsRangeOps.

bugfix: make m2m methods use bob's default query bilder

Choose a tag to compare

@fisayoafolayan fisayoafolayan released this 26 Mar 01:06
v0.1.6

fix M2M methods to use bob's default query builder

release v0.1.5

Choose a tag to compare

@fisayoafolayan fisayoafolayan released this 25 Mar 22:43
patch kiln version

v0.1.4

Choose a tag to compare

@fisayoafolayan fisayoafolayan released this 25 Mar 22:40

What's New

Many-to-Many Relationships

Junction tables are now detected automatically and generate link/unlink endpoints on both sides of the relationship.

Given a schema:

CREATE TABLE post_tags (
  post_id UUID NOT NULL REFERENCES posts(id) ON DELETE CASCADE,
  tag_id  UUID NOT NULL REFERENCES tags(id)  ON DELETE CASCADE,
  PRIMARY KEY (post_id, tag_id)
);

kiln generates:

POST   /api/v1/posts/{id}/tags           link a tag to a post
DELETE /api/v1/posts/{id}/tags/{tagId}   unlink a tag from a post
GET    /api/v1/posts/{id}/tags           list tags linked to a post

And the reverse on tags. Link operations are idempotent (ON CONFLICT DO NOTHING). Junction tables with extra columns (e.g. created_at) are detected and stored for future use.

Disable per table with disable: [link, unlink] in overrides.

Filter and Sort Validation

Invalid filter values now return 400 errors instead of being silently ignored:

GET /api/v1/users?created_at=garbage
→ 400 {"error": "invalid value for created_at: expected RFC3339 format"}

GET /api/v1/users?sort=nonexistent
→ 400 {"error": "invalid sort field: nonexistent"}

kiln doctor Command

New diagnostic command that checks project health without modifying files:

kiln doctor

  Config
    ✓ kiln.yaml loaded
    ✓ driver: postgres
    ✓ output: ./generated

  Schema
    ✓ 4 tables found (users, posts, comments, tags)
    ✓ junction: post_tags (posts ↔ tags)

  Generated Files
    ✓ generated/models/users.go
    ⚠ generated/store/users.go (user-modified)
    ✗ generated/models/old_table.go (stale - table not in schema)

  Overrides
    ✓ users: endpoint=members, hidden_fields=[password_hash]

  Project
    ✓ go.mod found

  No issues found

Store Accepts bob.Executor

Store constructors now accept bob.Executor instead of bob.DB. Both bob.DB and bob.Tx satisfy this interface, so you can wrap store calls in transactions without modifying generated code:

tx, _ := sqlDB.BeginTx(ctx, nil)
bobTx := bob.NewTx(tx)

userStore := store.NewUserStore(bobTx)
postStore := store.NewPostStore(bobTx)

user, _ := userStore.Create(ctx, userReq)
postReq.UserID = user.ID
postStore.Create(ctx, postReq)

tx.Commit()

Pagination Fix

Count query now runs before the data fetch in all list methods (List, ListByParent, ListLinked). This ensures total is always >= the number of returned rows, which is the safe direction for pagination UIs.

Bob Plugin Documentation

Full guide for using kiln as a bob plugin: README section, dedicated docs page at docs/guides/bob-plugin.md, and a working example at examples/bob-plugin/ with gen/main.go.

Breaking Changes

IsReadOnly for Primary Key Columns

Primary key columns are now only auto-readonly if they have a database default (e.g. gen_random_uuid()). PK columns without defaults are writable. This affects composite PK tables if you add support for them in the future, but has no effect on single-PK tables with auto-generated IDs (the common case).

Store Constructor Signature

Generated store constructors changed from NewUserStore(db bob.DB) to NewUserStore(db bob.Executor). Existing code compiles without changes since bob.DB satisfies bob.Executor.

Internal Changes

  • IR refactored from PrimaryKey *Column to PrimaryKeys []*Column
  • Junction table detection moved from adapter to a classification pass after FK wiring
  • Removed dead code: plugin/adapter.go, TestsConfig, unused IR methods
  • Adapter test for composite PK tables updated (now included in schema, not skipped)

New Documentation

Fix unused import bug in handler

Choose a tag to compare

@fisayoafolayan fisayoafolayan released this 25 Mar 10:51

Fix unused import bug in handler