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: recognize immutable fields in lists #227

Closed
wants to merge 8 commits into from

Conversation

JulissaDantes
Copy link
Contributor

@JulissaDantes JulissaDantes commented Jul 24, 2024

Description

In the current version a field declared as uniqueListValue: [Int] @list(maxLength: 5) @immutable is not included in the ImmutableFields. This PR allows to identify these kinds of declarations.

@JulissaDantes JulissaDantes mentioned this pull request Jul 24, 2024
Copy link
Contributor

@stbrody stbrody left a comment

Choose a reason for hiding this comment

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

are there any tests of actually trying to update a MID with a model using @immutable? The test in this PR is really just unit testing the parser rather than the actual user-visible behavior

@JulissaDantes JulissaDantes requested a review from stbrody July 24, 2024 20:15
Copy link
Contributor

@stbrody stbrody left a comment

Choose a reason for hiding this comment

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

lgtm, though I still think it'd be good for Paul to take a look.

Also CI is broken

packages/devtools/src/schema/parser.ts Outdated Show resolved Hide resolved
packages/runtime/test/runtime.test.ts Outdated Show resolved Hide resolved
expect(res2.errors![0].message).toEqual(
`Variable "$i" got invalid value { title: "A different title" } at "i.content"; Field "title" is not defined by type "PartialPostInput". Did you mean "date"?`,
)
expect(res2.errors![1].message).toContain(
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really like the idea of testing the immutable fields handling based on parsing GraphQL queries, this seems pretty fragile.
I think instead there should be a direct call to the Ceramic server trying to make an update to an immutable field and getting the matching error message, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. FYI I'll close this PR, rebasing from main didnt helped, but I created a new branch branch with the changes(missing this last change) and I'll ask for a review on the new one that doesnt seem to have the CI issue

@JulissaDantes JulissaDantes marked this pull request as draft July 25, 2024 15:17
@JulissaDantes
Copy link
Contributor Author

Marking as draft until I fix the CI

@JulissaDantes
Copy link
Contributor Author

Ci fixed here: #228

@PaulLeCam PaulLeCam mentioned this pull request Jul 26, 2024
1 task
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