Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow empty records for JSON generation #216

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jaredponn
Copy link
Collaborator

@jaredponn jaredponn commented Apr 9, 2024

This PR removes the restriction of generating code instances for only non empty JSON objects.

Indeed, the empty JSON object

{}

is valid JSON, so schemas like

record MyEmptyRecord = { }

derive Json MyEmptyRecord

should be valid.

@jaredponn jaredponn force-pushed the jared/allow-empty-records branch from 0dcef38 to 2954fd9 Compare April 9, 2024 07:33
@jaredponn jaredponn marked this pull request as ready for review April 9, 2024 07:53
Copy link
Contributor

@bladyjoker bladyjoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

record MyEmptyRecord = { }

Is not something LB can swallow at the moment. Why? I don't recall exactly, but it was a decision that spanned parts from the Compiler to the Codegen. Nowadays, I think we error on empty records, and we have no syntax for empty products.

However, I don't think this change is problematic. If anything, when we introduce empty product/records this would then just work.

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