You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 27419f4
Browse filesBrowse the repository at this point in the historyBrowse files
feat(kotlin): read-only Spring controller for a view-backed report (FR-044)
A served object.report (read source @kind: view) now gets its row data class,
filter allowlist and a keyless read-only Spring controller, beside the Exposed
table it already had. Each generator reaches the report through
RestSurfaceGate.restShapeOf, replacing the interim skips, and the table's
served check is RestSurfaceGate.isServedReport. A report that is not served
generates nothing.
- The row's enum property is typed by the enum of the entity the item reads,
the class the table types the column by (KotlinGenUtil.reportEnumClasses is
the one answer for the table, the row and the controller).
- The row carries no builder and no validation annotation: it is read from the
view, never bound.
- Api docs document a served report as a unit of kind "report": its row, its
table, GET <path> and its allowlist.
- New generated lane over the shared report/ api-contract corpus (12 scenarios).
Two controller defects fixed, both in emitters shared with entities and
projections, both byte-neutral for a model that does not hit them:
- A filter on a field.decimal or field.float column threw ClassCastException
(a 500): the value was coerced to a Double and then cast to the column's
BigDecimal or Float. Each now has its own coercer, emitted only when such a
column exists.
- The row mapper and the filter dispatch named a column by its field name, but
the table declares a field named after a member of Exposed's Table under a
Column suffix (source is sourceColumn), so that controller did not compile.
Both now use KotlinNaming.safeColumnProperty, as the sort dispatch did.
Copy file name to clipboardExpand all lines: server/java/codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin/KotlinExposedTableGenerator.kt
Copy file name to clipboardExpand all lines: server/java/codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin/KotlinFilterAllowlistGenerator.kt
+5-6Lines changed: 5 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -63,12 +63,11 @@ open class KotlinFilterAllowlistGenerator : MultiFileDirectGeneratorBase<MetaObj
63
63
overridefunexecute(loader:MetaDataLoader) {
64
64
parseArgs()
65
65
val outRoot =Paths.get(outDir.absolutePath)
66
-
for (entity in loader.metaObjects) {
67
-
// FR-044 Plan 3, interim: RestSurfaceGate now admits a served object.report (the Java
68
-
// port emits its read-only surface from RestSurfaceGate.restShapeOf). This generator
69
-
// does not serve a report yet, and the declared node has no fields to emit from, so a
70
-
// report is skipped here until the Kotlin port switches this loop to restShapeOf.
71
-
if (com.metaobjects.generator.util.GeneratorUtil.isReport(entity)) continue
66
+
for (declared in loader.metaObjects) {
67
+
// FR-044: a served report filters on its DERIVED fields, so its allowlist is built
68
+
// from its read model (which marks every banded derived field @filterable). Any
69
+
// other report maps to null and gets no allowlist; a non-report is itself.
70
+
val entity =RestSurfaceGate.restShapeOf(declared) ?:continue
72
71
// FR-017 TPH: a discriminator subtype folds into its base — the base's allowlist
73
72
// (unioned across subtype columns via isTphBase) is the only one the polymorphic
74
73
// controller uses; a per-subtype allowlist is dead. Mirror the controller/table skip.
0 commit comments