Skip to content

[SPIKE option B] Event oneOf + hydrate missing source to device (INTER-2457) - #101

Closed
JuroUhlar wants to merge 3 commits into
mainfrom
spike/INTER-2457-event-oneof
Closed

JuroUhlar wants to merge 3 commits into
mainfrom
spike/INTER-2457-event-oneof

Conversation

@JuroUhlar

@JuroUhlar JuroUhlar commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor
  • Option B spike: unflattened Event oneOf wrapper (EventDevice | EventEdge, discriminator source).
  • Event.UnmarshalJSON inserts source=device when the key is absent (same as koala eventsource.HydrateMissing). Never rewrites source:edge or an existing source.
  • Isolated hydrate test in test/eventhydrate (the rest of test/ still does not compile on this spike).
  • Do not merge. Option C (flat Event, optional source) is PR 102.

Discussion point: hydrate in UnmarshalJSON

Stock codegen returns nil (both pointers unset) when source is missing. This post-generate edit rematerializes the JSON with source: device so EventDevice required-field checks pass and the device pointer is set.

Known issue: CI will fail

Examples and tests that read event.Identification are expected not to compile. That is the spike.

INTER-2457. Regenerated Event as a oneOf wrapper to show the compile break. Do not merge.
@github-actions

github-actions Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Template files and generated files are not in-sync.

Following files do not match corresponding templates:
internal/openapi/.openapi-generator-ignore internal/openapi/event_source.go internal/openapi/model_event.go models.go

To fix this warning, make sure template files are up-to-date, and generate files by running the following command:

./bin/openapi-codegen-docker.sh

@JuroUhlar JuroUhlar changed the title [SPIKE] Event oneOf discriminated union (INTER-2457) [SPIKE option B] Event oneOf + hydrate missing source to device (INTER-2457) Sep 6, 2026
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ This PR doesn't contain any changesets. If there are user-facing changes, don't forget to run:

pnpm exec changeset

to create a changeset.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Wrong commit message format detected

We use Semantic Commit Messages in our project.

Warning
Probably you forgot to activate local git hooks.

Run the next command in the project root to activate local hooks:

sh ./install_hooks.sh

More info you can find in job logs

Commitlint Errors

Commit: 6fcf7cc `chore: SPIKE Event oneOf discriminated union

INTER-2457. Regenerated Event as a oneOf wrapper to show the compile break. Do not merge.`
Errors:

  • subject must not be sentence-case, start-case, pascal-case, upper-case

@JuroUhlar
JuroUhlar marked this pull request as draft September 7, 2026 09:05
@JuroUhlar

Copy link
Copy Markdown
Contributor Author

This was a prototype done as part of a spike. Closing now, still usable as a reference during the production implementation.

@JuroUhlar JuroUhlar closed this Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant