Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

jaredponn
Copy link
Contributor

@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