Skip to content

Commit

Permalink
Fix list operation dispatched fields
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed Apr 13, 2024
1 parent f465d04 commit 7cb1c03
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion java/1.20.5/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mcschema/java-1.20.5",
"version": "0.0.22",
"version": "0.0.24",
"description": "Schemas for Java Edition 1.20.5",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
16 changes: 6 additions & 10 deletions java/1.20.5/src/schemas/Common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,16 +511,12 @@ export function initCommonSchemas(schemas: SchemaRegistry, collections: Collecti

const ListOperationFields = ({ maxLength }: { maxLength: number }) => ({
mode: StringNode({ enum: 'list_operation' }),
[Switch]: [{ push: 'mode' }],
[Case]: {
'insert': {
offset: Opt(NumberNode({ integer: true, min: 0 })),
},
'replace_section': {
offset: Opt(NumberNode({ integer: true, min: 0 })),
size: Opt(NumberNode({ integer: true, min: 0, max: maxLength })),
},
}
offset: Opt(Mod(NumberNode({ integer: true, min: 0 }), {
enabled: (path) => ['insert', 'replace_section'].includes(path.push("mode").get())
})),
size: Opt(Mod(NumberNode({ integer: true, min: 0, max: maxLength }), {
enabled: (path) => ['replace_section'].includes(path.push("mode").get())
})),
})

ConditionCases = (entitySourceNode: INode<any> = StringNode({ enum: 'entity_source' })) => ({
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7cb1c03

Please sign in to comment.