getsentry / sentry-kafka-schemas

https://getsentry.github.io/sentry-kafka-schemas/
Other
4 stars 1 forks source link

Shared $ref between schemas #81

Open lynnagara opened 1 year ago

lynnagara commented 1 year ago

When defining the transactions schema, I noticed there was a lot of copy/paste from events. The reason for this is that the bulk of the schema definition related to the contexts object, which is fairly complex and also entirely the same in the two schemas.

It would be great if we can define these subschemas in one place and resolve them from multiple other schemas.

untitaker commented 1 year ago

I think the way to achieve this is to implement a kind of schema preprocessor that combines multiple schemas into one. Now schemas have a compilation step.

A lot of tooling directly reads the JSON files, and that'll have to be changed. off the top of my head, json-schema-diff lint, type generator(s) and the actual published packages themselves use different methods each to load those files.

Probably at least a week's worth of work.