Skip to content

Allow unions to have metadata#312

Open
parched wants to merge 2 commits into
planus-org:mainfrom
parched:union-metadata
Open

Allow unions to have metadata#312
parched wants to merge 2 commits into
planus-org:mainfrom
parched:union-metadata

Conversation

@parched

@parched parched commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

Note: this doesn't do anything with the metadata,
but it's useful for sharing the schema with another tool that does use them.

It's unclear to how I should add a test for this.
It's not considered entirely valid because the attributes are unknown (I ignore these errors for my fbs files)

Checklist

  • Updated CHANGELOG.md with relevant changes
  • Added tests for any new/fixed functionality
  • Added/updated documentation for new/changed code
  • Checked that README.md still makes sense (and updated it if necessary)

@TethysSvensson

Copy link
Copy Markdown
Collaborator

I don't like just parsing and then throwing out the metadata. It at least needs to go into the cst, so the formatter can see it.

I also think it makes sense to validate it (and then reject it because we don't understand it).

@TethysSvensson

Copy link
Copy Markdown
Collaborator

Are you still interested in finishing this? :)

@parched

parched commented Oct 13, 2025

Copy link
Copy Markdown
Contributor Author

I will get around to it when I have some spare time, but I'm more than happy if someone else wants to pick it up.

parched and others added 2 commits May 6, 2026 13:27
Allow parsing union variant metadata, preserve it in CST/formatter, and reject it semantically
* Parse and keep metadata on union variants in the CST so formatting can round-trip it.
* Update formatter handling so union variant metadata is visible to formatting logic instead of being discarded.
* Add semantic validation that rejects union variant metadata with a clear error.
* Current behavior: union variant metadata syntax is accepted by the parser, but no metadata keys are supported semantically yet.

Note: AI was used in some of this.
@parched parched marked this pull request as ready for review May 6, 2026 02:09
@parched

parched commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

@TethysSvensson I've finally updated the PR to handle the variant metadata in the CST/formatter.

Note: I used AI for some of this. Hope that's alright!

@parched parched mentioned this pull request May 6, 2026
4 tasks
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.

2 participants