pub struct IntermediateType {Show 15 fields
pub name: String,
pub fields: Vec<IntermediateField>,
pub description: Option<String>,
pub sql_source: Option<String>,
pub implements: Vec<String>,
pub requires_role: Option<String>,
pub inject_params: IndexMap<String, String>,
pub is_error: bool,
pub is_input: bool,
pub relay: bool,
pub embedded: bool,
pub subscribable_tables: Option<Vec<String>>,
pub subscribable_pre_image: bool,
pub relationships: Vec<IntermediateRelationship>,
pub subscription_policy: Option<SubscriptionPolicy>,
}Expand description
Type definition in intermediate format
Fields§
§name: StringType name (e.g., “User”)
fields: Vec<IntermediateField>Type fields
description: Option<String>Type description (from docstring)
sql_source: Option<String>Type-level SQL source (backing table/view), e.g. v_organization.
Owned types bind their relation on the query that returns them, so this
is normally absent. It is emitted by the authoring SDK only for an
owner-split extend type … @key federation entity: a subgraph that does
not own the entity exposes no root query returning it, so the federation
_entities resolver has no query to source the backing relation from and
would otherwise guess lower(typename) and resolve to null (#507). When
present it flows through to TypeDefinition.sql_source and is used as the
_entities fallback relation.
implements: Vec<String>Interfaces this type implements (GraphQL spec §3.6)
requires_role: Option<String>Role required to execute any operation returning this type.
Lowered onto every query and mutation whose return_type is this type when the
compiled schema loads, so the runtime’s operation-level role gate enforces it —
there is no separate type-level check to keep in step (#677). A gated type
reachable as a field of a type that is not gated the same way is refused at
load: operations returning the container carry no role, so the gated type would
travel out ungated.
It also filters the REST /introspection route. It does not filter GraphQL
__schema introspection.
inject_params: IndexMap<String, String>Tenant/owner scoping declared on the type itself (#1142).
The counterpart to sql_source above: a type carrying one is
an entity the _entities resolver reaches with no query behind it, so there is no
operation to carry inject_params. Before this key, such a type could declare
requires_role — honoured from the type since #1030 — but had nowhere to declare
tenant scoping, and the compile succeeded with the annotation covering nothing.
Accepts the same two value shapes as the operation-level key (#806) and threads
through to TypeDefinition.inject_params, where both _entities consumers read it
behind the backing query. A type and its query declaring the same column from
different sources is refused when the compiled schema loads.
is_error: boolWhether this type is a mutation error type (tagged with @fraiseql.error).
is_input: boolWhether the author declared this a GraphQL input object rather than an output
type (is_input: true).
Four SDKs advertise this in their READMEs and emit it — Elixir
(fraiseql_type "X", is_input: true), F# ([<GraphQLType(IsInput=…)>]), PHP
(#[GraphQLType(isInput: true)]) and C# (GraphQLTypeAttribute.IsInput). There was
no field here to receive it, so such a type compiled as an object type: a mutation
argument referencing it produced a schema violating GraphQL §3.10 (“arguments must
be input types”), which introspection-driven clients reject and federation
composition fails on. fraiseql compile and fraiseql lint both exited 0 (#848).
The converter routes a type carrying this into input_types and omits it from
types. That is what makes Elixir’s surface work at all: its exporter emits no
input_types key whatsoever, so this flag is its only route to an input object.
relay: boolWhether this type implements the Relay Node interface.
When true, the compiler generates global node IDs (base64("TypeName:uuid"))
and validates that pk_{entity} (BIGINT) is present in the view’s data JSONB.
embedded: boolWhether the author declared this an embedded value object
(@fraiseql.type(embedded=True), #687).
A value object has no independent identity and is always nested under a parent
entity, so the compiler exempts it from cascade entity classification: no
id: ID! enforcement, no auto-implements CascadeNode. Threaded verbatim to
TypeDefinition.embedded — it is the author’s declaration, not something the
compiler infers.
subscribable_tables: Option<Vec<String>>@subscribable(tables=[...]) — the underlying base table(s) whose external
writes should be captured onto the Change Spine (#366).
The compiler aggregates the set of (name, tables) for every type carrying
this into CompiledSchema.subscribable, which the
generate_capture_trigger_ddl generator turns into per-table capture
triggers. None/absent (the default) when the type is not subscribable.
§Example
{
"name": "Post",
"fields": [],
"subscribable_tables": ["tb_post"]
}subscribable_pre_image: bool@subscribable(..., pre_image=True) — whether the capture triggers on this
type’s tables also record the changed entity’s pre-image (OLD) into
object_data_before, the out-of-band parity for a mutation’s
changelog_pre_image. Only meaningful alongside subscribable_tables;
false/absent (the default) captures the after-image only.
relationships: Vec<IntermediateRelationship>Relationships to other types, the declarations REST resource embedding follows (#1266).
Threaded verbatim to TypeDefinition.relationships. Until this key existed the
compiled field had no producer at all: every converter wrote the empty vector and
deny_unknown_fields above turned an SDK that emitted the key into a refusal of
the whole document — so ?select=posts(id,title), ?select=posts.count,
?posts.status=, the OpenAPI relationship properties and the generated
relationships.* client modules were reachable only from a hand-written
schema.compiled.json.
A relationship the embed executor could not follow — an undeclared target, a join
column no field publishes, a target no list query returns — is refused at compile
time and again when the compiled schema loads. That check is the durable half:
#1230 was a join key the projection omitted, served as null under a 200.
subscription_policy: Option<SubscriptionPolicy>Per-row visibility for this type’s subscription deliveries: a subscriber receives a
row only when the row’s owner_path field equals its enriched identity_field,
unless it holds one of bypass_roles. Threaded verbatim to
TypeDefinition.subscription_policy; the owner field must be a single-level field of
this type, checked at compile.
Trait Implementations§
Source§impl Clone for IntermediateType
impl Clone for IntermediateType
Source§impl Debug for IntermediateType
impl Debug for IntermediateType
Source§impl Default for IntermediateType
impl Default for IntermediateType
Source§impl<'de> Deserialize<'de> for IntermediateType
impl<'de> Deserialize<'de> for IntermediateType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for IntermediateType
Source§impl PartialEq for IntermediateType
impl PartialEq for IntermediateType
Source§impl Serialize for IntermediateType
impl Serialize for IntermediateType
impl StructuralPartialEq for IntermediateType
Auto Trait Implementations§
impl Freeze for IntermediateType
impl RefUnwindSafe for IntermediateType
impl Send for IntermediateType
impl Sync for IntermediateType
impl Unpin for IntermediateType
impl UnsafeUnpin for IntermediateType
impl UnwindSafe for IntermediateType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Send for Twhere
T: ?Sized,
impl<T> Sync for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.