opral / lix-sdk

1 stars 0 forks source link

Add `plugin.schema`? #37

Open samuelstroschein opened 4 weeks ago

samuelstroschein commented 4 weeks ago

Context

Add plugin.schema: JSONSchema for runtime reflection of the types and runtime validation (ensuring that the history is not broken?

Pros

image.png
samuelstroschein commented 3 weeks ago

If https://github.com/opral/lix-sdk/issues/42 is accepted, the schema would be payloadSchema without the nesting of types.

Here is an example payload schema for the inlang plugin if LIX-109 is accepted.

const plugin = {
  payloadKey: "inlang",
  payloadSchema: {
    snapshot: [bundle, bundleV2, message, variant]
  }
}
samuelstroschein commented 2 weeks ago

The schema key doesn't seem to be needed. The type can point to schema information.

The current proposal proposes a schema key that points to a schema with multiple types. What if we simply define type as "you point to a type"?

id: "change2",
file_id: "mock",
-schema_key: "opral-csv",
-type: "cell"
+schema: "opral-csv-cell",