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

fix(gen): attach the full record schema to the type, including default value #1

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

stonalbot
Copy link

No description provided.

@stonalbot stonalbot added automerge Automatically merge this PR (and update it) nodraft This PR is not a draft bug Something isn't working labels Jul 16, 2024
gen/gen.go Outdated
Comment on lines 279 to 281
schemaBytes, _ := schema.MarshalJSON()
g.typedefs = append(g.typedefs, newType(typeName, schema.Doc(), fields, string(schemaBytes)))

Choose a reason for hiding this comment

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

Funny that the stringify does not include default value instead of JSON serialization.

Copy link

Choose a reason for hiding this comment

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

Yeah, the string function returns the canonical form of the schema which does not include the default value sadly.
See: hamba#115 for reference which is the issue that gave birth to the MarshalJSON function

@fcote fcote force-pushed the fix/attach-complete-schema-to-types branch 3 times, most recently from 591f473 to f8b7fc7 Compare July 16, 2024 10:41
@fcote fcote force-pushed the fix/attach-complete-schema-to-types branch from f8b7fc7 to 804e007 Compare July 16, 2024 10:41
@fcote fcote added the autoapprove Automatically approve this PR (to bypass branch protection rules) label Jul 16, 2024
@fcote fcote merged commit 47f042a into main Jul 16, 2024
2 checks passed
@fcote fcote deleted the fix/attach-complete-schema-to-types branch July 16, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autoapprove Automatically approve this PR (to bypass branch protection rules) automerge Automatically merge this PR (and update it) bug Something isn't working nodraft This PR is not a draft
Development

Successfully merging this pull request may close these issues.

3 participants