@haneinfo/metadata-schema
@haneinfo/metadata-schema exposes the Prisma DMMF used by an app through GET /metadata/schema.
The response includes scalar and enum fields, relation metadata, database column names, and
structured annotations parsed from Prisma /// documentation comments.
Prisma documentation tags
Tags are case-sensitive. @cubeMeasure and @cubeRef are line-oriented: they are recognised only
when they start a documentation line, after optional whitespace. @internal is the exception (see
below). A description can follow the tag on the same line, or appear on
separate /// lines. The original documentation value in the metadata response is preserved
byte-for-byte; parsing adds structured properties without removing tag text.
@internal
Place @internal anywhere in a model's documentation to exclude that model from the derived
availableScopes list; package Prisma fragments put it at the end of the model's first /// line.
The model and its metadata are still exposed in models; only the scope derivation filters it out.
/// @internal
/// Framework bookkeeping; not part of the public data scopes.
model AuditLog {
id String @id @default(cuid())
}
@cubeMeasure <hint>
Place @cubeMeasure on a scalar or enum field and provide one non-whitespace hint. The current
recommended dictionary is sum, avg, min, max, and count, but measureHint is an open
string so future Cube measures such as countDistinct, countDistinctApprox, and runningTotal
can be used without a package type change. The parser does not validate whether the field type is
appropriate for the hint. Consumers should ignore or warn on unknown hints rather than failing the
whole query.
model InvoiceLine {
id String @id @default(cuid())
/// @cubeMeasure sum Line amount in the invoice currency.
amount Decimal
}
@cubeRef <app>.<Model>.<field>
Place @cubeRef on a field that refers to a field owned by another app. The three dot-separated
parts are returned as crossAppRef: { app, model, field }. Parsing is syntactic only: the app,
model, and field do not need to exist in the current repository. Cross-app joins are never inferred
when this tag is absent.
model Shipment {
id String @id @default(cuid())
/// @cubeRef sales.Order.id
/// The order identifier is owned by the sales app.
salesOrderId String @map("sales_order_id")
}
Tags can be combined on one field and can be mixed with ordinary text:
model Payment {
id String @id @default(cuid())
/// Payment amount in the settlement currency.
/// @cubeMeasure sum
/// @cubeRef billing.Invoice.total
amount Decimal @map("amount_value")
}
Malformed @cubeMeasure or @cubeRef lines are ignored and produce a warning. Lowercase variants
such as @cubemeasure are ordinary text. If a tag appears more than once on a field, the first
valid occurrence wins. A tag string embedded in the middle of a sentence is not a tag; move it to
the beginning of a /// documentation line.