Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,20 @@ four `rules.*` and `verify.lifecycle.unreachable` settings, held to `fixtures/ru
(`writeInstantTzSupport` and its siblings); an owned copy ejected at an earlier version carries
its own and still compiles (`EjectedAtBaseGeneratorsCompatTest`).

- **The Kotlin Spring controller writes through `KotlinWriter`** (ADR-0063): the writable
controller, the TPH base controller and the read-only (projection and report) controller, with
the filter pipeline, the M:N traversal routes, the sort surface and the credential redactor they
share. Its entry leaves the layout ratchet's allowlist. **Its output changes in layout only:**
imports in one sorted group, no blank line at the start or end of the controller class, one blank
line where the TPH controller wrote two (before its exception handlers), and two
bodies the old text builder indented one level off now indented by their blocks (the Exposed 1.x
`WhereOp` loop, and a PATCH handler whose only automatic column is an `@autoSet` one).
Regenerating shows those diffs and nothing else. The `protected open` hooks an `open` subclass
overrides (`emitFilterPipeline`, `emitPerFieldDispatchArm`, `emitTypedCoercer`,
`emitM2mEndpoint`, `emitTphSubtypeM2mEndpoint`) now take a `KotlinWriter` where they took a
`StringBuilder`; an owned copy ejected at an earlier version carries its own and still compiles
(`EjectedAtBaseGeneratorsCompatTest`).

- **Python publishes a shared model (FR-023).** A `shared-model` generator, wired in
`metaobjects.config.yaml` like any other (`metaobjects gen --list` names its options), writes
`<name>.metaobjects.json` and `metaobjects.pkg.json` for a consumer's `deps sync`: `name` and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ corpus today; opens when a real consumer needs it.

## `ObjectField` skipped in sort allowlist + `rowTo<Entity>` mapping

**Status:** Day-1 limitation in [`KotlinSpringControllerGenerator.kt:228`](src/main/kotlin/com/metaobjects/generator/kotlin/KotlinSpringControllerGenerator.kt#L228).
**Status:** Day-1 limitation in [`KotlinSpringControllerGenerator.kt`](src/main/kotlin/com/metaobjects/generator/kotlin/KotlinSpringControllerGenerator.kt) (the sort allowlist and the `rowTo<Entity>` mapper; search for `Sort allowlist`).

A `field.object` (jsonb or flattened storage) is not eligible for `?sort=` in
the generated controller and is skipped in the `rowTo<Entity>(...)` mapper
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin/KotlinNaming.kt": "packageHeader() returns a package line with typed line breaks. No reference generator calls it since W-KT-2; it stays public for owned copies ejected at an earlier version, which still call it.",
"codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin/KotlinPoetFileWriter.kt": "Lays its output out through KotlinPoet (the FileSpec-to-disk helper, retired when its last caller moves). It moves to KotlinWriter, and KotlinPoet leaves the build, in W-KT-4.",
"codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin/KotlinSpringConfigGenerator.kt": "Lays its output out through KotlinPoet (FileSpec for the Spring configuration class). It moves to KotlinWriter, and KotlinPoet leaves the build, in W-KT-4.",
"codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin/KotlinSpringControllerGenerator.kt": "Builds the Spring controller with typed line breaks and indentation throughout. Converted to KotlinWriter in W-KT-3.",
"codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin/KotlinTypeMapper.kt": "Lays its output out through KotlinPoet (TypeName values the entity and table generators share). It moves to KotlinWriter, and KotlinPoet leaves the build, in W-KT-4."
},
"exempt": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
package acme.blog

import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import jakarta.servlet.http.HttpServletRequest
import jakarta.validation.Validator
import java.io.ByteArrayOutputStream
import java.nio.charset.StandardCharsets
import java.sql.Timestamp
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.format.DateTimeFormatter
import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.SqlExpressionBuilder
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.sql.transactions.transaction
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import jakarta.validation.Validator
import org.jetbrains.exposed.sql.update
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.DeleteMapping
Expand All @@ -26,14 +34,6 @@ import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import jakarta.servlet.http.HttpServletRequest
import java.io.ByteArrayOutputStream
import java.nio.charset.StandardCharsets
import java.sql.Timestamp
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.format.DateTimeFormatter

/** GENERATED — sort allowlist for Author (cross-port API contract). */
private val AuthorSortAllowlist = setOf(
Expand Down Expand Up @@ -287,7 +287,6 @@ private fun rowToAuthor(row: ResultRow): Author = Author(
@RestController
@RequestMapping("/api/authors")
class AuthorController(private val objectMapper: ObjectMapper, private val validator: Validator) {

@GetMapping
fun list(
@RequestParam(required = false) limit: Int?,
Expand Down Expand Up @@ -414,5 +413,4 @@ class AuthorController(private val objectMapper: ObjectMapper, private val valid
val status = if (kind == "foreign_key" || kind == "unique") HttpStatus.CONFLICT else HttpStatus.BAD_REQUEST
return ResponseEntity.status(status).body(mapOf("error" to "constraint_violation", "constraint" to kind) as Any)
}

}
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
package acme.catalog

import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import jakarta.servlet.http.HttpServletRequest
import jakarta.validation.Validator
import java.io.ByteArrayOutputStream
import java.math.BigDecimal
import java.nio.charset.StandardCharsets
import java.sql.Timestamp
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.format.DateTimeFormatter
import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.SqlExpressionBuilder
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.sql.transactions.transaction
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import jakarta.validation.Validator
import org.jetbrains.exposed.sql.update
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.DeleteMapping
Expand All @@ -26,15 +35,6 @@ import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import jakarta.servlet.http.HttpServletRequest
import java.io.ByteArrayOutputStream
import java.nio.charset.StandardCharsets
import java.sql.Timestamp
import java.math.BigDecimal
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.format.DateTimeFormatter

/** GENERATED — sort allowlist for Product (cross-port API contract). */
private val ProductSortAllowlist = setOf(
Expand Down Expand Up @@ -335,7 +335,6 @@ private fun rowToProduct(row: ResultRow): Product = Product(
@RestController
@RequestMapping("/api/products")
class ProductController(private val objectMapper: ObjectMapper, private val validator: Validator) {

@GetMapping
fun list(
@RequestParam(required = false) limit: Int?,
Expand Down Expand Up @@ -487,5 +486,4 @@ class ProductController(private val objectMapper: ObjectMapper, private val vali
val status = if (kind == "foreign_key" || kind == "unique") HttpStatus.CONFLICT else HttpStatus.BAD_REQUEST
return ResponseEntity.status(status).body(mapOf("error" to "constraint_violation", "constraint" to kind) as Any)
}

}
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
package acme.catalog

import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import jakarta.servlet.http.HttpServletRequest
import jakarta.validation.Validator
import java.io.ByteArrayOutputStream
import java.math.BigDecimal
import java.nio.charset.StandardCharsets
import java.sql.Timestamp
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.format.DateTimeFormatter
import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.SqlExpressionBuilder
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.sql.transactions.transaction
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import jakarta.validation.Validator
import org.jetbrains.exposed.sql.update
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.DeleteMapping
Expand All @@ -26,15 +35,6 @@ import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import jakarta.servlet.http.HttpServletRequest
import java.io.ByteArrayOutputStream
import java.nio.charset.StandardCharsets
import java.sql.Timestamp
import java.math.BigDecimal
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.format.DateTimeFormatter

/** GENERATED — sort allowlist for Product (cross-port API contract). */
private val ProductSortAllowlist = setOf(
Expand Down Expand Up @@ -335,7 +335,6 @@ private fun rowToProduct(row: ResultRow): Product = Product(
@RestController
@RequestMapping("/api/products")
class ProductController(private val objectMapper: ObjectMapper, private val validator: Validator) {

@GetMapping
fun list(
@RequestParam(required = false) limit: Int?,
Expand Down Expand Up @@ -487,5 +486,4 @@ class ProductController(private val objectMapper: ObjectMapper, private val vali
val status = if (kind == "foreign_key" || kind == "unique") HttpStatus.CONFLICT else HttpStatus.BAD_REQUEST
return ResponseEntity.status(status).body(mapOf("error" to "constraint_violation", "constraint" to kind) as Any)
}

}
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
package acme.auth

import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import jakarta.servlet.http.HttpServletRequest
import jakarta.validation.Validator
import java.io.ByteArrayOutputStream
import java.math.BigDecimal
import java.nio.charset.StandardCharsets
import java.sql.Timestamp
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.format.DateTimeFormatter
import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.SqlExpressionBuilder
import org.jetbrains.exposed.sql.TextColumnType
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.castTo
import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.sql.transactions.transaction
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import jakarta.validation.Validator
import org.jetbrains.exposed.sql.update
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.DeleteMapping
Expand All @@ -26,17 +37,6 @@ import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import jakarta.servlet.http.HttpServletRequest
import java.io.ByteArrayOutputStream
import java.nio.charset.StandardCharsets
import java.sql.Timestamp
import java.math.BigDecimal
import org.jetbrains.exposed.sql.TextColumnType
import org.jetbrains.exposed.sql.castTo
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.format.DateTimeFormatter

/** GENERATED — sort allowlist for Auth (cross-port API contract). */
private val AuthSortAllowlist = setOf(
Expand Down Expand Up @@ -346,7 +346,6 @@ private fun rowToAuth(row: ResultRow): Auth = Auth(
@RestController
@RequestMapping("/api/auths")
class AuthController(private val objectMapper: ObjectMapper, private val validator: Validator) {

@GetMapping
fun list(
@RequestParam(required = false) limit: Int?,
Expand Down Expand Up @@ -674,7 +673,6 @@ class AuthController(private val objectMapper: ObjectMapper, private val validat
else ResponseEntity.noContent().build<Any>()
}


/** A request body that cannot be read is a client error naming the field, not a 500. */
@ExceptionHandler(org.springframework.http.converter.HttpMessageNotReadableException::class)
fun handleUnreadableBody(e: org.springframework.http.converter.HttpMessageNotReadableException): ResponseEntity<Any> =
Expand Down Expand Up @@ -704,5 +702,4 @@ class AuthController(private val objectMapper: ObjectMapper, private val validat
val status = if (kind == "foreign_key" || kind == "unique") HttpStatus.CONFLICT else HttpStatus.BAD_REQUEST
return ResponseEntity.status(status).body(mapOf("error" to "constraint_violation", "constraint" to kind) as Any)
}

}
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
package acme.auth

import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import jakarta.servlet.http.HttpServletRequest
import jakarta.validation.Validator
import java.io.ByteArrayOutputStream
import java.nio.charset.StandardCharsets
import java.sql.Timestamp
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.format.DateTimeFormatter
import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.SqlExpressionBuilder
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.sql.transactions.transaction
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import jakarta.validation.Validator
import org.jetbrains.exposed.sql.update
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.DeleteMapping
Expand All @@ -26,14 +34,6 @@ import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import jakarta.servlet.http.HttpServletRequest
import java.io.ByteArrayOutputStream
import java.nio.charset.StandardCharsets
import java.sql.Timestamp
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.time.format.DateTimeFormatter

/** GENERATED — sort allowlist for AuthLine (cross-port API contract). */
private val AuthLineSortAllowlist = setOf(
Expand Down Expand Up @@ -286,7 +286,6 @@ private fun rowToAuthLine(row: ResultRow): AuthLine = AuthLine(
@RestController
@RequestMapping("/api/auth_lines")
class AuthLineController(private val objectMapper: ObjectMapper, private val validator: Validator) {

@GetMapping
fun list(
@RequestParam(required = false) limit: Int?,
Expand Down Expand Up @@ -411,5 +410,4 @@ class AuthLineController(private val objectMapper: ObjectMapper, private val val
val status = if (kind == "foreign_key" || kind == "unique") HttpStatus.CONFLICT else HttpStatus.BAD_REQUEST
return ResponseEntity.status(status).body(mapOf("error" to "constraint_violation", "constraint" to kind) as Any)
}

}
Loading
Loading