Repository navigation
Conversation
|
Schema Diff vs Published Schemas
|
fbb0627 to
eee9085
Compare
🚀 Following releases will be created using changesets from this PR:openapi@3.10.0Minor Changes
Patch Changes
|
The union's description ("discriminated by its `source` property") doesn't fit a flat object.
The flat description says which properties each `source` can have and that a missing `source` means `device`.
Note
Schema review prototype, do not merge. This is to test the schema
Eventsplit (EventDevice | EventEdge) as part of reviewing koala#18895.INTER-2457 | stacked on #493 | port of closed spike #465 | koala#18895
Why
Python, PHP, Go, Java and .NET can't take the
EventDevice | EventEdgeunion without a breaking change. This PR flattensEventback into one object for them, so their generated code stays the same, while Node and the docs keep the union.Things to note
liftOneOfSharedProperties/resolveAllOf. Each variant definessourceas$ref: EventSourceplus a siblingconst. Ifsourcegets rewritten intoallOf: [$ref, const]first,resolveAllOfinlines it astype: string, enum, which breaks the SDKs. A guard test pins this down.Eventdiffer only indescription: flat SDKs get their own text saying which properties eachsourcecan have, and that a missingsourcemeansdevice. Properties, order,$refs,x-platformsandrequiredall match.liftOneOfchange (it also inlinedEventSourcefor Node and the docs), itsEventBaseschema edits (the schema now comes from INTER-2457: [schema review prototype] Sync v4 Event union from koala#18895 #493), and removingremoveEdgeTransformer(/edgestays out of the SDK schemas).Change outline
Which schema each SDK gets:
fingerprint-server-api-v4.yaml Node, docs Event = EventDevice | EventEdge (same as #493's build) + fingerprint-server-api-v4-flat.yaml Python, PHP Event flat, source optional fingerprint-server-api-v4-normalized.yaml Go, Java, .NET Event flat, source optional (+ start/end split, as before)Transformer order for the flat and normalized outputs (transformSchema.ts):
The flattened
Event:sourcestays optional in flat SDKs because the publishedEventhas it optional, and making it required would break them. Customers also load stored webhooks and events through these models, and payloads stored beforesourceexisted don't have it. The union variants requiresourceonly because a discriminator should be required, and a flatEventhas no discriminator. Requiring it is left for the next major SDK version, which would switch to the union and treat a missingsourceasdevice.Files: