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

Null unsafety should be explained #228

Open
Hugo-Trentesaux opened this issue Feb 9, 2024 · 0 comments
Open

Null unsafety should be explained #228

Hugo-Trentesaux opened this issue Feb 9, 2024 · 0 comments

Comments

@Hugo-Trentesaux
Copy link

In this changelog: https://github.com/subsquid/squid-sdk/blob/master/typeorm/typeorm-codegen/CHANGELOG.md

I see multiple references to the fact that non-nullable fields are allowed to be null:

make unique fk fields always nullable
(in 1.3)

always accept null column values to workaround TypeORM issue - field transformation can be run for a null entity
(in 0.2.3)

make entity references always nullable in the database
(in 0.1.0)

I think this is counter-intuitive. For instance:

# this line in the graphql schema
createdIn: Event!

gives

// this line in the typeorm model
@ManyToOne_(() => Event, {nullable: true})
    createdIn!: Event

where there is a mismatch between {nullable: true} annotation and createdIn! exclamation mark.

It should be added to the documentation page https://docs.subsquid.io/sdk/reference/schema-file/intro/

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

No branches or pull requests

2 participants
@Hugo-Trentesaux and others