@cobbled-creators/cobblemon-schemas 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +68 -0
  3. package/bin/cobblemon-schemas.mjs +51 -0
  4. package/dist/bundle.json +1 -0
  5. package/dist/validators.mjs +3 -0
  6. package/package.json +66 -0
  7. package/schemas/_shared/common.schema.json +89 -0
  8. package/schemas/_shared/defs/collections.schema.json +32 -0
  9. package/schemas/_shared/defs/drops.schema.json +89 -0
  10. package/schemas/_shared/defs/expressions.schema.json +82 -0
  11. package/schemas/_shared/defs/identifiers.schema.json +24 -0
  12. package/schemas/_shared/defs/npc.schema.json +76 -0
  13. package/schemas/_shared/defs/pokemon.schema.json +41 -0
  14. package/schemas/_shared/defs/ranges.schema.json +70 -0
  15. package/schemas/_shared/defs/ride.schema.json +77 -0
  16. package/schemas/_shared/defs/spawning.schema.json +183 -0
  17. package/schemas/_shared/defs/vectors.schema.json +44 -0
  18. package/schemas/action_effects/schema.json +123 -0
  19. package/schemas/bedrock_pokemon_resolvers/schema.json +184 -0
  20. package/schemas/bedrock_posers/schema.json +367 -0
  21. package/schemas/behaviours/schema.json +145 -0
  22. package/schemas/berries/schema.json +178 -0
  23. package/schemas/cosmetic_items/schema.json +55 -0
  24. package/schemas/dex_additions/schema.json +22 -0
  25. package/schemas/dex_entries/schema.json +83 -0
  26. package/schemas/dex_entry_additions/schema.json +63 -0
  27. package/schemas/dexes/schema.json +89 -0
  28. package/schemas/dialogues/schema.json +260 -0
  29. package/schemas/fossils/schema.json +22 -0
  30. package/schemas/global_species_features/schema.json +6 -0
  31. package/schemas/index.json +244 -0
  32. package/schemas/marks/schema.json +49 -0
  33. package/schemas/mechanics/aprijuices.schema.json +25 -0
  34. package/schemas/mechanics/berries.schema.json +35 -0
  35. package/schemas/mechanics/potions.schema.json +23 -0
  36. package/schemas/mechanics/remedies.schema.json +31 -0
  37. package/schemas/mechanics/slowpoke_tails.schema.json +17 -0
  38. package/schemas/natural_materials/schema.json +40 -0
  39. package/schemas/npc_presets/schema.json +6 -0
  40. package/schemas/npcs/schema.json +443 -0
  41. package/schemas/pokemon_interactions/schema.json +169 -0
  42. package/schemas/pokerods/schema.json +19 -0
  43. package/schemas/ride_settings/bird.schema.json +48 -0
  44. package/schemas/ride_settings/boat.schema.json +45 -0
  45. package/schemas/ride_settings/burst.schema.json +11 -0
  46. package/schemas/ride_settings/dolphin.schema.json +45 -0
  47. package/schemas/ride_settings/glider.schema.json +18 -0
  48. package/schemas/ride_settings/helicopter.schema.json +21 -0
  49. package/schemas/ride_settings/horse.schema.json +36 -0
  50. package/schemas/ride_settings/hover.schema.json +33 -0
  51. package/schemas/ride_settings/jet.schema.json +42 -0
  52. package/schemas/ride_settings/minekart.schema.json +33 -0
  53. package/schemas/ride_settings/rocket.schema.json +36 -0
  54. package/schemas/ride_settings/submarine.schema.json +33 -0
  55. package/schemas/ride_settings/vehicle.schema.json +45 -0
  56. package/schemas/seasonings/schema.json +124 -0
  57. package/schemas/spawn_bait_effects/schema.json +42 -0
  58. package/schemas/spawn_detail_presets/schema.json +79 -0
  59. package/schemas/spawn_pool_world/schema.json +455 -0
  60. package/schemas/spawn_rules/schema.json +217 -0
  61. package/schemas/species/schema.json +1043 -0
  62. package/schemas/species_additions/schema.json +22 -0
  63. package/schemas/species_feature_assignments/schema.json +25 -0
  64. package/schemas/species_features/schema.json +139 -0
  65. package/schemas/starters/schema.json +28 -0
  66. package/schemas/unlockable_pc_box_wallpapers/schema.json +29 -0
  67. package/src/errors/format.mjs +46 -0
  68. package/src/errors/pointer.mjs +30 -0
  69. package/src/errors/simplify.mjs +58 -0
  70. package/src/errors/type-branches.mjs +65 -0
  71. package/src/errors/values.mjs +7 -0
  72. package/src/index.d.ts +74 -0
  73. package/src/index.mjs +6 -0
  74. package/src/json/line-index.mjs +21 -0
  75. package/src/json/parse-json.mjs +28 -0
  76. package/src/json/syntax-errors.mjs +56 -0
  77. package/src/node/load-engine.mjs +30 -0
  78. package/src/node/load-schemas.mjs +35 -0
  79. package/src/node/package-info.mjs +10 -0
  80. package/src/node/read-pack.mjs +18 -0
  81. package/src/node.d.ts +13 -0
  82. package/src/node.mjs +5 -0
  83. package/src/schema-engine.mjs +43 -0
  84. package/src/schema-index.mjs +54 -0
  85. package/src/validate-pack.mjs +28 -0
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@cobbled-creators/cobblemon-schemas",
3
+ "version": "1.7.0",
4
+ "description": "JSON Schemas for Cobblemon datapack and resource pack files, and a validator that knows which schema each pack file uses. One release line per Cobblemon version.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/cobbled-creators/cobblemon-schemas.git"
10
+ },
11
+ "homepage": "https://github.com/cobbled-creators/cobblemon-schemas#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/cobbled-creators/cobblemon-schemas/issues"
14
+ },
15
+ "keywords": [
16
+ "cobblemon",
17
+ "minecraft",
18
+ "datapack",
19
+ "json-schema",
20
+ "validation"
21
+ ],
22
+ "cobblemon": {
23
+ "version": "1.7",
24
+ "minecraft": "1.21.1",
25
+ "baseline": "1.7.3"
26
+ },
27
+ "exports": {
28
+ ".": {
29
+ "types": "./src/index.d.ts",
30
+ "default": "./src/index.mjs"
31
+ },
32
+ "./node": {
33
+ "types": "./src/node.d.ts",
34
+ "default": "./src/node.mjs"
35
+ },
36
+ "./bundle.json": "./dist/bundle.json",
37
+ "./validators.mjs": "./dist/validators.mjs",
38
+ "./schemas/*": "./schemas/*",
39
+ "./package.json": "./package.json"
40
+ },
41
+ "bin": {
42
+ "cobblemon-schemas": "./bin/cobblemon-schemas.mjs"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "files": [
48
+ "bin",
49
+ "dist",
50
+ "schemas",
51
+ "src"
52
+ ],
53
+ "scripts": {
54
+ "build": "node scripts/build.mjs",
55
+ "test": "npm run build && node --test test/*.test.mjs",
56
+ "baseline": "node scripts/baseline.mjs",
57
+ "prepack": "npm run build"
58
+ },
59
+ "engines": {
60
+ "node": ">=24"
61
+ },
62
+ "dependencies": {
63
+ "ajv": "8.20.0",
64
+ "jsonc-parser": "3.3.1"
65
+ }
66
+ }
@@ -0,0 +1,89 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cobblemon-schema.local/_shared/common.schema.json",
4
+ "title": "Cobblemon Shared Definitions",
5
+ "type": "object",
6
+ "$defs": {
7
+ "nonEmptyString": {
8
+ "$ref": "./defs/identifiers.schema.json#/$defs/nonEmptyString"
9
+ },
10
+ "resourceLocation": {
11
+ "$ref": "./defs/identifiers.schema.json#/$defs/resourceLocation"
12
+ },
13
+ "identifier": {
14
+ "$ref": "./defs/identifiers.schema.json#/$defs/identifier"
15
+ },
16
+ "booleanLike": {
17
+ "$ref": "./defs/expressions.schema.json#/$defs/booleanLike"
18
+ },
19
+ "expressionLike": {
20
+ "$ref": "./defs/expressions.schema.json#/$defs/expressionLike"
21
+ },
22
+ "tagIdentifier": {
23
+ "$ref": "./defs/identifiers.schema.json#/$defs/tagIdentifier"
24
+ },
25
+ "actionList": {
26
+ "$ref": "./defs/expressions.schema.json#/$defs/actionList"
27
+ },
28
+ "intRangeString": {
29
+ "$ref": "./defs/ranges.schema.json#/$defs/intRangeString"
30
+ },
31
+ "intRange": {
32
+ "$ref": "./defs/ranges.schema.json#/$defs/intRange"
33
+ },
34
+ "intMinMax": {
35
+ "$ref": "./defs/ranges.schema.json#/$defs/intMinMax"
36
+ },
37
+ "numberMinMax": {
38
+ "$ref": "./defs/ranges.schema.json#/$defs/numberMinMax"
39
+ },
40
+ "vec3": {
41
+ "$ref": "./defs/vectors.schema.json#/$defs/vec3"
42
+ },
43
+ "positioning": {
44
+ "$ref": "./defs/vectors.schema.json#/$defs/positioning"
45
+ },
46
+ "stringList": {
47
+ "$ref": "./defs/collections.schema.json#/$defs/stringList"
48
+ },
49
+ "stringIntMap": {
50
+ "$ref": "./defs/collections.schema.json#/$defs/stringIntMap"
51
+ },
52
+ "stringNumberMap": {
53
+ "$ref": "./defs/collections.schema.json#/$defs/stringNumberMap"
54
+ },
55
+ "stringStringMap": {
56
+ "$ref": "./defs/collections.schema.json#/$defs/stringStringMap"
57
+ },
58
+ "pokemonProperties": {
59
+ "$ref": "./defs/pokemon.schema.json#/$defs/pokemonProperties"
60
+ },
61
+ "itemPredicate": {
62
+ "$ref": "./defs/pokemon.schema.json#/$defs/itemPredicate"
63
+ },
64
+ "registryLikeCondition": {
65
+ "$ref": "./defs/pokemon.schema.json#/$defs/registryLikeCondition"
66
+ },
67
+ "dropEntry": {
68
+ "$ref": "./defs/drops.schema.json#/$defs/dropEntry"
69
+ },
70
+ "dropTable": {
71
+ "$ref": "./defs/drops.schema.json#/$defs/dropTable"
72
+ },
73
+ "spawningCondition": {
74
+ "$ref": "./defs/spawning.schema.json#/$defs/spawningCondition"
75
+ },
76
+ "weightMultiplier": {
77
+ "$ref": "./defs/spawning.schema.json#/$defs/weightMultiplier"
78
+ },
79
+ "variableDefinition": {
80
+ "$ref": "./defs/npc.schema.json#/$defs/variableDefinition"
81
+ },
82
+ "seatOffset": {
83
+ "$ref": "./defs/ride.schema.json#/$defs/seatOffset"
84
+ },
85
+ "seat": {
86
+ "$ref": "./defs/ride.schema.json#/$defs/seat"
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cobblemon-schema.local/_shared/defs/collections.schema.json",
4
+ "title": "Cobblemon Shared Collections",
5
+ "type": "object",
6
+ "$defs": {
7
+ "stringList": {
8
+ "type": "array",
9
+ "items": {
10
+ "type": "string"
11
+ }
12
+ },
13
+ "stringIntMap": {
14
+ "type": "object",
15
+ "additionalProperties": {
16
+ "type": "integer"
17
+ }
18
+ },
19
+ "stringNumberMap": {
20
+ "type": "object",
21
+ "additionalProperties": {
22
+ "type": "number"
23
+ }
24
+ },
25
+ "stringStringMap": {
26
+ "type": "object",
27
+ "additionalProperties": {
28
+ "type": "string"
29
+ }
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,89 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cobblemon-schema.local/_shared/defs/drops.schema.json",
4
+ "title": "Cobblemon Shared Drop Tables",
5
+ "type": "object",
6
+ "$defs": {
7
+ "dropEntry": {
8
+ "type": "object",
9
+ "properties": {
10
+ "type": {
11
+ "type": "string",
12
+ "enum": [
13
+ "item",
14
+ "command",
15
+ "evolution"
16
+ ]
17
+ },
18
+ "item": {
19
+ "type": "string"
20
+ },
21
+ "percentage": {
22
+ "type": "number"
23
+ },
24
+ "quantity": {
25
+ "type": "integer"
26
+ },
27
+ "quantityRange": {
28
+ "$ref": "./ranges.schema.json#/$defs/intRange"
29
+ },
30
+ "maxSelectableTimes": {
31
+ "type": "integer"
32
+ },
33
+ "dropMethod": {
34
+ "type": "string",
35
+ "enum": [
36
+ "on-entity",
37
+ "on-player",
38
+ "to-inventory"
39
+ ]
40
+ },
41
+ "components": {
42
+ "type": "object",
43
+ "additionalProperties": true
44
+ },
45
+ "requirements": {
46
+ "type": "array",
47
+ "items": {
48
+ "type": "object",
49
+ "properties": {
50
+ "variant": {
51
+ "type": "string"
52
+ }
53
+ },
54
+ "required": [
55
+ "variant"
56
+ ],
57
+ "additionalProperties": true
58
+ }
59
+ },
60
+ "requiresPlayer": {
61
+ "type": "boolean"
62
+ },
63
+ "command": {
64
+ "type": "string"
65
+ }
66
+ },
67
+ "additionalProperties": true
68
+ },
69
+ "dropTable": {
70
+ "type": "object",
71
+ "properties": {
72
+ "amount": {
73
+ "$ref": "./ranges.schema.json#/$defs/intRange"
74
+ },
75
+ "entries": {
76
+ "type": "array",
77
+ "items": {
78
+ "$ref": "./drops.schema.json#/$defs/dropEntry"
79
+ }
80
+ }
81
+ },
82
+ "required": [
83
+ "amount",
84
+ "entries"
85
+ ],
86
+ "additionalProperties": false
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,82 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cobblemon-schema.local/_shared/defs/expressions.schema.json",
4
+ "title": "Cobblemon Shared Expressions",
5
+ "type": "object",
6
+ "$defs": {
7
+ "booleanLike": {
8
+ "oneOf": [
9
+ {
10
+ "type": "boolean"
11
+ },
12
+ {
13
+ "type": "string",
14
+ "enum": [
15
+ "true",
16
+ "false"
17
+ ]
18
+ }
19
+ ]
20
+ },
21
+ "expressionLike": {
22
+ "anyOf": [
23
+ {
24
+ "type": "string"
25
+ },
26
+ {
27
+ "type": "number"
28
+ },
29
+ {
30
+ "type": "integer"
31
+ },
32
+ {
33
+ "type": "boolean"
34
+ },
35
+ {
36
+ "type": "array",
37
+ "items": {
38
+ "anyOf": [
39
+ {
40
+ "type": "string"
41
+ },
42
+ {
43
+ "type": "number"
44
+ },
45
+ {
46
+ "type": "integer"
47
+ },
48
+ {
49
+ "type": "boolean"
50
+ }
51
+ ]
52
+ }
53
+ },
54
+ {
55
+ "type": "object",
56
+ "properties": {
57
+ "type": {
58
+ "type": "string"
59
+ },
60
+ "expression": {
61
+ "type": "string"
62
+ }
63
+ },
64
+ "additionalProperties": true
65
+ }
66
+ ]
67
+ },
68
+ "actionList": {
69
+ "oneOf": [
70
+ {
71
+ "type": "string"
72
+ },
73
+ {
74
+ "type": "array",
75
+ "items": {
76
+ "type": "string"
77
+ }
78
+ }
79
+ ]
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cobblemon-schema.local/_shared/defs/identifiers.schema.json",
4
+ "title": "Cobblemon Shared Identifiers",
5
+ "type": "object",
6
+ "$defs": {
7
+ "nonEmptyString": {
8
+ "type": "string",
9
+ "minLength": 1
10
+ },
11
+ "resourceLocation": {
12
+ "type": "string",
13
+ "pattern": "^[a-z0-9_.-]+:[a-z0-9_./-]+$"
14
+ },
15
+ "identifier": {
16
+ "type": "string",
17
+ "pattern": "^(?:[a-z0-9_.-]+:)?[a-z0-9_./-]+$"
18
+ },
19
+ "tagIdentifier": {
20
+ "type": "string",
21
+ "pattern": "^#(?:[a-z0-9_.-]+:)?[a-z0-9_./-]+$"
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,76 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cobblemon-schema.local/_shared/defs/npc.schema.json",
4
+ "title": "Cobblemon Shared NPC Definitions",
5
+ "type": "object",
6
+ "$defs": {
7
+ "variableDefinition": {
8
+ "type": "object",
9
+ "properties": {
10
+ "variableName": {
11
+ "type": "string"
12
+ },
13
+ "category": {
14
+ "oneOf": [
15
+ {
16
+ "type": "string"
17
+ },
18
+ {
19
+ "type": "object",
20
+ "additionalProperties": true
21
+ }
22
+ ]
23
+ },
24
+ "displayName": {
25
+ "oneOf": [
26
+ {
27
+ "type": "string"
28
+ },
29
+ {
30
+ "type": "object",
31
+ "additionalProperties": true
32
+ }
33
+ ]
34
+ },
35
+ "description": {
36
+ "oneOf": [
37
+ {
38
+ "type": "string"
39
+ },
40
+ {
41
+ "type": "object",
42
+ "additionalProperties": true
43
+ }
44
+ ]
45
+ },
46
+ "type": {
47
+ "type": "string"
48
+ },
49
+ "defaultValue": {
50
+ "anyOf": [
51
+ {
52
+ "type": "string"
53
+ },
54
+ {
55
+ "type": "boolean"
56
+ },
57
+ {
58
+ "type": "number"
59
+ },
60
+ {
61
+ "type": "integer"
62
+ }
63
+ ]
64
+ }
65
+ },
66
+ "required": [
67
+ "variableName",
68
+ "displayName",
69
+ "description",
70
+ "type",
71
+ "defaultValue"
72
+ ],
73
+ "additionalProperties": false
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cobblemon-schema.local/_shared/defs/pokemon.schema.json",
4
+ "title": "Cobblemon Shared Pokemon Primitives",
5
+ "type": "object",
6
+ "$defs": {
7
+ "pokemonProperties": {
8
+ "oneOf": [
9
+ {
10
+ "type": "string"
11
+ },
12
+ {
13
+ "type": "object",
14
+ "additionalProperties": true
15
+ }
16
+ ]
17
+ },
18
+ "itemPredicate": {
19
+ "oneOf": [
20
+ {
21
+ "type": "string"
22
+ },
23
+ {
24
+ "type": "object",
25
+ "additionalProperties": true
26
+ }
27
+ ]
28
+ },
29
+ "registryLikeCondition": {
30
+ "oneOf": [
31
+ {
32
+ "type": "string"
33
+ },
34
+ {
35
+ "type": "object",
36
+ "additionalProperties": true
37
+ }
38
+ ]
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cobblemon-schema.local/_shared/defs/ranges.schema.json",
4
+ "title": "Cobblemon Shared Ranges",
5
+ "type": "object",
6
+ "$defs": {
7
+ "intRangeString": {
8
+ "type": "string",
9
+ "pattern": "^-?\\d+(?:--?\\d+)?$"
10
+ },
11
+ "intRange": {
12
+ "oneOf": [
13
+ {
14
+ "type": "integer"
15
+ },
16
+ {
17
+ "$ref": "./ranges.schema.json#/$defs/intRangeString"
18
+ },
19
+ {
20
+ "type": "object",
21
+ "properties": {
22
+ "min": {
23
+ "type": "integer"
24
+ },
25
+ "max": {
26
+ "type": "integer"
27
+ }
28
+ },
29
+ "required": [
30
+ "min",
31
+ "max"
32
+ ],
33
+ "additionalProperties": false
34
+ }
35
+ ]
36
+ },
37
+ "intMinMax": {
38
+ "type": "object",
39
+ "properties": {
40
+ "min": {
41
+ "type": "integer"
42
+ },
43
+ "max": {
44
+ "type": "integer"
45
+ }
46
+ },
47
+ "required": [
48
+ "min",
49
+ "max"
50
+ ],
51
+ "additionalProperties": false
52
+ },
53
+ "numberMinMax": {
54
+ "type": "object",
55
+ "properties": {
56
+ "min": {
57
+ "type": "number"
58
+ },
59
+ "max": {
60
+ "type": "number"
61
+ }
62
+ },
63
+ "required": [
64
+ "min",
65
+ "max"
66
+ ],
67
+ "additionalProperties": false
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,77 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cobblemon-schema.local/_shared/defs/ride.schema.json",
4
+ "title": "Cobblemon Shared Riding Definitions",
5
+ "type": "object",
6
+ "$defs": {
7
+ "seatOffset": {
8
+ "type": "object",
9
+ "properties": {
10
+ "poseTypes": {
11
+ "type": "array",
12
+ "items": {
13
+ "type": "string"
14
+ }
15
+ },
16
+ "offset": {
17
+ "$ref": "./vectors.schema.json#/$defs/vec3"
18
+ }
19
+ },
20
+ "required": [
21
+ "poseTypes",
22
+ "offset"
23
+ ],
24
+ "additionalProperties": false
25
+ },
26
+ "seat": {
27
+ "type": "object",
28
+ "properties": {
29
+ "locator": {
30
+ "type": [
31
+ "string",
32
+ "null"
33
+ ]
34
+ },
35
+ "offset": {
36
+ "$ref": "./vectors.schema.json#/$defs/vec3"
37
+ },
38
+ "poseOffsets": {
39
+ "type": "array",
40
+ "items": {
41
+ "$ref": "./ride.schema.json#/$defs/seatOffset"
42
+ }
43
+ },
44
+ "poseAnimations": {
45
+ "type": "array",
46
+ "items": {
47
+ "type": "object",
48
+ "properties": {
49
+ "poseTypes": {
50
+ "type": "array",
51
+ "items": {
52
+ "type": "string"
53
+ }
54
+ },
55
+ "animations": {
56
+ "type": "array",
57
+ "items": {
58
+ "type": "object",
59
+ "additionalProperties": true
60
+ }
61
+ }
62
+ },
63
+ "required": [
64
+ "poseTypes",
65
+ "animations"
66
+ ],
67
+ "additionalProperties": false
68
+ }
69
+ },
70
+ "handsBusy": {
71
+ "type": "boolean"
72
+ }
73
+ },
74
+ "additionalProperties": false
75
+ }
76
+ }
77
+ }