Skip to content

Commit

Permalink
fix: recognize immutable fields in lists
Browse files Browse the repository at this point in the history
  • Loading branch information
JulissaDantes committed Jul 24, 2024
1 parent 9a94e99 commit feef618
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/devtools/src/schema/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export class SchemaParser {
immutableFields: Array.from(
new Set(
Object.keys(object.properties)
.filter((key) => object.properties[key].immutable === true)
.filter((key) => object.properties[key].immutable === true || object.properties[key].item && object.properties[key].item.immutable)
.concat(inheritedImmutableFields),
),
),
Expand Down
3 changes: 2 additions & 1 deletion packages/devtools/test/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ describe('schema parsing and compilation', () => {
) {
uniqueValue: Int @immutable
tag: String! @string(minLength: 1, maxLength: 100)
uniqueListValue: [Int] @list(maxLength: 5) @immutable
}
`),
).toMatchObject({
Expand All @@ -803,7 +804,7 @@ describe('schema parsing and compilation', () => {
action: 'create',
model: {
name: 'ModelWithImmutableProp',
immutableFields: ['uniqueValue'],
immutableFields: ['uniqueValue', 'uniqueListValue'],
accountRelation: { type: 'single' },
description: 'Test model with an immutable int property',
schema: {
Expand Down

0 comments on commit feef618

Please sign in to comment.