Skip to content

Conversation

@wdantuma
Copy link

This PR adds union as a type allowed in definitions so it behaves the same as the indigo implementation does ( goat )

@wdantuma wdantuma changed the title Allow unions as definitions atproto/lexicon:Allow unions as definitions Oct 17, 2025
@notjuliet
Copy link

I'll share what I've been told on why that might not be a desired behavior:

basically you can't really determine the link between app.bsky.feed.post#foo and app.bsky.feed.post#main if main is a union type linking to foo, was foo the result of creating an object with main? or the result of itself? the $type field cannot convey this info

@wdantuma
Copy link
Author

I understand that is a problem, and disallowing unions for main would not be a problem at all, actually I will update the PR for it, but not being able to reuse a predefined union is ( for me ) a big issue for lexicon reuse, I ( and I guess more people ) have a lot of use cases with large unions (more than 10 types), and always needing to copy their definitions in types that use the union would be very developer unfriendly.

@wdantuma
Copy link
Author

Added test to check if union as main definition is still invalid

@wdantuma
Copy link
Author

@bnewbold, @devinivy Is this a correct fix for this issue ?

@bnewbold
Copy link
Collaborator

I'm still mulling this over. I expect us to have it settled in the next month or two.

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.

3 participants