From 28b4316df8c2b62375a67a44ebd8f670171a92fd Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Fri, 21 Nov 2025 17:39:59 -0800 Subject: [PATCH 01/25] Function mustache changes and tests --- .../bounds/__snapshots__/bounds.spec.ts.snap | 125 ++++++++++++++++++ .../test/bounds/bounds.spec.ts | 14 ++ .../test/bounds/docs/sentinel | 1 + .../test/bounds/input/test-module.json | 66 +++++++++ .../templates/tsdef/function.mustache | 6 + .../templates/tsdef/property.mustache | 8 ++ 6 files changed, 220 insertions(+) create mode 100644 tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap create mode 100644 tools/api-docs-generator-test-snapshots/test/bounds/bounds.spec.ts create mode 100644 tools/api-docs-generator-test-snapshots/test/bounds/docs/sentinel create mode 100644 tools/api-docs-generator-test-snapshots/test/bounds/input/test-module.json diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap b/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap new file mode 100644 index 0000000..7dc3ed5 --- /dev/null +++ b/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap @@ -0,0 +1,125 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Bounds > Properly generates documentation for modules which contain bounds > # Of Files Generated 1`] = `4`; + +exports[`Bounds > Properly generates documentation for modules which contain bounds > msdocs/scriptapi/TOC.yml 1`] = ` +" - name: bounds-module + items: + - name: bounds-module + href: bounds-module/bounds-module.md + - name: ClassWithBounds + href: bounds-module/ClassWithBounds.md +" +`; + +exports[`Bounds > Properly generates documentation for modules which contain bounds > msdocs/scriptapi/bounds-module/ClassWithBounds.md 1`] = ` +"--- +# DO NOT TOUCH — This file was automatically generated by @minecraft/api-docs-generator, to report problems file an issue at https://github.com/Mojang/minecraft-scripting-libraries +author: jakeshirley +ms.author: jashir +ms.service: minecraft-bedrock-edition +ms.date: 02/10/2025 +title: bounds-module.ClassWithBounds Class +description: Contents of the bounds-module.ClassWithBounds class. +--- +# ClassWithBounds Class + +## Properties + +### **boundProperty** +\`boundProperty?: boolean;\` + +Type: *boolean* + +Notes: + - This property can't be used in read-only mode. + +## Methods +- [methodThatTakesBoundedValue](#methodthattakesboundedvalue) + +### **methodThatTakesBoundedValue** +\` +methodThatTakesBoundedValue(amount?: number): void +\` + +#### **Parameters** +- **amount**?: *number* = \`1\` + +**Returns** *void* + +Notes: +- This function can't be called in read-only mode. +" +`; + +exports[`Bounds > Properly generates documentation for modules which contain bounds > msdocs/scriptapi/bounds-module/bounds-module.md 1`] = ` +"--- +# DO NOT TOUCH — This file was automatically generated by @minecraft/api-docs-generator, to report problems file an issue at https://github.com/Mojang/minecraft-scripting-libraries +author: jakeshirley +ms.author: jashir +ms.service: minecraft-bedrock-edition +ms.date: 02/10/2025 +title: bounds-module Module +description: Contents of the bounds-module module +--- +# \`bounds-module\` Module + +## Manifest Details +\`\`\`json +{ + "module_name": "bounds-module", + "version": "1.0.0" +} +\`\`\` +This is version 1.x.x of this module, which is the latest as of version 1.0.0 of Minecraft. + +## Available Versions +- \`1.0.0\` + +## Classes +- [ClassWithBounds](ClassWithBounds.md) +" +`; + +exports[`Bounds > Properly generates documentation for modules which contain bounds > typescript/bounds-module@1.0.0.d.ts 1`] = ` +"// Type definitions for Minecraft Bedrock Edition script APIs +// Project: https://docs.microsoft.com/minecraft/creator/ +// Definitions by: Jake Shirley +// Mike Ammerlaan + +/* ***************************************************************************** + Copyright (c) Microsoft Corporation. + ***************************************************************************** */ +/** + * @packageDocumentation + * + * Manifest Details + * \`\`\`json + * { + * "module_name": "bounds-module", + * "version": "1.0.0" + * } + * \`\`\` + * + */ +export class ClassWithBounds { + private constructor(); + /** + * @remarks + * This property can't be used in read-only mode. + * + */ + boundProperty?: boolean; + /** + * @remarks + * This function can't be called in read-only mode. + * + * @param amount + * Defaults to Sanity Check #2: 1 + * Minimum value: 1 + * Maximum value: 255 + */ + methodThatTakesBoundedValue(amount?: number): void; +} +" +`; diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/bounds.spec.ts b/tools/api-docs-generator-test-snapshots/test/bounds/bounds.spec.ts new file mode 100644 index 0000000..ea36e3b --- /dev/null +++ b/tools/api-docs-generator-test-snapshots/test/bounds/bounds.spec.ts @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { describe, it } from 'vitest'; +import { runGeneratorForTest } from '../runGeneratorForTest'; + +describe('Bounds', () => { + it('Properly generates documentation for modules which contain bounds', () => { + runGeneratorForTest({ + testDir: __dirname, + generators: ['ts', 'msdocs'], + }); + }); +}); diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/docs/sentinel b/tools/api-docs-generator-test-snapshots/test/bounds/docs/sentinel new file mode 100644 index 0000000..a5e30b1 --- /dev/null +++ b/tools/api-docs-generator-test-snapshots/test/bounds/docs/sentinel @@ -0,0 +1 @@ +// File exists to ensure docs folder exists diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module.json b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module.json new file mode 100644 index 0000000..3b31bdf --- /dev/null +++ b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module.json @@ -0,0 +1,66 @@ +{ + "classes": [ + { + "name": "ClassWithBounds", + "properties": [ + { + "is_read_only": false, + "name": "boundProperty", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "optional", + "optional_type": { + "is_bind_type": false, + "is_errorable": false, + "name": "boolean" + } + } + } + ], + "type": { + "is_bind_type": true, + "is_errorable": false, + "name": "ClassWithBounds" + }, + "functions": [ + { + "arguments": [ + { + "details": { + "default_value": 1, + "has_max": true, + "has_min": true, + "max_value": 255, + "min_value": 1 + }, + "name": "amount", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + } + ], + "is_constructor": false, + "name": "methodThatTakesBoundedValue", + "return_type": { + "is_bind_type": false, + "is_errorable": false, + "name": "void" + } + } + ] + } + ], + + "minecraft_version": "1.0.0", + "name": "bounds-module", + "uuid": "d79b396f-dc7a-46e0-97c5-a14434ab8dcd", + "version": "1.0.0", + "module_type": "script" +} diff --git a/tools/markup-generators-plugin/templates/tsdef/function.mustache b/tools/markup-generators-plugin/templates/tsdef/function.mustache index 9bba001..6fc0c59 100644 --- a/tools/markup-generators-plugin/templates/tsdef/function.mustache +++ b/tools/markup-generators-plugin/templates/tsdef/function.mustache @@ -45,6 +45,12 @@ * Defaults to: {{> value}} {{/details.default_value}} {{/has_defaults}} + {{#details.has_min}} + * Minimum value: {{details.min_value}} + {{/details.has_min}} + {{#details.has_max}} + * Maximum value: {{details.max_value}} + {{/details.has_max}} {{/ts_has_comments}} {{/arguments}} {{#returns_description_ts.length}} diff --git a/tools/markup-generators-plugin/templates/tsdef/property.mustache b/tools/markup-generators-plugin/templates/tsdef/property.mustache index 2033b93..5b3e2a5 100644 --- a/tools/markup-generators-plugin/templates/tsdef/property.mustache +++ b/tools/markup-generators-plugin/templates/tsdef/property.mustache @@ -62,6 +62,14 @@ * {{/default_value}} {{/has_defaults}} + {{#has_min}} + * Minimum Value: {{min_value}} + * + {{/has_min}} + {{#has_max}} + * Maximum Value: {{max_value}} + * + {{/has_max}} {{#throws_description_ts.length}} * @throws {{#throws_description_ts}} From ffcda79cae8b26078d12ad434d051811c60a9088 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 24 Nov 2025 16:50:36 -0800 Subject: [PATCH 02/25] Property Mustache --- .../templates/tsdef/property.mustache | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/markup-generators-plugin/templates/tsdef/property.mustache b/tools/markup-generators-plugin/templates/tsdef/property.mustache index 5b3e2a5..fe46d00 100644 --- a/tools/markup-generators-plugin/templates/tsdef/property.mustache +++ b/tools/markup-generators-plugin/templates/tsdef/property.mustache @@ -58,18 +58,22 @@ {{/ts_has_remarks}} {{#has_defaults}} {{#default_value}} - * Defaults to: {{> value}} + * Defaults to Sanity Check #1: {{> value}} * {{/default_value}} {{/has_defaults}} + {{#has_minimum}} {{#has_min}} - * Minimum Value: {{min_value}} + * Minimum: {{min_value}} * {{/has_min}} + {{/has_minimum}} + {{#has_maximum}} {{#has_max}} - * Maximum Value: {{max_value}} + * Maximum: {{max_value}} * {{/has_max}} + {{/has_maximum}} {{#throws_description_ts.length}} * @throws {{#throws_description_ts}} From b8b4f5c9876f372d0dccd45e1c9511daebc62c54 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 24 Nov 2025 18:43:47 -0800 Subject: [PATCH 03/25] Proprety working --- .../templates/tsdef/property.mustache | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tools/markup-generators-plugin/templates/tsdef/property.mustache b/tools/markup-generators-plugin/templates/tsdef/property.mustache index fe46d00..a8158b8 100644 --- a/tools/markup-generators-plugin/templates/tsdef/property.mustache +++ b/tools/markup-generators-plugin/templates/tsdef/property.mustache @@ -58,22 +58,18 @@ {{/ts_has_remarks}} {{#has_defaults}} {{#default_value}} - * Defaults to Sanity Check #1: {{> value}} + * Defaults to: {{> value}} * {{/default_value}} {{/has_defaults}} - {{#has_minimum}} - {{#has_min}} - * Minimum: {{min_value}} + {{#has_min}} + * Minimum Value: {{min_value}} * - {{/has_min}} - {{/has_minimum}} - {{#has_maximum}} - {{#has_max}} - * Maximum: {{max_value}} + {{/has_min}} + {{#has_max}} + * Maximum Value: {{max_value}} * - {{/has_max}} - {{/has_maximum}} + {{/has_max}} {{#throws_description_ts.length}} * @throws {{#throws_description_ts}} From 4a9bac9bb1dffe942d81a67c27b5ffa1369e4b30 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 1 Dec 2025 18:50:24 -0800 Subject: [PATCH 04/25] Updated Property and added changelogging for properties --- .../bounds/__snapshots__/bounds.spec.ts.snap | 19 +++++++----- .../test/bounds/input/test-module.json | 17 ++++++----- tools/api-docs-generator/src/changelog.ts | 25 +++++++++++++++- .../src/filters/CommonFilters.ts | 30 +++++++++++++++++++ .../src/filters/TypeScriptFilters.ts | 3 +- .../src/modules/MinecraftScriptModule.ts | 5 ++++ .../msdocs/script/module_changelog.mustache | 17 ++++++++++- .../templates/tsdef/property.mustache | 4 +++ 8 files changed, 102 insertions(+), 18 deletions(-) diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap b/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap index 7dc3ed5..ba74307 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap +++ b/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap @@ -26,10 +26,10 @@ description: Contents of the bounds-module.ClassWithBounds class. ## Properties -### **boundProperty** -\`boundProperty?: boolean;\` +### **BoundsProperty** +\`BoundsProperty: number;\` -Type: *boolean* +Type: *number* Notes: - This property can't be used in read-only mode. @@ -39,11 +39,11 @@ Notes: ### **methodThatTakesBoundedValue** \` -methodThatTakesBoundedValue(amount?: number): void +methodThatTakesBoundedValue(amount: number): void \` #### **Parameters** -- **amount**?: *number* = \`1\` +- **amount**: *number* **Returns** *void* @@ -108,18 +108,21 @@ export class ClassWithBounds { * @remarks * This property can't be used in read-only mode. * + * Minimum Value: 1 + * + * Maximum Value: 255 + * */ - boundProperty?: boolean; + BoundsProperty: number; /** * @remarks * This function can't be called in read-only mode. * * @param amount - * Defaults to Sanity Check #2: 1 * Minimum value: 1 * Maximum value: 255 */ - methodThatTakesBoundedValue(amount?: number): void; + methodThatTakesBoundedValue(amount: number): void; } " `; diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module.json b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module.json index 3b31bdf..5d79300 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module.json +++ b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module.json @@ -4,16 +4,20 @@ "name": "ClassWithBounds", "properties": [ { + "has_max": true, + "has_min": true, + "is_baked": false, "is_read_only": false, - "name": "boundProperty", + "max_value": 255, + "min_value": 1, + "name": "BoundsProperty", "type": { "is_bind_type": false, "is_errorable": false, - "name": "optional", - "optional_type": { - "is_bind_type": false, - "is_errorable": false, - "name": "boolean" + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 } } } @@ -28,7 +32,6 @@ "arguments": [ { "details": { - "default_value": 1, "has_max": true, "has_min": true, "max_value": 255, diff --git a/tools/api-docs-generator/src/changelog.ts b/tools/api-docs-generator/src/changelog.ts index 3f579a5..571d257 100644 --- a/tools/api-docs-generator/src/changelog.ts +++ b/tools/api-docs-generator/src/changelog.ts @@ -89,6 +89,16 @@ const scriptingDataLayout: RootMetadataScope = { key: 'name', submembers: { is_read_only: { type: 'value' }, + details: { + type: 'simple_ordered_array', + key: 'name', + submembers: { + has_min: { type: 'value' }, + has_max: { type: 'value' }, + min_value: { type: 'value' }, + max_value: { type: 'value' }, + }, + }, get_privilege: { type: 'array', key: 'name' }, set_privilege: { type: 'array', key: 'name' }, type: TypeDataLayout, @@ -124,7 +134,10 @@ const scriptingDataLayout: RootMetadataScope = { properties: { type: 'array', key: 'name', - submembers: { is_read_only: { type: 'value' }, type: TypeDataLayout }, + submembers: { + is_read_only: { type: 'value' }, + type: TypeDataLayout, + }, }, }, }, @@ -158,6 +171,16 @@ const scriptingDataLayout: RootMetadataScope = { key: 'name', submembers: { type: TypeDataLayout, + details: { + type: 'simple_ordered_array', + key: 'name', + submembers: { + has_min: { type: 'value' }, + has_max: { type: 'value' }, + min_value: { type: 'value' }, + max_value: { type: 'value' }, + }, + }, }, }, return_type: TypeDataLayout, diff --git a/tools/api-docs-generator/src/filters/CommonFilters.ts b/tools/api-docs-generator/src/filters/CommonFilters.ts index 3e5db36..035462d 100644 --- a/tools/api-docs-generator/src/filters/CommonFilters.ts +++ b/tools/api-docs-generator/src/filters/CommonFilters.ts @@ -1713,6 +1713,35 @@ function typeFlags(releases: MinecraftRelease[]) { } } +/** + * Marks up APIs that have bound values. + */ +function boundValues(releases: MinecraftRelease[]) { + for (const release of releases) { + for (const scriptModule of release.script_modules) { + for (const classJson of scriptModule.classes ?? []) { + for (const functionJson of classJson.functions ?? []) { + for (const argumentJson of functionJson.arguments) { + if (!argumentJson.details) { + continue; + } + + if (argumentJson.details.min_value !== undefined) { + functionJson.has_bounds = true; + argumentJson.has_bounds = true; + } + + if (argumentJson.details.max_value !== undefined) { + functionJson.has_bounds = true; + argumentJson.has_bounds = true; + } + } + } + } + } + } +} + /** * Marks up APIs that have default values with 'has_defaults'. */ @@ -3337,6 +3366,7 @@ export const CommonFilters: FilterGroup = { ['block_filters', blockFilters], ['constant_values', constantValues], ['default_values', defaultValues], + ['bound_values', boundValues], ['markup_categories', markupCategories], ['type_alias_markup', typeAliasMarkup], ['type_flags', typeFlags], diff --git a/tools/api-docs-generator/src/filters/TypeScriptFilters.ts b/tools/api-docs-generator/src/filters/TypeScriptFilters.ts index ce7895c..fd9ecf2 100644 --- a/tools/api-docs-generator/src/filters/TypeScriptFilters.ts +++ b/tools/api-docs-generator/src/filters/TypeScriptFilters.ts @@ -327,6 +327,7 @@ function flagTSComments(obj: MarkupCommentFlags): void { if ( obj.has_comments || obj.has_defaults || + obj.has_bounds || obj.has_errors || obj.is_prerelease || obj.is_deprecated || @@ -345,7 +346,7 @@ function flagTSComments(obj: MarkupCommentFlags): void { obj.ts_has_remarks = false; } - if (obj.has_privilege_comments || obj.has_defaults || obj.has_errors) { + if (obj.has_privilege_comments || obj.has_defaults || obj.has_bounds || obj.has_errors) { obj.msdocs_has_comments = true; } } diff --git a/tools/api-docs-generator/src/modules/MinecraftScriptModule.ts b/tools/api-docs-generator/src/modules/MinecraftScriptModule.ts index 5f25baa..d4bce8a 100644 --- a/tools/api-docs-generator/src/modules/MinecraftScriptModule.ts +++ b/tools/api-docs-generator/src/modules/MinecraftScriptModule.ts @@ -53,6 +53,7 @@ export const MarkupCommentFlagsValidator = Intersect( Record({ has_changes: Optional(Boolean), has_defaults: Optional(Boolean), + has_bounds: Optional(Boolean), has_errors: Optional(Boolean), prerelease: Optional(String), @@ -286,6 +287,8 @@ export const MinecraftConstantRecord = Intersect( Record({ type: MinecraftTypeRecord, is_read_only: Literal(true), + has_min: Optional(Boolean), + has_max: Optional(Boolean), is_static: Literal(true), value: Optional(Unknown), @@ -331,6 +334,8 @@ export const MinecraftPropertyRecord = Intersect( Record({ type: MinecraftTypeRecord, is_read_only: Boolean, + has_min: Optional(Boolean), + has_max: Optional(Boolean), is_baked: Optional(Boolean), default_value: Optional(Unknown.Or(Null)), diff --git a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache index 7f1cb4e..1bbf600 100644 --- a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache +++ b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache @@ -90,7 +90,22 @@ description: Changelog of the `{{{name}}}` module {{#$changed}} - Changed read-only flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* from `{{{$old}}}` to `{{{$new}}}` {{/$changed}} - {{/is_read_only}} + {{/is_read_only}} + {{#details}} + {{#$changed}} +- Changed details for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})*` + from `{has_min: {{$old.has_min}}, min_value: {{$old.min_value}}, has_max: {{$old.has_max}}, max_value: {{$old.max_value}}}` + to `{has_min: {{$new.has_min}}, min_value: {{$new.min_value}}, has_max: {{$new.has_max}}, max_value: {{$new.max_value}}}` + {{/$changed}} + {{#$added}} +- Added details for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + added `{has_min: {{$new.has_min}}, min_value: {{$new.min_value}}, has_max: {{$new.has_max}}, max_value: {{$new.max_value}}}` + {{/$added}} + {{#$removed}} +- Removed details for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + removed `{has_min: {{$old.has_min}}, min_value: {{$old.min_value}}, has_max: {{$old.has_max}}, max_value: {{$old.max_value}}}` + {{/$removed}} + {{/details}} {{#type}} {{#$changed}} - Changed type for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* from {{#$old.type}}{{> type_with_links}}{{#is_errorable}} (throws exceptions){{/is_errorable}}{{/$old.type}} to {{#$new.type}}{{> type_with_links}}{{#is_errorable}} (throws exceptions){{/is_errorable}}{{/$new.type}} diff --git a/tools/markup-generators-plugin/templates/tsdef/property.mustache b/tools/markup-generators-plugin/templates/tsdef/property.mustache index a8158b8..590bd2c 100644 --- a/tools/markup-generators-plugin/templates/tsdef/property.mustache +++ b/tools/markup-generators-plugin/templates/tsdef/property.mustache @@ -63,12 +63,16 @@ {{/default_value}} {{/has_defaults}} {{#has_min}} + {{#min_value}} * Minimum Value: {{min_value}} * + {{/min_value}} {{/has_min}} {{#has_max}} + {{#max_value}} * Maximum Value: {{max_value}} * + {{/max_value}} {{/has_max}} {{#throws_description_ts.length}} * @throws From ccea570fe27d25d4e2929274072643001d924791 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 1 Dec 2025 20:57:45 -0800 Subject: [PATCH 05/25] Added function arguments to changelog --- tools/api-docs-generator/src/changelog.ts | 10 ++++++++++ .../templates/msdocs/script/module_changelog.mustache | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/tools/api-docs-generator/src/changelog.ts b/tools/api-docs-generator/src/changelog.ts index 571d257..bb88f6a 100644 --- a/tools/api-docs-generator/src/changelog.ts +++ b/tools/api-docs-generator/src/changelog.ts @@ -113,6 +113,16 @@ const scriptingDataLayout: RootMetadataScope = { key: 'name', submembers: { type: TypeDataLayout, + details: { + type: 'simple_ordered_array', + key: 'name', + submembers: { + has_min: { type: 'value' }, + has_max: { type: 'value' }, + min_value: { type: 'value' }, + max_value: { type: 'value' }, + }, + }, }, }, call_privilege: { type: 'array', key: 'name' }, diff --git a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache index 1bbf600..5420d9e 100644 --- a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache +++ b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache @@ -155,6 +155,13 @@ description: Changelog of the `{{{name}}}` module - Changed argument `{{{name}}}` type from {{#$old.type}}{{> type_with_links}}{{#is_errorable}} (throws exceptions){{/is_errorable}}{{/$old.type}} to {{#$new.type}}{{> type_with_links}}{{#is_errorable}} (throws exceptions){{/is_errorable}}{{/$new.type}} {{/$changed}} {{/type}} + {{#details}} + {{#$changed}} + - Changed details of `{{{name}}}` + from `{has_min: {{$old.has_min}}, min_value: {{$old.min_value}}, has_max: {{$old.has_max}}, max_value: {{$old.max_value}}}` + to `{has_min: {{$new.has_min}}, min_value: {{$new.min_value}}, has_max: {{$new.has_max}}, max_value: {{$new.max_value}}}` + {{/$changed}} + {{/details}} {{/$removed}}{{/$added}} {{/arguments}} {{/$removed}}{{/$added}}{{/has_changes}} @@ -184,6 +191,7 @@ description: Changelog of the `{{{name}}}` module - Removed argument `{{{name}}}` {{/$removed}} {{^$added}}{{^$removed}} +- Changed argument `{{{name}}}` {{#type}} {{#$changed}} - Changed argument `{{{name}}}` type from {{#$old.type}}{{> type_with_links}}{{/$old.type}} to {{#$new.type}}{{> type_with_links}}{{/$new.type}} From 370ec977e7034fa73ac475302dff1b9db35f35ac Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 1 Dec 2025 21:33:36 -0800 Subject: [PATCH 06/25] Adjusted formatting in changelog --- .../msdocs/script/module_changelog.mustache | 123 ++++++++++++++++-- 1 file changed, 113 insertions(+), 10 deletions(-) diff --git a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache index 5420d9e..1b89d6f 100644 --- a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache +++ b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache @@ -93,17 +93,65 @@ description: Changelog of the `{{{name}}}` module {{/is_read_only}} {{#details}} {{#$changed}} -- Changed details for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})*` - from `{has_min: {{$old.has_min}}, min_value: {{$old.min_value}}, has_max: {{$old.has_max}}, max_value: {{$old.max_value}}}` - to `{has_min: {{$new.has_min}}, min_value: {{$new.min_value}}, has_max: {{$new.has_max}}, max_value: {{$new.max_value}}}` +- Changed details for property *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})*` + from: + {{#$old.has_min}} + - Minimum Bound: {{$old.min_value}} + {{/$old.has_min}} + {{^$old.has_min}} + - Minimum Bound: None + {{/$old.has_min}} + {{#$old.has_max}} + - Maximum Bound: {{$old.max_value}} + {{/$old.has_max}} + {{^$old.has_max}} + - Maximum Bound: None + {{/$old.has_max}} + to: + {{#$new.has_min}} + - Minimum Bound: {{$new.min_value}} + {{/$new.has_min}} + {{^$new.has_min}} + - Minimum Bound: None + {{/$new.has_min}} + {{#$new.has_max}} + - Maximum Bound: {{$new.max_value}} + {{/$new.has_max}} + {{^$new.has_max}} + - Maximum Bound: None + {{/$new.has_max}} {{/$changed}} {{#$added}} -- Added details for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - added `{has_min: {{$new.has_min}}, min_value: {{$new.min_value}}, has_max: {{$new.has_max}}, max_value: {{$new.max_value}}}` +- Added details for property *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + added: + {{#$new.has_min}} + - Minimum Bound: {{$new.min_value}} + {{/$new.has_min}} + {{^$new.has_min}} + - Minimum Bound: None + {{/$new.has_min}} + {{#$new.has_max}} + - Maximum Bound: {{$new.max_value}} + {{/$new.has_max}} + {{^$new.has_max}} + - Maximum Bound: None + {{/$new.has_max}} {{/$added}} {{#$removed}} -- Removed details for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - removed `{has_min: {{$old.has_min}}, min_value: {{$old.min_value}}, has_max: {{$old.has_max}}, max_value: {{$old.max_value}}}` +- Removed details for property *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + removed: + {{#$old.has_min}} + - Minimum Bound: {{$old.min_value}} + {{/$old.has_min}} + {{^$old.has_min}} + - Minimum Bound: None + {{/$old.has_min}} + {{#$old.has_max}} + - Maximum Bound: {{$old.max_value}} + {{/$old.has_max}} + {{^$old.has_max}} + - Maximum Bound: None + {{/$old.has_max}} {{/$removed}} {{/details}} {{#type}} @@ -157,9 +205,33 @@ description: Changelog of the `{{{name}}}` module {{/type}} {{#details}} {{#$changed}} - - Changed details of `{{{name}}}` - from `{has_min: {{$old.has_min}}, min_value: {{$old.min_value}}, has_max: {{$old.has_max}}, max_value: {{$old.max_value}}}` - to `{has_min: {{$new.has_min}}, min_value: {{$new.min_value}}, has_max: {{$new.has_max}}, max_value: {{$new.max_value}}}` + - Changed details of argument `{{{name}}}` + from: + {{#$old.has_min}} + - Minimum Bound: {{$old.min_value}} + {{/$old.has_min}} + {{^$old.has_min}} + - Minimum Bound: None + {{/$old.has_min}} + {{#$old.has_max}} + - Maximum Bound: {{$old.max_value}} + {{/$old.has_max}} + {{^$old.has_max}} + - Maximum Bound: None + {{/$old.has_max}} + to: + {{#$new.has_min}} + - Minimum Bound: {{$new.min_value}} + {{/$new.has_min}} + {{^$new.has_min}} + - Minimum Bound: None + {{/$new.has_min}} + {{#$new.has_max}} + - Maximum Bound: {{$new.max_value}} + {{/$new.has_max}} + {{^$new.has_max}} + - Maximum Bound: None + {{/$new.has_max}} {{/$changed}} {{/details}} {{/$removed}}{{/$added}} @@ -197,6 +269,37 @@ description: Changelog of the `{{{name}}}` module - Changed argument `{{{name}}}` type from {{#$old.type}}{{> type_with_links}}{{/$old.type}} to {{#$new.type}}{{> type_with_links}}{{/$new.type}} {{/$changed}} {{/type}} + {{#details}} + {{#$changed}} + - Changed details of argument `{{{name}}}` + from: + {{#$old.has_min}} + - Minimum Bound: {{$old.min_value}} + {{/$old.has_min}} + {{^$old.has_min}} + - Minimum Bound: None + {{/$old.has_min}} + {{#$old.has_max}} + - Maximum Bound: {{$old.max_value}} + {{/$old.has_max}} + {{^$old.has_max}} + - Maximum Bound: None + {{/$old.has_max}} + to: + {{#$new.has_min}} + - Minimum Bound: {{$new.min_value}} + {{/$new.has_min}} + {{^$new.has_min}} + - Minimum Bound: None + {{/$new.has_min}} + {{#$new.has_max}} + - Maximum Bound: {{$new.max_value}} + {{/$new.has_max}} + {{^$new.has_max}} + - Maximum Bound: None + {{/$new.has_max}} + {{/$changed}} + {{/details}} {{/$removed}}{{/$added}} {{/arguments}} {{/$removed}}{{/$added}}{{/has_changes}} From 1f32b48df8f62fc9a90383b534a91b52ec0d0ab9 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 1 Dec 2025 21:56:07 -0800 Subject: [PATCH 07/25] added bounds to the md --- .../templates/msdocs/script/function.mustache | 8 ++++++++ .../templates/msdocs/script/property.mustache | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/tools/markup-generators-plugin/templates/msdocs/script/function.mustache b/tools/markup-generators-plugin/templates/msdocs/script/function.mustache index b0f7750..840ca8e 100644 --- a/tools/markup-generators-plugin/templates/msdocs/script/function.mustache +++ b/tools/markup-generators-plugin/templates/msdocs/script/function.mustache @@ -18,6 +18,14 @@ #### **Parameters** {{#arguments}} - **{{{name}}}**{{#type}}{{#is_optional}}?{{/is_optional}}: {{> type_with_links}}{{/type}}{{#details.default_value}} = `{{> value}}`{{/details.default_value}} + {{#details}} + {{#has_min}} + Minimum Bound: `{{min_value}}` + {{/has_min}} + {{#has_max}} + Maximum Bound: `{{max_value}}` + {{/has_max}} + {{/details}} {{#details.supported_values.length}} Supported values: [{{#details.supported_values}}{{> value}}{{^is_last}}, {{/is_last}}{{/details.supported_values}}] diff --git a/tools/markup-generators-plugin/templates/msdocs/script/property.mustache b/tools/markup-generators-plugin/templates/msdocs/script/property.mustache index ea4f55e..834e357 100644 --- a/tools/markup-generators-plugin/templates/msdocs/script/property.mustache +++ b/tools/markup-generators-plugin/templates/msdocs/script/property.mustache @@ -26,6 +26,14 @@ Notes: - This property defaults to `{{> value}}` when undefined. {{/default_value}} {{/has_defaults}} + {{#details}} + {{#has_min}} + - This property has a minimum bound of `{{min_value}}` + {{/has_min}} + {{#has_max}} + - This property has a maximum bound of `{{max_value}}` + {{/has_max}} + {{/details}} {{#set_disallowed_in_read_only}} {{#get_disallowed_in_read_only}} - This property can't be used in read-only mode. From 143471c52ddaf820588f60e849f9ccb6a07498e7 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 1 Dec 2025 22:03:24 -0800 Subject: [PATCH 08/25] Module tests --- .../test/bounds/input/test-module_v1.json | 69 +++++++++++++++++++ .../test/bounds/input/test-module_v2.json | 69 +++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json create mode 100644 tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json new file mode 100644 index 0000000..2ed0b3c --- /dev/null +++ b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json @@ -0,0 +1,69 @@ +{ + "classes": [ + { + "name": "ClassWithBounds", + "properties": [ + { + "has_max": true, + "has_min": false, + "is_baked": false, + "is_read_only": false, + "max_value": 255, + "min_value": 1, + "name": "BoundsProperty", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + } + ], + "type": { + "is_bind_type": true, + "is_errorable": false, + "name": "ClassWithBounds" + }, + "functions": [ + { + "arguments": [ + { + "details": { + "has_max": false, + "has_min": true, + "max_value": 255, + "min_value": 1 + }, + "name": "amount", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + } + ], + "is_constructor": false, + "name": "methodThatTakesBoundedValue", + "return_type": { + "is_bind_type": false, + "is_errorable": false, + "name": "void" + } + } + ] + } + ], + + "minecraft_version": "1.0.0", + "name": "bounds-module", + "uuid": "d79b396f-dc7a-46e0-97c5-a14434ab8dcd", + "version": "1.0.0", + "module_type": "script" +} diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json new file mode 100644 index 0000000..6161d33 --- /dev/null +++ b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json @@ -0,0 +1,69 @@ +{ + "classes": [ + { + "name": "ClassWithBounds", + "properties": [ + { + "has_max": false, + "has_min": true, + "is_baked": false, + "is_read_only": false, + "max_value": 255, + "min_value": 1, + "name": "BoundsProperty", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + } + ], + "type": { + "is_bind_type": true, + "is_errorable": false, + "name": "ClassWithBounds" + }, + "functions": [ + { + "arguments": [ + { + "details": { + "has_max": true, + "has_min": false, + "max_value": 255, + "min_value": 1 + }, + "name": "amount", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + } + ], + "is_constructor": false, + "name": "methodThatTakesBoundedValue", + "return_type": { + "is_bind_type": false, + "is_errorable": false, + "name": "void" + } + } + ] + } + ], + + "minecraft_version": "1.0.0", + "name": "bounds-module", + "uuid": "d79b396f-dc7a-46e0-97c5-a14434ab8dcd", + "version": "2.0.0", + "module_type": "script" +} From 9550d906a18ed4824ce82df7cc3e860477369357 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 1 Dec 2025 22:04:12 -0800 Subject: [PATCH 09/25] Adding removed file --- .../test/bounds/input/test-module.json | 69 ------------------- 1 file changed, 69 deletions(-) delete mode 100644 tools/api-docs-generator-test-snapshots/test/bounds/input/test-module.json diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module.json b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module.json deleted file mode 100644 index 5d79300..0000000 --- a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "classes": [ - { - "name": "ClassWithBounds", - "properties": [ - { - "has_max": true, - "has_min": true, - "is_baked": false, - "is_read_only": false, - "max_value": 255, - "min_value": 1, - "name": "BoundsProperty", - "type": { - "is_bind_type": false, - "is_errorable": false, - "name": "int32", - "valid_range": { - "max": 2147483647, - "min": -2147483648 - } - } - } - ], - "type": { - "is_bind_type": true, - "is_errorable": false, - "name": "ClassWithBounds" - }, - "functions": [ - { - "arguments": [ - { - "details": { - "has_max": true, - "has_min": true, - "max_value": 255, - "min_value": 1 - }, - "name": "amount", - "type": { - "is_bind_type": false, - "is_errorable": false, - "name": "int32", - "valid_range": { - "max": 2147483647, - "min": -2147483648 - } - } - } - ], - "is_constructor": false, - "name": "methodThatTakesBoundedValue", - "return_type": { - "is_bind_type": false, - "is_errorable": false, - "name": "void" - } - } - ] - } - ], - - "minecraft_version": "1.0.0", - "name": "bounds-module", - "uuid": "d79b396f-dc7a-46e0-97c5-a14434ab8dcd", - "version": "1.0.0", - "module_type": "script" -} From 79d72602a56ac9a6f37fba71bc03f6f573b79f03 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 1 Dec 2025 22:39:42 -0800 Subject: [PATCH 10/25] Removed incorrect details nesting --- tools/api-docs-generator/src/changelog.ts | 14 +-- .../msdocs/script/module_changelog.mustache | 95 ++++++++----------- .../templates/msdocs/script/property.mustache | 10 +- 3 files changed, 46 insertions(+), 73 deletions(-) diff --git a/tools/api-docs-generator/src/changelog.ts b/tools/api-docs-generator/src/changelog.ts index bb88f6a..010cef2 100644 --- a/tools/api-docs-generator/src/changelog.ts +++ b/tools/api-docs-generator/src/changelog.ts @@ -89,16 +89,10 @@ const scriptingDataLayout: RootMetadataScope = { key: 'name', submembers: { is_read_only: { type: 'value' }, - details: { - type: 'simple_ordered_array', - key: 'name', - submembers: { - has_min: { type: 'value' }, - has_max: { type: 'value' }, - min_value: { type: 'value' }, - max_value: { type: 'value' }, - }, - }, + has_min: { type: 'value' }, + has_max: { type: 'value' }, + min_value: { type: 'value' }, + max_value: { type: 'value' }, get_privilege: { type: 'array', key: 'name' }, set_privilege: { type: 'array', key: 'name' }, type: TypeDataLayout, diff --git a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache index 1b89d6f..23531d6 100644 --- a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache +++ b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache @@ -91,69 +91,50 @@ description: Changelog of the `{{{name}}}` module - Changed read-only flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* from `{{{$old}}}` to `{{{$new}}}` {{/$changed}} {{/is_read_only}} - {{#details}} + {{#has_min}} {{#$changed}} -- Changed details for property *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})*` - from: - {{#$old.has_min}} - - Minimum Bound: {{$old.min_value}} - {{/$old.has_min}} - {{^$old.has_min}} - - Minimum Bound: None - {{/$old.has_min}} - {{#$old.has_max}} - - Maximum Bound: {{$old.max_value}} - {{/$old.has_max}} - {{^$old.has_max}} - - Maximum Bound: None - {{/$old.has_max}} - to: - {{#$new.has_min}} - - Minimum Bound: {{$new.min_value}} - {{/$new.has_min}} - {{^$new.has_min}} - - Minimum Bound: None - {{/$new.has_min}} - {{#$new.has_max}} - - Maximum Bound: {{$new.max_value}} - {{/$new.has_max}} - {{^$new.has_max}} - - Maximum Bound: None - {{/$new.has_max}} +- Changed has_min flag from `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$changed}} + {{#$added}} +- Added has_min flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$added}} + {{#$removed}} +- Removed has_min flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$removed}} + {{/has_min}} + {{#min_value}} + {{#$changed}} +- Changed min_value from `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$changed}} + {{#$added}} +- Added min_value for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$added}} + {{#$removed}} +- Removed min_value for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$removed}} + {{/min_value}} + {{#has_max}} + {{#$changed}} +- Changed has_max flag from `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$changed}} + {{#$added}} +- Added has_max flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$added}} + {{#$removed}} +- Removed has_max flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$removed}} + {{/has_max}} + {{#max_value}} + {{#$changed}} +- Changed max_value from `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* {{/$changed}} {{#$added}} -- Added details for property *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - added: - {{#$new.has_min}} - - Minimum Bound: {{$new.min_value}} - {{/$new.has_min}} - {{^$new.has_min}} - - Minimum Bound: None - {{/$new.has_min}} - {{#$new.has_max}} - - Maximum Bound: {{$new.max_value}} - {{/$new.has_max}} - {{^$new.has_max}} - - Maximum Bound: None - {{/$new.has_max}} +- Added max_value for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* {{/$added}} {{#$removed}} -- Removed details for property *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - removed: - {{#$old.has_min}} - - Minimum Bound: {{$old.min_value}} - {{/$old.has_min}} - {{^$old.has_min}} - - Minimum Bound: None - {{/$old.has_min}} - {{#$old.has_max}} - - Maximum Bound: {{$old.max_value}} - {{/$old.has_max}} - {{^$old.has_max}} - - Maximum Bound: None - {{/$old.has_max}} +- Removed max_value for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* {{/$removed}} - {{/details}} + {{/max_value}} {{#type}} {{#$changed}} - Changed type for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* from {{#$old.type}}{{> type_with_links}}{{#is_errorable}} (throws exceptions){{/is_errorable}}{{/$old.type}} to {{#$new.type}}{{> type_with_links}}{{#is_errorable}} (throws exceptions){{/is_errorable}}{{/$new.type}} diff --git a/tools/markup-generators-plugin/templates/msdocs/script/property.mustache b/tools/markup-generators-plugin/templates/msdocs/script/property.mustache index 834e357..b990a3c 100644 --- a/tools/markup-generators-plugin/templates/msdocs/script/property.mustache +++ b/tools/markup-generators-plugin/templates/msdocs/script/property.mustache @@ -26,14 +26,12 @@ Notes: - This property defaults to `{{> value}}` when undefined. {{/default_value}} {{/has_defaults}} - {{#details}} - {{#has_min}} + {{#has_min}} - This property has a minimum bound of `{{min_value}}` - {{/has_min}} - {{#has_max}} + {{/has_min}} + {{#has_max}} - This property has a maximum bound of `{{max_value}}` - {{/has_max}} - {{/details}} + {{/has_max}} {{#set_disallowed_in_read_only}} {{#get_disallowed_in_read_only}} - This property can't be used in read-only mode. From ccf624a43e28985bfdec51c958bcb99cecbd7dc4 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 1 Dec 2025 22:56:43 -0800 Subject: [PATCH 11/25] More Mustache formatting --- .../msdocs/script/module_changelog.mustache | 68 ++++++++++++------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache index 23531d6..3e9ae99 100644 --- a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache +++ b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache @@ -100,19 +100,29 @@ description: Changelog of the `{{{name}}}` module {{/$added}} {{#$removed}} - Removed has_min flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$removed}} - {{/has_min}} - {{#min_value}} - {{#$changed}} -- Changed min_value from `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$changed}} - {{#$added}} -- Added min_value for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$added}} - {{#$removed}} + {{/$removed}} + {{^$old}}{{#$new}} + {{#min_value}} +- Added min_value `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/min_value}} + {{/$new}}{{/$old}} + {{#$old}}{{^$new}} - Removed min_value for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$removed}} - {{/min_value}} + {{/$new}}{{/$old}} + {{#$old}}{{#$new}} + {{#min_value}} + {{#$changed}} +- Changed min_value from `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$changed}} + {{#$added}} +- Added min_value`{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$added}} + {{#$removed}} +- Removed min_value`{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$removed}} + {{/min_value}} + {{/$new}}{{/$old}} + {{/has_min}} {{#has_max}} {{#$changed}} - Changed has_max flag from `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* @@ -122,19 +132,29 @@ description: Changelog of the `{{{name}}}` module {{/$added}} {{#$removed}} - Removed has_max flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$removed}} - {{/has_max}} - {{#max_value}} - {{#$changed}} -- Changed max_value from `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$changed}} - {{#$added}} -- Added max_value for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$added}} - {{#$removed}} + {{/$removed}} + {{^$old}}{{#$new}} + {{#max_value}} +- Added max_value `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/max_value}} + {{/$new}}{{/$old}} + {{#$old}}{{^$new}} - Removed max_value for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$removed}} - {{/max_value}} + {{/$new}}{{/$old}} + {{#$old}}{{#$new}} + {{#max_value}} + {{#$changed}} +- Changed min_value from `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$changed}} + {{#$added}} +- Added min_value`{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$added}} + {{#$removed}} +- Removed min_value`{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/$removed}} + {{/max_value}} + {{/$new}}{{/$old}} + {{/has_max}} {{#type}} {{#$changed}} - Changed type for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* from {{#$old.type}}{{> type_with_links}}{{#is_errorable}} (throws exceptions){{/is_errorable}}{{/$old.type}} to {{#$new.type}}{{> type_with_links}}{{#is_errorable}} (throws exceptions){{/is_errorable}}{{/$new.type}} From 225bfd2f8d3decc045f6ef0d552de9baf24db349 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 1 Dec 2025 23:02:05 -0800 Subject: [PATCH 12/25] Added more variable property testing --- .../test/bounds/input/test-module_v1.json | 58 +++++++++++++++++- .../test/bounds/input/test-module_v2.json | 60 ++++++++++++++++++- 2 files changed, 113 insertions(+), 5 deletions(-) diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json index 2ed0b3c..9873aac 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json +++ b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json @@ -3,14 +3,68 @@ { "name": "ClassWithBounds", "properties": [ + { + "has_max": false, + "has_min": false, + "is_baked": false, + "is_read_only": false, + "max_value": 2147483647, + "min_value": -2147483648, + "name": "w", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "has_max": false, + "has_min": true, + "is_baked": false, + "is_read_only": false, + "max_value": 2147483647, + "min_value": 1, + "name": "x", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { "has_max": true, "has_min": false, "is_baked": false, "is_read_only": false, "max_value": 255, + "min_value": -2147483648, + "name": "y", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "has_max": true, + "has_min": true, + "is_baked": false, + "is_read_only": false, + "max_value": 255, "min_value": 1, - "name": "BoundsProperty", + "name": "z", "type": { "is_bind_type": false, "is_errorable": false, @@ -34,7 +88,7 @@ "details": { "has_max": false, "has_min": true, - "max_value": 255, + "max_value": 2147483647, "min_value": 1 }, "name": "amount", diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json index 6161d33..7d3f490 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json +++ b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json @@ -4,13 +4,67 @@ "name": "ClassWithBounds", "properties": [ { - "has_max": false, + "has_max": true, "has_min": true, "is_baked": false, "is_read_only": false, "max_value": 255, "min_value": 1, - "name": "BoundsProperty", + "name": "w", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "has_max": true, + "has_min": false, + "is_baked": false, + "is_read_only": false, + "max_value": 255, + "min_value": -2147483648, + "name": "x", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "has_max": false, + "has_min": true, + "is_baked": false, + "is_read_only": false, + "max_value": 2147483647, + "min_value": 1, + "name": "y", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "has_max": false, + "has_min": false, + "is_baked": false, + "is_read_only": false, + "max_value": 2147483647, + "min_value": -2147483648, + "name": "z", "type": { "is_bind_type": false, "is_errorable": false, @@ -35,7 +89,7 @@ "has_max": true, "has_min": false, "max_value": 255, - "min_value": 1 + "min_value": -2147483648 }, "name": "amount", "type": { From bb254a9419b772c015f9e70b9083de6d828537ee Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 1 Dec 2025 23:09:48 -0800 Subject: [PATCH 13/25] Added more variable parameter testing --- .../test/bounds/input/test-module_v1.json | 53 ++++++++++++++++++- .../test/bounds/input/test-module_v2.json | 53 ++++++++++++++++++- 2 files changed, 104 insertions(+), 2 deletions(-) diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json index 9873aac..bb724c3 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json +++ b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json @@ -85,13 +85,64 @@ { "arguments": [ { + "details": { + "has_max": true, + "has_min": true, + "max_value": 255, + "min_value": 1 + }, + "name": "w", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { "details": { "has_max": false, "has_min": true, "max_value": 2147483647, "min_value": 1 }, - "name": "amount", + "name": "x", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { + "details": { + "has_max": true, + "has_min": false, + "max_value": 255, + "min_value": -2147483648 + }, + "name": "y", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { + "details": { + "has_max": false, + "has_min": false, + "max_value": 2147483647, + "min_value": -2147483648 + }, + "name": "z", "type": { "is_bind_type": false, "is_errorable": false, diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json index 7d3f490..e4fa9e1 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json +++ b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json @@ -85,13 +85,64 @@ { "arguments": [ { + "details": { + "has_max": false, + "has_min": false, + "max_value": 2147483647, + "min_value": -2147483648 + }, + "name": "w", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { "details": { "has_max": true, "has_min": false, "max_value": 255, "min_value": -2147483648 }, - "name": "amount", + "name": "x", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { + "details": { + "has_max": false, + "has_min": true, + "max_value": 2147483647, + "min_value": 1 + }, + "name": "y", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { + "details": { + "has_max": true, + "has_min": true, + "max_value": 255, + "min_value": 1 + }, + "name": "z", "type": { "is_bind_type": false, "is_errorable": false, From 93dc149eba268cddb624a5ab8318b6181e10d6f2 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 1 Dec 2025 23:14:31 -0800 Subject: [PATCH 14/25] Updated test result file --- .../bounds/__snapshots__/bounds.spec.ts.snap | 352 +++++++++++++++++- 1 file changed, 342 insertions(+), 10 deletions(-) diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap b/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap index ba74307..c864795 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap +++ b/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap @@ -1,12 +1,133 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Bounds > Properly generates documentation for modules which contain bounds > # Of Files Generated 1`] = `4`; +exports[`Bounds > Properly generates documentation for modules which contain bounds > # Of Files Generated 1`] = `9`; + +exports[`Bounds > Properly generates documentation for modules which contain bounds > msdocs/priorscriptapi/TOC.yml 1`] = ` +" - name: bounds-module 1.x.x + items: + - name: bounds-module 1.x.x + href: bounds-module-1xx/bounds-module.md + - name: ClassWithBounds + href: bounds-module-1xx/ClassWithBounds.md +" +`; + +exports[`Bounds > Properly generates documentation for modules which contain bounds > msdocs/priorscriptapi/bounds-module-1xx/ClassWithBounds.md 1`] = ` +"--- +# DO NOT TOUCH — This file was automatically generated by @minecraft/api-docs-generator, to report problems file an issue at https://github.com/Mojang/minecraft-scripting-libraries +author: jakeshirley +ms.author: jashir +ms.service: minecraft-bedrock-edition +ms.date: 02/10/2025 +title: bounds-module-1xx.ClassWithBounds Class +description: Contents of the bounds-module.ClassWithBounds class (Version 1.x.x). +--- +# ClassWithBounds Class (Version 1.x.x) + +> [!IMPORTANT] +> This documentation is for an older version of this module. Go to the latest documentation [*here*](../../../scriptapi/bounds-module/ClassWithBounds.md). + +## Properties + +### **w** +\`w: number;\` + +Type: *number* + +Notes: + - This property can't be used in read-only mode. + +### **x** +\`x: number;\` + +Type: *number* + +Notes: + - This property has a minimum bound of \`1\` + - This property can't be used in read-only mode. + +### **y** +\`y: number;\` + +Type: *number* + +Notes: + - This property has a maximum bound of \`255\` + - This property can't be used in read-only mode. + +### **z** +\`z: number;\` + +Type: *number* + +Notes: + - This property has a minimum bound of \`1\` + - This property has a maximum bound of \`255\` + - This property can't be used in read-only mode. + +## Methods +- [methodThatTakesBoundedValue](#methodthattakesboundedvalue) + +### **methodThatTakesBoundedValue** +\` +methodThatTakesBoundedValue(w: number, x: number, y: number, z: number): void +\` + +#### **Parameters** +- **w**: *number* + Minimum Bound: \`1\` + Maximum Bound: \`255\` +- **x**: *number* + Minimum Bound: \`1\` +- **y**: *number* + Maximum Bound: \`255\` +- **z**: *number* + +**Returns** *void* + +Notes: +- This function can't be called in read-only mode. +" +`; + +exports[`Bounds > Properly generates documentation for modules which contain bounds > msdocs/priorscriptapi/bounds-module-1xx/bounds-module.md 1`] = ` +"--- +# DO NOT TOUCH — This file was automatically generated by @minecraft/api-docs-generator, to report problems file an issue at https://github.com/Mojang/minecraft-scripting-libraries +author: jakeshirley +ms.author: jashir +ms.service: minecraft-bedrock-edition +ms.date: 02/10/2025 +title: bounds-module-1xx Module +description: Contents of the bounds-module module (Version 1.x.x) +--- +# \`bounds-module\` Module (Version 1.x.x) + +> [!IMPORTANT] +> This documentation is for an older version of this module. Go to the latest documentation [*here*](../../../scriptapi/bounds-module/bounds-module.md). + +## Manifest Details +\`\`\`json +{ + "module_name": "bounds-module", + "version": "1.0.0" +} +\`\`\` + +## Available Versions +- \`1.0.0\` + +## Classes +- [ClassWithBounds](ClassWithBounds.md) +" +`; exports[`Bounds > Properly generates documentation for modules which contain bounds > msdocs/scriptapi/TOC.yml 1`] = ` " - name: bounds-module items: - name: bounds-module href: bounds-module/bounds-module.md + - name: bounds-module Changelog + href: bounds-module/changelog.md - name: ClassWithBounds href: bounds-module/ClassWithBounds.md " @@ -26,8 +147,36 @@ description: Contents of the bounds-module.ClassWithBounds class. ## Properties -### **BoundsProperty** -\`BoundsProperty: number;\` +### **w** +\`w: number;\` + +Type: *number* + +Notes: + - This property has a minimum bound of \`1\` + - This property has a maximum bound of \`255\` + - This property can't be used in read-only mode. + +### **x** +\`x: number;\` + +Type: *number* + +Notes: + - This property has a maximum bound of \`255\` + - This property can't be used in read-only mode. + +### **y** +\`y: number;\` + +Type: *number* + +Notes: + - This property has a minimum bound of \`1\` + - This property can't be used in read-only mode. + +### **z** +\`z: number;\` Type: *number* @@ -39,11 +188,18 @@ Notes: ### **methodThatTakesBoundedValue** \` -methodThatTakesBoundedValue(amount: number): void +methodThatTakesBoundedValue(w: number, x: number, y: number, z: number): void \` #### **Parameters** -- **amount**: *number* +- **w**: *number* +- **x**: *number* + Maximum Bound: \`255\` +- **y**: *number* + Minimum Bound: \`1\` +- **z**: *number* + Minimum Bound: \`1\` + Maximum Bound: \`255\` **Returns** *void* @@ -64,23 +220,99 @@ description: Contents of the bounds-module module --- # \`bounds-module\` Module +## [Changelog](changelog.md) + ## Manifest Details \`\`\`json { "module_name": "bounds-module", - "version": "1.0.0" + "version": "2.0.0" } \`\`\` -This is version 1.x.x of this module, which is the latest as of version 1.0.0 of Minecraft. +This is version 2.x.x of this module, which is the latest as of version 1.0.0 of Minecraft. ## Available Versions +- \`2.0.0\` + +### Prior Versions + +The following API versions are from a major version that is documented here: [*bounds-module*](../../../priorscriptapi/bounds-module-1xx/bounds-module.md): - \`1.0.0\` + ## Classes - [ClassWithBounds](ClassWithBounds.md) " `; +exports[`Bounds > Properly generates documentation for modules which contain bounds > msdocs/scriptapi/bounds-module/changelog.md 1`] = ` +"--- +# DO NOT TOUCH — This file was automatically generated by @minecraft/api-docs-generator, to report problems file an issue at https://github.com/Mojang/minecraft-scripting-libraries +author: jakeshirley +ms.author: jashir +ms.service: minecraft-bedrock-edition +ms.date: 02/10/2025 +title: bounds-module Changelog +description: Changelog of the \`bounds-module\` module +--- +# \`bounds-module\` Changelog + +## Version Changes +- [2.0.0](#200) +- [1.0.0](#100) + +## 2.0.0 +#### Changed *[\`ClassWithBounds\`](ClassWithBounds.md)* +- Changed has_min flag from \`false\` to \`true\` for *[\`w\`](ClassWithBounds.md#w)* +- Added min_value \`1\` for *[\`w\`](ClassWithBounds.md#w)* +- Changed has_max flag from \`false\` to \`true\` for *[\`w\`](ClassWithBounds.md#w)* +- Added max_value \`255\` for *[\`w\`](ClassWithBounds.md#w)* +- Changed has_min flag from \`true\` to \`false\` for *[\`x\`](ClassWithBounds.md#x)* +- Removed min_value for *[\`x\`](ClassWithBounds.md#x)* +- Changed has_max flag from \`false\` to \`true\` for *[\`x\`](ClassWithBounds.md#x)* +- Added max_value \`255\` for *[\`x\`](ClassWithBounds.md#x)* +- Changed has_min flag from \`false\` to \`true\` for *[\`y\`](ClassWithBounds.md#y)* +- Added min_value \`1\` for *[\`y\`](ClassWithBounds.md#y)* +- Changed has_max flag from \`true\` to \`false\` for *[\`y\`](ClassWithBounds.md#y)* +- Removed max_value for *[\`y\`](ClassWithBounds.md#y)* +- Changed has_min flag from \`true\` to \`false\` for *[\`z\`](ClassWithBounds.md#z)* +- Removed min_value for *[\`z\`](ClassWithBounds.md#z)* +- Changed has_max flag from \`true\` to \`false\` for *[\`z\`](ClassWithBounds.md#z)* +- Removed max_value for *[\`z\`](ClassWithBounds.md#z)* +- Changed function *[\`methodThatTakesBoundedValue\`](ClassWithBounds.md#methodthattakesboundedvalue)* + - Changed details of argument \`w\` + from: + - Minimum Bound: 1 + - Maximum Bound: 255 + to: + - Minimum Bound: None + - Maximum Bound: None + - Changed details of argument \`x\` + from: + - Minimum Bound: 1 + - Maximum Bound: None + to: + - Minimum Bound: None + - Maximum Bound: 255 + - Changed details of argument \`y\` + from: + - Minimum Bound: None + - Maximum Bound: 255 + to: + - Minimum Bound: 1 + - Maximum Bound: None + - Changed details of argument \`z\` + from: + - Minimum Bound: None + - Maximum Bound: None + to: + - Minimum Bound: 1 + - Maximum Bound: 255 +## 1.0.0 +#### Added \`bounds-module\` Module +" +`; + exports[`Bounds > Properly generates documentation for modules which contain bounds > typescript/bounds-module@1.0.0.d.ts 1`] = ` "// Type definitions for Minecraft Bedrock Edition script APIs // Project: https://docs.microsoft.com/minecraft/creator/ @@ -104,6 +336,28 @@ exports[`Bounds > Properly generates documentation for modules which contain bou */ export class ClassWithBounds { private constructor(); + /** + * @remarks + * This property can't be used in read-only mode. + * + */ + w: number; + /** + * @remarks + * This property can't be used in read-only mode. + * + * Minimum Value: 1 + * + */ + x: number; + /** + * @remarks + * This property can't be used in read-only mode. + * + * Maximum Value: 255 + * + */ + y: number; /** * @remarks * This property can't be used in read-only mode. @@ -113,16 +367,94 @@ export class ClassWithBounds { * Maximum Value: 255 * */ - BoundsProperty: number; + z: number; /** * @remarks * This function can't be called in read-only mode. * - * @param amount + * @param w + * Minimum value: 1 + * Maximum value: 255 + * @param x + * Minimum value: 1 + * @param y + * Maximum value: 255 + * @param z + */ + methodThatTakesBoundedValue(w: number, x: number, y: number, z: number): void; +} +" +`; + +exports[`Bounds > Properly generates documentation for modules which contain bounds > typescript/bounds-module@2.0.0.d.ts 1`] = ` +"// Type definitions for Minecraft Bedrock Edition script APIs +// Project: https://docs.microsoft.com/minecraft/creator/ +// Definitions by: Jake Shirley +// Mike Ammerlaan + +/* ***************************************************************************** + Copyright (c) Microsoft Corporation. + ***************************************************************************** */ +/** + * @packageDocumentation + * + * Manifest Details + * \`\`\`json + * { + * "module_name": "bounds-module", + * "version": "2.0.0" + * } + * \`\`\` + * + */ +export class ClassWithBounds { + private constructor(); + /** + * @remarks + * This property can't be used in read-only mode. + * + * Minimum Value: 1 + * + * Maximum Value: 255 + * + */ + w: number; + /** + * @remarks + * This property can't be used in read-only mode. + * + * Maximum Value: 255 + * + */ + x: number; + /** + * @remarks + * This property can't be used in read-only mode. + * + * Minimum Value: 1 + * + */ + y: number; + /** + * @remarks + * This property can't be used in read-only mode. + * + */ + z: number; + /** + * @remarks + * This function can't be called in read-only mode. + * + * @param w + * @param x + * Maximum value: 255 + * @param y + * Minimum value: 1 + * @param z * Minimum value: 1 * Maximum value: 255 */ - methodThatTakesBoundedValue(amount: number): void; + methodThatTakesBoundedValue(w: number, x: number, y: number, z: number): void; } " `; From 243e479725687c8fd5e5e22724b912063504d4c7 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Mon, 1 Dec 2025 23:18:15 -0800 Subject: [PATCH 15/25] Undo uncessary changes --- tools/api-docs-generator/src/changelog.ts | 5 +---- .../templates/msdocs/script/module_changelog.mustache | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/api-docs-generator/src/changelog.ts b/tools/api-docs-generator/src/changelog.ts index 010cef2..d048d09 100644 --- a/tools/api-docs-generator/src/changelog.ts +++ b/tools/api-docs-generator/src/changelog.ts @@ -138,10 +138,7 @@ const scriptingDataLayout: RootMetadataScope = { properties: { type: 'array', key: 'name', - submembers: { - is_read_only: { type: 'value' }, - type: TypeDataLayout, - }, + submembers: { is_read_only: { type: 'value' }, type: TypeDataLayout }, }, }, }, diff --git a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache index 3e9ae99..e0ac5e6 100644 --- a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache +++ b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache @@ -264,7 +264,6 @@ description: Changelog of the `{{{name}}}` module - Removed argument `{{{name}}}` {{/$removed}} {{^$added}}{{^$removed}} -- Changed argument `{{{name}}}` {{#type}} {{#$changed}} - Changed argument `{{{name}}}` type from {{#$old.type}}{{> type_with_links}}{{/$old.type}} to {{#$new.type}}{{> type_with_links}}{{/$new.type}} From 8aea94c2193f8d59964056ce413f9166390c3215 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Tue, 2 Dec 2025 10:59:12 -0800 Subject: [PATCH 16/25] Remove flags from property change listings. Changed text for min value and max value changes --- .../msdocs/script/module_changelog.mustache | 42 ++++++------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache index e0ac5e6..abce1b6 100644 --- a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache +++ b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache @@ -91,66 +91,48 @@ description: Changelog of the `{{{name}}}` module - Changed read-only flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* from `{{{$old}}}` to `{{{$new}}}` {{/$changed}} {{/is_read_only}} - {{#has_min}} - {{#$changed}} -- Changed has_min flag from `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$changed}} - {{#$added}} -- Added has_min flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$added}} - {{#$removed}} -- Removed has_min flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$removed}} + {{#has_min}} {{^$old}}{{#$new}} {{#min_value}} -- Added min_value `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* +- Added Minimum Bound of `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* {{/min_value}} {{/$new}}{{/$old}} {{#$old}}{{^$new}} -- Removed min_value for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* +- Removed Minimum Bound for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* {{/$new}}{{/$old}} {{#$old}}{{#$new}} {{#min_value}} {{#$changed}} -- Changed min_value from `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* +- Changed Minimum Bound of `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* {{/$changed}} {{#$added}} -- Added min_value`{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* +- Added Minimum Bound of `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* {{/$added}} {{#$removed}} -- Removed min_value`{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* +- Removed Minimum Bound of `{{{$old}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* {{/$removed}} {{/min_value}} {{/$new}}{{/$old}} {{/has_min}} - {{#has_max}} - {{#$changed}} -- Changed has_max flag from `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$changed}} - {{#$added}} -- Added has_max flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$added}} - {{#$removed}} -- Removed has_max flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$removed}} + {{#has_max}} {{^$old}}{{#$new}} {{#max_value}} -- Added max_value `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* +- Added Maximum Bound of `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* {{/max_value}} {{/$new}}{{/$old}} {{#$old}}{{^$new}} -- Removed max_value for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* +- Removed Maximum Bound for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* {{/$new}}{{/$old}} {{#$old}}{{#$new}} {{#max_value}} {{#$changed}} -- Changed min_value from `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* +- Changed Maximum Bound of `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* {{/$changed}} {{#$added}} -- Added min_value`{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* +- Added Maximum Bound of `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* {{/$added}} {{#$removed}} -- Removed min_value`{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* +- Removed Maximum Bound of `{{{$old}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* {{/$removed}} {{/max_value}} {{/$new}}{{/$old}} From 7f26fb39e4fa7875309d5e09fd6f9a861cb726bf Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Tue, 2 Dec 2025 22:40:29 -0800 Subject: [PATCH 17/25] Updated text by adding new bools for mustache use --- .../test/bounds/input/test-module_v1.json | 83 +++++++++- .../test/bounds/input/test-module_v2.json | 81 +++++++++- .../src/filters/CommonFilters.ts | 149 +++++++++++++++++ .../src/modules/MinecraftScriptModule.ts | 16 ++ .../msdocs/script/module_changelog.mustache | 150 +++++------------- 5 files changed, 362 insertions(+), 117 deletions(-) diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json index bb724c3..6276933 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json +++ b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json @@ -3,6 +3,42 @@ { "name": "ClassWithBounds", "properties": [ + { + "has_max": false, + "has_min": false, + "is_baked": false, + "is_read_only": false, + "max_value": -1, + "min_value": -255, + "name": "u", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "has_max": true, + "has_min": true, + "is_baked": false, + "is_read_only": false, + "max_value": -1, + "min_value": -255, + "name": "v", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { "has_max": false, "has_min": false, @@ -83,7 +119,43 @@ }, "functions": [ { - "arguments": [ + "arguments": [ + { + "details": { + "has_max": false, + "has_min": false, + "max_value": -1, + "min_value": -255 + }, + "name": "u", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "details": { + "has_max": true, + "has_min": true, + "max_value": -1, + "min_value": -255 + }, + "name": "v", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { "details": { "has_max": true, @@ -101,7 +173,8 @@ "min": -2147483648 } } - }, { + }, + { "details": { "has_max": false, "has_min": true, @@ -118,7 +191,8 @@ "min": -2147483648 } } - }, { + }, + { "details": { "has_max": true, "has_min": false, @@ -135,7 +209,8 @@ "min": -2147483648 } } - }, { + }, + { "details": { "has_max": false, "has_min": false, diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json index e4fa9e1..0124807 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json +++ b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json @@ -3,6 +3,42 @@ { "name": "ClassWithBounds", "properties": [ + { + "has_max": false, + "has_min": false, + "is_baked": false, + "is_read_only": false, + "max_value": 255, + "min_value": 1, + "name": "u", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "has_max": true, + "has_min": true, + "is_baked": false, + "is_read_only": false, + "max_value": 255, + "min_value": 1, + "name": "v", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { "has_max": true, "has_min": true, @@ -84,6 +120,42 @@ "functions": [ { "arguments": [ + { + "details": { + "has_max": false, + "has_min": false, + "max_value": 255, + "min_value": 1 + }, + "name": "u", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "details": { + "has_max": true, + "has_min": true, + "max_value": 255, + "min_value": 1 + }, + "name": "v", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { "details": { "has_max": false, @@ -101,7 +173,8 @@ "min": -2147483648 } } - }, { + }, + { "details": { "has_max": true, "has_min": false, @@ -118,7 +191,8 @@ "min": -2147483648 } } - }, { + }, + { "details": { "has_max": false, "has_min": true, @@ -135,7 +209,8 @@ "min": -2147483648 } } - }, { + }, + { "details": { "has_max": true, "has_min": true, diff --git a/tools/api-docs-generator/src/filters/CommonFilters.ts b/tools/api-docs-generator/src/filters/CommonFilters.ts index 035462d..7e3c88a 100644 --- a/tools/api-docs-generator/src/filters/CommonFilters.ts +++ b/tools/api-docs-generator/src/filters/CommonFilters.ts @@ -1742,6 +1742,154 @@ function boundValues(releases: MinecraftRelease[]) { } } +/** + * Marks up APIs that have bound values. + */ +function boundChanges(releases: MinecraftRelease[]) { + for (const release of releases) { + for (const scriptModule of release.script_modules) { + if (moduleHasChangelog(scriptModule)) { + for (const changelog of scriptModule.changelog) { + for (const classJson of changelog.classes) { + for (const propertyJson of classJson.properties) { + const has_min = propertyJson.has_min as unknown as { + $old: boolean; + $new: boolean; + has_changes?: boolean; + }; + + const min_value = propertyJson.min_value as { + $old: unknown; + $new: unknown; + has_changes?: boolean; + }; + + if (has_min && min_value) { + if (has_min.$old === true && has_min.$new === true) { + if (min_value.$old && min_value.$new && min_value.$old !== min_value.$new) { + propertyJson.min_changed = true; + } else if (min_value.$old === undefined && min_value.$new) { + propertyJson.min_added = true; + } else if (min_value.$old && min_value.$new === undefined) { + propertyJson.min_removed = true; + } + } else if (has_min.$old === false && has_min.$new === true) { + if (min_value.$new !== undefined) { + propertyJson.min_added = true; + } + } else if (has_min.$old === true && has_min.$new === false) { + if (min_value.$old !== undefined) { + propertyJson.min_removed = true; + } + // Conversion to $old and $new failed, since no changes were made + } else if (propertyJson.has_min === true && min_value.$old !== min_value.$new) { + propertyJson.min_changed = true; + } + } + + const has_max = propertyJson.has_max as unknown as { + $old: boolean; + $new: boolean; + has_changes?: boolean; + }; + + const max_value = propertyJson.max_value as { + $old: unknown; + $new: unknown; + has_changes?: boolean; + }; + + if (has_max && max_value) { + if (has_max.$old === true && has_max.$new === true) { + if (max_value.$old && max_value.$new && max_value.$old !== max_value.$new) { + propertyJson.max_changed = true; + } else if (max_value.$old === undefined && max_value.$new) { + propertyJson.max_added = true; + } else if (max_value.$old && max_value.$new === undefined) { + propertyJson.max_removed = true; + } + } else if (has_max.$old === false && has_max.$new === true) { + if (max_value.$new !== undefined) { + propertyJson.max_added = true; + } + } else if (has_max.$old === true && has_max.$new === false) { + if (max_value.$old !== undefined) { + propertyJson.max_removed = true; + } + // Conversion to $old and $new failed, since no changes were made + } else if (propertyJson.has_max === true && max_value.$old !== max_value.$new) { + propertyJson.max_changed = true; + } + } + } + + for (const functionJson of classJson.functions) { + for (const argumentJson of functionJson.arguments) { + type ArgumentDetails = { + default_value: unknown; + has_min: boolean; + min_value: unknown; + has_max: boolean; + max_value: unknown; + supported_values: unknown; + }; + + const details = argumentJson.details as { + $old: ArgumentDetails; + $new: ArgumentDetails; + has_changes?: boolean; + }; + + const oldDetails: ArgumentDetails = details.$old; + const newDetails: ArgumentDetails = details.$new; + + if (oldDetails === undefined && newDetails === undefined) { + continue; + } + + if (oldDetails !== undefined && newDetails === undefined) { + if (oldDetails.has_min && oldDetails.min_value !== undefined) { + argumentJson.min_removed = true; + } + if (oldDetails.has_max && oldDetails.max_value !== undefined) { + argumentJson.max_removed = true; + } + continue; + } + + if (oldDetails === undefined && newDetails !== undefined) { + if (newDetails.has_min && newDetails.min_value !== undefined) { + argumentJson.min_added = true; + } + if (newDetails.has_max && newDetails.max_value !== undefined) { + argumentJson.max_added = true; + } + continue; + } + + const validOldMin = oldDetails.has_min && oldDetails.min_value !== undefined; + const validOldMax = oldDetails.has_max && oldDetails.max_value !== undefined; + + const validNewMin = newDetails.has_min && newDetails.min_value !== undefined; + const validNewMax = newDetails.has_max && newDetails.max_value !== undefined; + + argumentJson.min_added = !validOldMin && validNewMin; + argumentJson.min_removed = validOldMin && !validNewMin; + argumentJson.min_changed = + validOldMin && validNewMin && oldDetails.min_value !== newDetails.min_value; + argumentJson.max_added = !validOldMax && validNewMax; + argumentJson.max_removed = validOldMax && !validNewMax; + argumentJson.max_changed = + validOldMax && validNewMax && oldDetails.max_value !== newDetails.max_value; + } + } + } + } + } + } + } +} + /** * Marks up APIs that have default values with 'has_defaults'. */ @@ -3367,6 +3515,7 @@ export const CommonFilters: FilterGroup = { ['constant_values', constantValues], ['default_values', defaultValues], ['bound_values', boundValues], + ['bound_changes', boundChanges], ['markup_categories', markupCategories], ['type_alias_markup', typeAliasMarkup], ['type_flags', typeFlags], diff --git a/tools/api-docs-generator/src/modules/MinecraftScriptModule.ts b/tools/api-docs-generator/src/modules/MinecraftScriptModule.ts index d4bce8a..1e20a3a 100644 --- a/tools/api-docs-generator/src/modules/MinecraftScriptModule.ts +++ b/tools/api-docs-generator/src/modules/MinecraftScriptModule.ts @@ -335,9 +335,17 @@ export const MinecraftPropertyRecord = Intersect( type: MinecraftTypeRecord, is_read_only: Boolean, has_min: Optional(Boolean), + min_value: Optional(Unknown.Or(Null)), has_max: Optional(Boolean), + max_value: Optional(Unknown.Or(Null)), is_baked: Optional(Boolean), default_value: Optional(Unknown.Or(Null)), + min_added: Optional(Boolean), + min_changed: Optional(Boolean), + min_removed: Optional(Boolean), + max_added: Optional(Boolean), + max_changed: Optional(Boolean), + max_removed: Optional(Boolean), // Runtime Markup property_name: Optional(String.Or(Null)), @@ -358,7 +366,9 @@ export function hasProperties(obj: object): obj is { properties: MinecraftProper export const MinecraftFunctionArgumentDetailsRecord = Record({ default_value: Optional(Unknown.Or(Null)), + has_min: Optional(Unknown.Or(Null)), min_value: Optional(Unknown.Or(Null)), + has_max: Optional(Unknown.Or(Null)), max_value: Optional(Unknown.Or(Null)), supported_values: Optional(Unknown.Or(Null)), }); @@ -370,6 +380,12 @@ export const MinecraftFunctionArgumentRecord = Intersect( Record({ type: MinecraftTypeRecord, details: Optional(MinecraftFunctionArgumentDetailsRecord.Or(Null)), + min_added: Optional(Boolean), + min_changed: Optional(Boolean), + min_removed: Optional(Boolean), + max_added: Optional(Boolean), + max_changed: Optional(Boolean), + max_removed: Optional(Boolean), // Runtime Markup argument_description: Optional(Array(String).Or(Null)), diff --git a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache index abce1b6..5a72ffc 100644 --- a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache +++ b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache @@ -90,53 +90,25 @@ description: Changelog of the `{{{name}}}` module {{#$changed}} - Changed read-only flag for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* from `{{{$old}}}` to `{{{$new}}}` {{/$changed}} - {{/is_read_only}} - {{#has_min}} - {{^$old}}{{#$new}} - {{#min_value}} -- Added Minimum Bound of `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/min_value}} - {{/$new}}{{/$old}} - {{#$old}}{{^$new}} -- Removed Minimum Bound for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$new}}{{/$old}} - {{#$old}}{{#$new}} - {{#min_value}} - {{#$changed}} -- Changed Minimum Bound of `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$changed}} - {{#$added}} -- Added Minimum Bound of `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$added}} - {{#$removed}} -- Removed Minimum Bound of `{{{$old}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$removed}} - {{/min_value}} - {{/$new}}{{/$old}} - {{/has_min}} - {{#has_max}} - {{^$old}}{{#$new}} - {{#max_value}} -- Added Maximum Bound of `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/max_value}} - {{/$new}}{{/$old}} - {{#$old}}{{^$new}} -- Removed Maximum Bound for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$new}}{{/$old}} - {{#$old}}{{#$new}} - {{#max_value}} - {{#$changed}} -- Changed Maximum Bound of `{{{$old}}}` to `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$changed}} - {{#$added}} -- Added Maximum Bound of `{{{$new}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$added}} - {{#$removed}} -- Removed Maximum Bound of `{{{$old}}}` for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* - {{/$removed}} - {{/max_value}} - {{/$new}}{{/$old}} - {{/has_max}} + {{/is_read_only}} + {{#min_added}} +- Added minimum bound of `{{{min_value.$new}}}` for property *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/min_added}} + {{#min_changed}} +- Changed minimum bound of `{{{min_value.$old}}}` to `{{{min_value.$new}}}` for property *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/min_changed}} + {{#min_removed}} +- Removed minimum bound for property *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/min_removed}} + {{#max_added}} +- Added maximum bound of `{{{max_value.$new}}}` for property *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/max_added}} + {{#max_changed}} +- Changed maximum bound of `{{{max_value.$old}}}` to `{{{max_value.$new}}}` for property *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/max_changed}} + {{#max_removed}} +- Removed maximum bound for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* + {{/max_removed}} {{#type}} {{#$changed}} - Changed type for *[`{{{name}}}`]({{class_name}}.md#{{bookmark_name}})* from {{#$old.type}}{{> type_with_links}}{{#is_errorable}} (throws exceptions){{/is_errorable}}{{/$old.type}} to {{#$new.type}}{{> type_with_links}}{{#is_errorable}} (throws exceptions){{/is_errorable}}{{/$new.type}} @@ -186,38 +158,27 @@ description: Changelog of the `{{{name}}}` module - Changed argument `{{{name}}}` type from {{#$old.type}}{{> type_with_links}}{{#is_errorable}} (throws exceptions){{/is_errorable}}{{/$old.type}} to {{#$new.type}}{{> type_with_links}}{{#is_errorable}} (throws exceptions){{/is_errorable}}{{/$new.type}} {{/$changed}} {{/type}} - {{#details}} - {{#$changed}} - - Changed details of argument `{{{name}}}` - from: - {{#$old.has_min}} - - Minimum Bound: {{$old.min_value}} - {{/$old.has_min}} - {{^$old.has_min}} - - Minimum Bound: None - {{/$old.has_min}} - {{#$old.has_max}} - - Maximum Bound: {{$old.max_value}} - {{/$old.has_max}} - {{^$old.has_max}} - - Maximum Bound: None - {{/$old.has_max}} - to: - {{#$new.has_min}} - - Minimum Bound: {{$new.min_value}} - {{/$new.has_min}} - {{^$new.has_min}} - - Minimum Bound: None - {{/$new.has_min}} - {{#$new.has_max}} - - Maximum Bound: {{$new.max_value}} - {{/$new.has_max}} - {{^$new.has_max}} - - Maximum Bound: None - {{/$new.has_max}} - {{/$changed}} - {{/details}} {{/$removed}}{{/$added}} + {{#details}} + {{#min_added}} + - Added minimum bound of `{{{$new.min_value}}}` to argument `{{{name}}}` + {{/min_added}} + {{#min_changed}} + - Changed minimum bound from `{{{$old.min_value}}}` to `{{{$new.min_value}}}` for argument `{{{name}}}` + {{/min_changed}} + {{#min_removed}} + - Removed minimum bound of `{{{$old.min_value}}}` from argument `{{{name}}}` + {{/min_removed}} + {{#max_added}} + - Added maximum bound of `{{{$new.max_value}}}` to argument `{{{name}}}` + {{/max_added}} + {{#max_changed}} + - Changed maximum bound from `{{{$old.max_value}}}` to `{{{$new.max_value}}}` for argument `{{{name}}}` + {{/max_changed}} + {{#max_removed}} + - Removed maximum bound of `{{{$old.max_value}}}` from argument `{{{name}}}` + {{/max_removed}} + {{/details}} {{/arguments}} {{/$removed}}{{/$added}}{{/has_changes}} {{/functions}} @@ -250,38 +211,7 @@ description: Changelog of the `{{{name}}}` module {{#$changed}} - Changed argument `{{{name}}}` type from {{#$old.type}}{{> type_with_links}}{{/$old.type}} to {{#$new.type}}{{> type_with_links}}{{/$new.type}} {{/$changed}} - {{/type}} - {{#details}} - {{#$changed}} - - Changed details of argument `{{{name}}}` - from: - {{#$old.has_min}} - - Minimum Bound: {{$old.min_value}} - {{/$old.has_min}} - {{^$old.has_min}} - - Minimum Bound: None - {{/$old.has_min}} - {{#$old.has_max}} - - Maximum Bound: {{$old.max_value}} - {{/$old.has_max}} - {{^$old.has_max}} - - Maximum Bound: None - {{/$old.has_max}} - to: - {{#$new.has_min}} - - Minimum Bound: {{$new.min_value}} - {{/$new.has_min}} - {{^$new.has_min}} - - Minimum Bound: None - {{/$new.has_min}} - {{#$new.has_max}} - - Maximum Bound: {{$new.max_value}} - {{/$new.has_max}} - {{^$new.has_max}} - - Maximum Bound: None - {{/$new.has_max}} - {{/$changed}} - {{/details}} + {{/type}} {{/$removed}}{{/$added}} {{/arguments}} {{/$removed}}{{/$added}}{{/has_changes}} From 1d1eea347a3ee18a53e2bebf702ff94ac50b4897 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Wed, 3 Dec 2025 10:06:31 -0800 Subject: [PATCH 18/25] Updated tests --- .../bounds/__snapshots__/bounds.spec.ts.snap | 262 ++++++++++++++---- .../test/bounds/input/test-module_v1.json | 76 ++++- .../test/bounds/input/test-module_v2.json | 71 +++++ 3 files changed, 359 insertions(+), 50 deletions(-) diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap b/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap index c864795..6f72474 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap +++ b/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap @@ -29,6 +29,42 @@ description: Contents of the bounds-module.ClassWithBounds class (Version 1.x.x) ## Properties +### **s** +\`s: number;\` + +Type: *number* + +Notes: + - This property has a minimum bound of \`-255\` + - This property can't be used in read-only mode. + +### **t** +\`t: number;\` + +Type: *number* + +Notes: + - This property has a maximum bound of \`1\` + - This property can't be used in read-only mode. + +### **u** +\`u: number;\` + +Type: *number* + +Notes: + - This property can't be used in read-only mode. + +### **v** +\`v: number;\` + +Type: *number* + +Notes: + - This property has a minimum bound of \`-255\` + - This property has a maximum bound of \`-1\` + - This property can't be used in read-only mode. + ### **w** \`w: number;\` @@ -70,10 +106,18 @@ Notes: ### **methodThatTakesBoundedValue** \` -methodThatTakesBoundedValue(w: number, x: number, y: number, z: number): void +methodThatTakesBoundedValue(s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number): void \` #### **Parameters** +- **s**: *number* + Minimum Bound: \`-255\` +- **t**: *number* + Maximum Bound: \`1\` +- **u**: *number* +- **v**: *number* + Minimum Bound: \`-255\` + Maximum Bound: \`-1\` - **w**: *number* Minimum Bound: \`1\` Maximum Bound: \`255\` @@ -147,6 +191,42 @@ description: Contents of the bounds-module.ClassWithBounds class. ## Properties +### **s** +\`s: number;\` + +Type: *number* + +Notes: + - This property has a minimum bound of \`1\` + - This property can't be used in read-only mode. + +### **t** +\`t: number;\` + +Type: *number* + +Notes: + - This property has a maximum bound of \`255\` + - This property can't be used in read-only mode. + +### **u** +\`u: number;\` + +Type: *number* + +Notes: + - This property can't be used in read-only mode. + +### **v** +\`v: number;\` + +Type: *number* + +Notes: + - This property has a minimum bound of \`1\` + - This property has a maximum bound of \`255\` + - This property can't be used in read-only mode. + ### **w** \`w: number;\` @@ -188,10 +268,18 @@ Notes: ### **methodThatTakesBoundedValue** \` -methodThatTakesBoundedValue(w: number, x: number, y: number, z: number): void +methodThatTakesBoundedValue(s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number): void \` #### **Parameters** +- **s**: *number* + Minimum Bound: \`1\` +- **t**: *number* + Maximum Bound: \`255\` +- **u**: *number* +- **v**: *number* + Minimum Bound: \`1\` + Maximum Bound: \`255\` - **w**: *number* - **x**: *number* Maximum Bound: \`255\` @@ -263,51 +351,31 @@ description: Changelog of the \`bounds-module\` module ## 2.0.0 #### Changed *[\`ClassWithBounds\`](ClassWithBounds.md)* -- Changed has_min flag from \`false\` to \`true\` for *[\`w\`](ClassWithBounds.md#w)* -- Added min_value \`1\` for *[\`w\`](ClassWithBounds.md#w)* -- Changed has_max flag from \`false\` to \`true\` for *[\`w\`](ClassWithBounds.md#w)* -- Added max_value \`255\` for *[\`w\`](ClassWithBounds.md#w)* -- Changed has_min flag from \`true\` to \`false\` for *[\`x\`](ClassWithBounds.md#x)* -- Removed min_value for *[\`x\`](ClassWithBounds.md#x)* -- Changed has_max flag from \`false\` to \`true\` for *[\`x\`](ClassWithBounds.md#x)* -- Added max_value \`255\` for *[\`x\`](ClassWithBounds.md#x)* -- Changed has_min flag from \`false\` to \`true\` for *[\`y\`](ClassWithBounds.md#y)* -- Added min_value \`1\` for *[\`y\`](ClassWithBounds.md#y)* -- Changed has_max flag from \`true\` to \`false\` for *[\`y\`](ClassWithBounds.md#y)* -- Removed max_value for *[\`y\`](ClassWithBounds.md#y)* -- Changed has_min flag from \`true\` to \`false\` for *[\`z\`](ClassWithBounds.md#z)* -- Removed min_value for *[\`z\`](ClassWithBounds.md#z)* -- Changed has_max flag from \`true\` to \`false\` for *[\`z\`](ClassWithBounds.md#z)* -- Removed max_value for *[\`z\`](ClassWithBounds.md#z)* +- Changed minimum bound of \`-255\` to \`1\` for property *[\`s\`](ClassWithBounds.md#s)* +- Changed maximum bound of \`1\` to \`255\` for property *[\`t\`](ClassWithBounds.md#t)* +- Changed minimum bound of \`-255\` to \`1\` for property *[\`v\`](ClassWithBounds.md#v)* +- Changed maximum bound of \`-1\` to \`255\` for property *[\`v\`](ClassWithBounds.md#v)* +- Added minimum bound of \`1\` for property *[\`w\`](ClassWithBounds.md#w)* +- Added maximum bound of \`255\` for property *[\`w\`](ClassWithBounds.md#w)* +- Removed minimum bound for property *[\`x\`](ClassWithBounds.md#x)* +- Added maximum bound of \`255\` for property *[\`x\`](ClassWithBounds.md#x)* +- Added minimum bound of \`1\` for property *[\`y\`](ClassWithBounds.md#y)* +- Removed maximum bound for *[\`y\`](ClassWithBounds.md#y)* +- Removed minimum bound for property *[\`z\`](ClassWithBounds.md#z)* +- Removed maximum bound for *[\`z\`](ClassWithBounds.md#z)* - Changed function *[\`methodThatTakesBoundedValue\`](ClassWithBounds.md#methodthattakesboundedvalue)* - - Changed details of argument \`w\` - from: - - Minimum Bound: 1 - - Maximum Bound: 255 - to: - - Minimum Bound: None - - Maximum Bound: None - - Changed details of argument \`x\` - from: - - Minimum Bound: 1 - - Maximum Bound: None - to: - - Minimum Bound: None - - Maximum Bound: 255 - - Changed details of argument \`y\` - from: - - Minimum Bound: None - - Maximum Bound: 255 - to: - - Minimum Bound: 1 - - Maximum Bound: None - - Changed details of argument \`z\` - from: - - Minimum Bound: None - - Maximum Bound: None - to: - - Minimum Bound: 1 - - Maximum Bound: 255 + - Changed minimum bound from \`-255\` to \`1\` for argument \`s\` + - Changed maximum bound from \`1\` to \`255\` for argument \`t\` + - Changed minimum bound from \`-255\` to \`1\` for argument \`v\` + - Changed maximum bound from \`-1\` to \`255\` for argument \`v\` + - Removed minimum bound of \`1\` from argument \`w\` + - Removed maximum bound of \`255\` from argument \`w\` + - Removed minimum bound of \`1\` from argument \`x\` + - Added maximum bound of \`255\` to argument \`x\` + - Added minimum bound of \`1\` to argument \`y\` + - Removed maximum bound of \`255\` from argument \`y\` + - Added minimum bound of \`1\` to argument \`z\` + - Added maximum bound of \`255\` to argument \`z\` ## 1.0.0 #### Added \`bounds-module\` Module " @@ -336,6 +404,38 @@ exports[`Bounds > Properly generates documentation for modules which contain bou */ export class ClassWithBounds { private constructor(); + /** + * @remarks + * This property can't be used in read-only mode. + * + * Minimum Value: -255 + * + */ + s: number; + /** + * @remarks + * This property can't be used in read-only mode. + * + * Maximum Value: 1 + * + */ + t: number; + /** + * @remarks + * This property can't be used in read-only mode. + * + */ + u: number; + /** + * @remarks + * This property can't be used in read-only mode. + * + * Minimum Value: -255 + * + * Maximum Value: -1 + * + */ + v: number; /** * @remarks * This property can't be used in read-only mode. @@ -372,6 +472,14 @@ export class ClassWithBounds { * @remarks * This function can't be called in read-only mode. * + * @param s + * Minimum value: -255 + * @param t + * Maximum value: 1 + * @param u + * @param v + * Minimum value: -255 + * Maximum value: -1 * @param w * Minimum value: 1 * Maximum value: 255 @@ -381,7 +489,16 @@ export class ClassWithBounds { * Maximum value: 255 * @param z */ - methodThatTakesBoundedValue(w: number, x: number, y: number, z: number): void; + methodThatTakesBoundedValue( + s: number, + t: number, + u: number, + v: number, + w: number, + x: number, + y: number, + z: number + ): void; } " `; @@ -409,6 +526,38 @@ exports[`Bounds > Properly generates documentation for modules which contain bou */ export class ClassWithBounds { private constructor(); + /** + * @remarks + * This property can't be used in read-only mode. + * + * Minimum Value: 1 + * + */ + s: number; + /** + * @remarks + * This property can't be used in read-only mode. + * + * Maximum Value: 255 + * + */ + t: number; + /** + * @remarks + * This property can't be used in read-only mode. + * + */ + u: number; + /** + * @remarks + * This property can't be used in read-only mode. + * + * Minimum Value: 1 + * + * Maximum Value: 255 + * + */ + v: number; /** * @remarks * This property can't be used in read-only mode. @@ -445,6 +594,14 @@ export class ClassWithBounds { * @remarks * This function can't be called in read-only mode. * + * @param s + * Minimum value: 1 + * @param t + * Maximum value: 255 + * @param u + * @param v + * Minimum value: 1 + * Maximum value: 255 * @param w * @param x * Maximum value: 255 @@ -454,7 +611,16 @@ export class ClassWithBounds { * Minimum value: 1 * Maximum value: 255 */ - methodThatTakesBoundedValue(w: number, x: number, y: number, z: number): void; + methodThatTakesBoundedValue( + s: number, + t: number, + u: number, + v: number, + w: number, + x: number, + y: number, + z: number + ): void; } " `; diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json index 6276933..ebebc2e 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json +++ b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v1.json @@ -2,7 +2,43 @@ "classes": [ { "name": "ClassWithBounds", - "properties": [ + "properties": [ + { + "has_max": false, + "has_min": true, + "is_baked": false, + "is_read_only": false, + "max_value": 2147483647, + "min_value": -255, + "name": "s", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "has_max": true, + "has_min": false, + "is_baked": false, + "is_read_only": false, + "max_value": 1, + "min_value": -2147483648, + "name": "t", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { "has_max": false, "has_min": false, @@ -119,7 +155,43 @@ }, "functions": [ { - "arguments": [ + "arguments": [ + { + "details": { + "has_max": false, + "has_min": true, + "max_value": 2147483647, + "min_value": -255 + }, + "name": "s", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "details": { + "has_max": true, + "has_min": false, + "max_value": 1, + "min_value": -2147483648 + }, + "name": "t", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { "details": { "has_max": false, diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json index 0124807..6b3d759 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json +++ b/tools/api-docs-generator-test-snapshots/test/bounds/input/test-module_v2.json @@ -4,6 +4,41 @@ "name": "ClassWithBounds", "properties": [ { + "has_max": false, + "has_min": true, + "is_baked": false, + "is_read_only": false, + "max_value": 2147483647, + "min_value": 1, + "name": "s", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "has_max": true, + "has_min": false, + "is_baked": false, + "is_read_only": false, + "max_value": 255, + "min_value": -2147483648, + "name": "t", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + },{ "has_max": false, "has_min": false, "is_baked": false, @@ -120,6 +155,42 @@ "functions": [ { "arguments": [ + { + "details": { + "has_max": false, + "has_min": true, + "max_value": 2147483647, + "min_value": 1 + }, + "name": "s", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "details": { + "has_max": true, + "has_min": false, + "max_value": 255, + "min_value": -2147483648 + }, + "name": "t", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, { "details": { "has_max": false, From 9e9db3bf7b732267910a03767977ad499156b902 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Wed, 3 Dec 2025 13:13:20 -0800 Subject: [PATCH 19/25] Updated tests --- .../changelogDiffing.spec.ts.snap | 81 ++++++++++++++++++- ...minecraftVersionShippedStable.spec.ts.snap | 48 ++++++++++- .../src/filters/CommonFilters.ts | 38 ++++----- 3 files changed, 141 insertions(+), 26 deletions(-) diff --git a/tools/api-docs-generator-test-snapshots/test/changelog_diffing/__snapshots__/changelogDiffing.spec.ts.snap b/tools/api-docs-generator-test-snapshots/test/changelog_diffing/__snapshots__/changelogDiffing.spec.ts.snap index 8b8c3b2..89eacbe 100644 --- a/tools/api-docs-generator-test-snapshots/test/changelog_diffing/__snapshots__/changelogDiffing.spec.ts.snap +++ b/tools/api-docs-generator-test-snapshots/test/changelog_diffing/__snapshots__/changelogDiffing.spec.ts.snap @@ -380,7 +380,7 @@ exports[`Changelog Diffing > Generates correct output for changelog diffs > chan { "arguments": [ { - "details": null, + "details": [], "name": "arg", "type": { "$old": { @@ -477,7 +477,34 @@ exports[`Changelog Diffing > Generates correct output for changelog diffs > chan "call_privilege": [] }, { - "arguments": [], + "arguments": [ + { + "details": [], + "name": "stringArgument", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "string", + "valid_range": null + } + }, + { + "details": [], + "name": "stringArgumentOptional", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "optional", + "optional_type": { + "is_bind_type": false, + "is_errorable": false, + "name": "string", + "valid_range": null + }, + "valid_range": null + } + } + ], "is_constructor": false, "is_static": false, "name": "testMethod", @@ -698,7 +725,47 @@ exports[`Changelog Diffing > Generates correct output for changelog diffs > chan "constants": [], "functions": [ { - "arguments": [], + "arguments": [ + { + "details": [], + "name": "x", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "details": [], + "name": "y", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + }, + { + "details": [], + "name": "z", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "int32", + "valid_range": { + "max": 2147483647, + "min": -2147483648 + } + } + } + ], "is_constructor": true, "name": "constructor", "return_type": { @@ -1003,7 +1070,7 @@ exports[`Changelog Diffing > Generates correct output for changelog diffs > chan { "arguments": [ { - "details": null, + "details": [], "name": "arg", "type": { "$old": { @@ -4270,6 +4337,9 @@ export class ClassWithConstructor { * @remarks * This function can't be called in read-only mode. * + * @param x + * @param y + * @param z */ constructor(x: number, y: number, z: number); } @@ -4580,6 +4650,9 @@ export class ClassWithConstructor { * @remarks * This function can't be called in read-only mode. * + * @param x + * @param y + * @param z */ constructor(x: number, y: number, z: number); /** diff --git a/tools/api-docs-generator-test-snapshots/test/minecraft_version_shipped_stable/__snapshots__/minecraftVersionShippedStable.spec.ts.snap b/tools/api-docs-generator-test-snapshots/test/minecraft_version_shipped_stable/__snapshots__/minecraftVersionShippedStable.spec.ts.snap index f7c2416..f9ed3b9 100644 --- a/tools/api-docs-generator-test-snapshots/test/minecraft_version_shipped_stable/__snapshots__/minecraftVersionShippedStable.spec.ts.snap +++ b/tools/api-docs-generator-test-snapshots/test/minecraft_version_shipped_stable/__snapshots__/minecraftVersionShippedStable.spec.ts.snap @@ -14,7 +14,17 @@ exports[`Minecraft Version Shipped Stable > Generates correct output for module "objects": [], "functions": [ { - "arguments": [], + "arguments": [ + { + "details": [], + "name": "arg", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "string" + } + } + ], "is_constructor": false, "name": "TestFunction", "return_type": { @@ -52,7 +62,17 @@ exports[`Minecraft Version Shipped Stable > Generates correct output for module "objects": [], "functions": [ { - "arguments": [], + "arguments": [ + { + "details": [], + "name": "arg", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "string" + } + } + ], "is_constructor": false, "name": "TestFunction", "return_type": { @@ -851,7 +871,17 @@ exports[`Minecraft Version Shipped Stable > Generates correct output for module "objects": [], "functions": [ { - "arguments": [], + "arguments": [ + { + "details": [], + "name": "arg", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "string" + } + } + ], "is_constructor": false, "name": "TestFunction", "return_type": { @@ -889,7 +919,17 @@ exports[`Minecraft Version Shipped Stable > Generates correct output for module "objects": [], "functions": [ { - "arguments": [], + "arguments": [ + { + "details": [], + "name": "arg", + "type": { + "is_bind_type": false, + "is_errorable": false, + "name": "string" + } + } + ], "is_constructor": false, "name": "TestFunction", "return_type": { diff --git a/tools/api-docs-generator/src/filters/CommonFilters.ts b/tools/api-docs-generator/src/filters/CommonFilters.ts index 7e3c88a..b8d7b1a 100644 --- a/tools/api-docs-generator/src/filters/CommonFilters.ts +++ b/tools/api-docs-generator/src/filters/CommonFilters.ts @@ -1838,49 +1838,51 @@ function boundChanges(releases: MinecraftRelease[]) { $old: ArgumentDetails; $new: ArgumentDetails; has_changes?: boolean; - }; - - const oldDetails: ArgumentDetails = details.$old; - const newDetails: ArgumentDetails = details.$new; - - if (oldDetails === undefined && newDetails === undefined) { + } | null; + + if ( + details === undefined || + // eslint-disable-next-line unicorn/no-null + details === null || + (details.$old === undefined && details.$new === undefined) + ) { continue; } - if (oldDetails !== undefined && newDetails === undefined) { - if (oldDetails.has_min && oldDetails.min_value !== undefined) { + if (details.$old !== undefined && details.$new === undefined) { + if (details.$old.has_min && details.$old.min_value !== undefined) { argumentJson.min_removed = true; } - if (oldDetails.has_max && oldDetails.max_value !== undefined) { + if (details.$old.has_max && details.$old.max_value !== undefined) { argumentJson.max_removed = true; } continue; } - if (oldDetails === undefined && newDetails !== undefined) { - if (newDetails.has_min && newDetails.min_value !== undefined) { + if (details.$old === undefined && details.$new !== undefined) { + if (details.$new.has_min && details.$new.min_value !== undefined) { argumentJson.min_added = true; } - if (newDetails.has_max && newDetails.max_value !== undefined) { + if (details.$new.has_max && details.$new.max_value !== undefined) { argumentJson.max_added = true; } continue; } - const validOldMin = oldDetails.has_min && oldDetails.min_value !== undefined; - const validOldMax = oldDetails.has_max && oldDetails.max_value !== undefined; + const validOldMin = details.$old.has_min && details.$old.min_value !== undefined; + const validOldMax = details.$old.has_max && details.$old.max_value !== undefined; - const validNewMin = newDetails.has_min && newDetails.min_value !== undefined; - const validNewMax = newDetails.has_max && newDetails.max_value !== undefined; + const validNewMin = details.$new.has_min && details.$new.min_value !== undefined; + const validNewMax = details.$new.has_max && details.$new.max_value !== undefined; argumentJson.min_added = !validOldMin && validNewMin; argumentJson.min_removed = validOldMin && !validNewMin; argumentJson.min_changed = - validOldMin && validNewMin && oldDetails.min_value !== newDetails.min_value; + validOldMin && validNewMin && details.$old.min_value !== details.$new.min_value; argumentJson.max_added = !validOldMax && validNewMax; argumentJson.max_removed = validOldMax && !validNewMax; argumentJson.max_changed = - validOldMax && validNewMax && oldDetails.max_value !== newDetails.max_value; + validOldMax && validNewMax && details.$old.max_value !== details.$new.max_value; } } } From ac4667183e2437cf35c88174893d7d6e82654e1a Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Wed, 3 Dec 2025 13:19:56 -0800 Subject: [PATCH 20/25] Updated Bounds test with latest main changes --- .../bounds/__snapshots__/bounds.spec.ts.snap | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap b/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap index 6f72474..2b178b8 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap +++ b/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap @@ -36,7 +36,7 @@ Type: *number* Notes: - This property has a minimum bound of \`-255\` - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **t** \`t: number;\` @@ -45,7 +45,7 @@ Type: *number* Notes: - This property has a maximum bound of \`1\` - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **u** \`u: number;\` @@ -53,7 +53,7 @@ Notes: Type: *number* Notes: - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **v** \`v: number;\` @@ -63,7 +63,7 @@ Type: *number* Notes: - This property has a minimum bound of \`-255\` - This property has a maximum bound of \`-1\` - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **w** \`w: number;\` @@ -71,7 +71,7 @@ Notes: Type: *number* Notes: - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **x** \`x: number;\` @@ -80,7 +80,7 @@ Type: *number* Notes: - This property has a minimum bound of \`1\` - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **y** \`y: number;\` @@ -89,7 +89,7 @@ Type: *number* Notes: - This property has a maximum bound of \`255\` - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **z** \`z: number;\` @@ -99,7 +99,7 @@ Type: *number* Notes: - This property has a minimum bound of \`1\` - This property has a maximum bound of \`255\` - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ## Methods - [methodThatTakesBoundedValue](#methodthattakesboundedvalue) @@ -130,7 +130,7 @@ methodThatTakesBoundedValue(s: number, t: number, u: number, v: number, w: numbe **Returns** *void* Notes: -- This function can't be called in read-only mode. +- This function can't be called in restricted-execution mode. " `; @@ -198,7 +198,7 @@ Type: *number* Notes: - This property has a minimum bound of \`1\` - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **t** \`t: number;\` @@ -207,7 +207,7 @@ Type: *number* Notes: - This property has a maximum bound of \`255\` - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **u** \`u: number;\` @@ -215,7 +215,7 @@ Notes: Type: *number* Notes: - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **v** \`v: number;\` @@ -225,7 +225,7 @@ Type: *number* Notes: - This property has a minimum bound of \`1\` - This property has a maximum bound of \`255\` - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **w** \`w: number;\` @@ -235,7 +235,7 @@ Type: *number* Notes: - This property has a minimum bound of \`1\` - This property has a maximum bound of \`255\` - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **x** \`x: number;\` @@ -244,7 +244,7 @@ Type: *number* Notes: - This property has a maximum bound of \`255\` - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **y** \`y: number;\` @@ -253,7 +253,7 @@ Type: *number* Notes: - This property has a minimum bound of \`1\` - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ### **z** \`z: number;\` @@ -261,7 +261,7 @@ Notes: Type: *number* Notes: - - This property can't be used in read-only mode. + - This property can't be used in restricted-execution mode. ## Methods - [methodThatTakesBoundedValue](#methodthattakesboundedvalue) @@ -292,7 +292,7 @@ methodThatTakesBoundedValue(s: number, t: number, u: number, v: number, w: numbe **Returns** *void* Notes: -- This function can't be called in read-only mode. +- This function can't be called in restricted-execution mode. " `; @@ -406,7 +406,7 @@ export class ClassWithBounds { private constructor(); /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * * Minimum Value: -255 * @@ -414,7 +414,7 @@ export class ClassWithBounds { s: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * * Maximum Value: 1 * @@ -422,13 +422,13 @@ export class ClassWithBounds { t: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * */ u: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * * Minimum Value: -255 * @@ -438,13 +438,13 @@ export class ClassWithBounds { v: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * */ w: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * * Minimum Value: 1 * @@ -452,7 +452,7 @@ export class ClassWithBounds { x: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * * Maximum Value: 255 * @@ -460,7 +460,7 @@ export class ClassWithBounds { y: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * * Minimum Value: 1 * @@ -470,7 +470,7 @@ export class ClassWithBounds { z: number; /** * @remarks - * This function can't be called in read-only mode. + * This function can't be called in restricted-execution mode. * * @param s * Minimum value: -255 @@ -528,7 +528,7 @@ export class ClassWithBounds { private constructor(); /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * * Minimum Value: 1 * @@ -536,7 +536,7 @@ export class ClassWithBounds { s: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * * Maximum Value: 255 * @@ -544,13 +544,13 @@ export class ClassWithBounds { t: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * */ u: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * * Minimum Value: 1 * @@ -560,7 +560,7 @@ export class ClassWithBounds { v: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * * Minimum Value: 1 * @@ -570,7 +570,7 @@ export class ClassWithBounds { w: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * * Maximum Value: 255 * @@ -578,7 +578,7 @@ export class ClassWithBounds { x: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * * Minimum Value: 1 * @@ -586,13 +586,13 @@ export class ClassWithBounds { y: number; /** * @remarks - * This property can't be used in read-only mode. + * This property can't be used in restricted-execution mode. * */ z: number; /** * @remarks - * This function can't be called in read-only mode. + * This function can't be called in restricted-execution mode. * * @param s * Minimum value: 1 From f0a3d2d0f9f696539c66b90e5eca6377fdf573c2 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Wed, 3 Dec 2025 13:34:24 -0800 Subject: [PATCH 21/25] Change files --- ...ocs-generator-72dc3fde-8170-4c70-80d3-8ec997ea737a.json | 7 +++++++ ...rators-plugin-ca1f3867-e66f-44bf-9e32-2ea263c692af.json | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 change/@minecraft-api-docs-generator-72dc3fde-8170-4c70-80d3-8ec997ea737a.json create mode 100644 change/@minecraft-markup-generators-plugin-ca1f3867-e66f-44bf-9e32-2ea263c692af.json diff --git a/change/@minecraft-api-docs-generator-72dc3fde-8170-4c70-80d3-8ec997ea737a.json b/change/@minecraft-api-docs-generator-72dc3fde-8170-4c70-80d3-8ec997ea737a.json new file mode 100644 index 0000000..3c3a63a --- /dev/null +++ b/change/@minecraft-api-docs-generator-72dc3fde-8170-4c70-80d3-8ec997ea737a.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "Added property and function argument bounds data to metadata", + "packageName": "@minecraft/api-docs-generator", + "email": "brandon.chan@skyboxlabs.com", + "dependentChangeType": "patch" +} diff --git a/change/@minecraft-markup-generators-plugin-ca1f3867-e66f-44bf-9e32-2ea263c692af.json b/change/@minecraft-markup-generators-plugin-ca1f3867-e66f-44bf-9e32-2ea263c692af.json new file mode 100644 index 0000000..06dbad4 --- /dev/null +++ b/change/@minecraft-markup-generators-plugin-ca1f3867-e66f-44bf-9e32-2ea263c692af.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "Added property and function argument bounds data to metadata", + "packageName": "@minecraft/markup-generators-plugin", + "email": "brandon.chan@skyboxlabs.com", + "dependentChangeType": "patch" +} From b21792f265fe3850c916f430ea1cf161bb4e4b87 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Wed, 3 Dec 2025 14:53:24 -0800 Subject: [PATCH 22/25] Addressing feedback --- .../changelogDiffing.spec.ts.snap | 81 +----- ...minecraftVersionShippedStable.spec.ts.snap | 48 +--- .../src/filters/CommonFilters.ts | 232 +++++++++--------- .../src/modules/MinecraftScriptModule.ts | 2 - .../msdocs/script/module_changelog.mustache | 2 +- 5 files changed, 126 insertions(+), 239 deletions(-) diff --git a/tools/api-docs-generator-test-snapshots/test/changelog_diffing/__snapshots__/changelogDiffing.spec.ts.snap b/tools/api-docs-generator-test-snapshots/test/changelog_diffing/__snapshots__/changelogDiffing.spec.ts.snap index c6d5c56..8cf42ea 100644 --- a/tools/api-docs-generator-test-snapshots/test/changelog_diffing/__snapshots__/changelogDiffing.spec.ts.snap +++ b/tools/api-docs-generator-test-snapshots/test/changelog_diffing/__snapshots__/changelogDiffing.spec.ts.snap @@ -380,7 +380,7 @@ exports[`Changelog Diffing > Generates correct output for changelog diffs > chan { "arguments": [ { - "details": [], + "details": null, "name": "arg", "type": { "$old": { @@ -477,34 +477,7 @@ exports[`Changelog Diffing > Generates correct output for changelog diffs > chan "call_privilege": [] }, { - "arguments": [ - { - "details": [], - "name": "stringArgument", - "type": { - "is_bind_type": false, - "is_errorable": false, - "name": "string", - "valid_range": null - } - }, - { - "details": [], - "name": "stringArgumentOptional", - "type": { - "is_bind_type": false, - "is_errorable": false, - "name": "optional", - "optional_type": { - "is_bind_type": false, - "is_errorable": false, - "name": "string", - "valid_range": null - }, - "valid_range": null - } - } - ], + "arguments": [], "is_constructor": false, "is_static": false, "name": "testMethod", @@ -725,47 +698,7 @@ exports[`Changelog Diffing > Generates correct output for changelog diffs > chan "constants": [], "functions": [ { - "arguments": [ - { - "details": [], - "name": "x", - "type": { - "is_bind_type": false, - "is_errorable": false, - "name": "int32", - "valid_range": { - "max": 2147483647, - "min": -2147483648 - } - } - }, - { - "details": [], - "name": "y", - "type": { - "is_bind_type": false, - "is_errorable": false, - "name": "int32", - "valid_range": { - "max": 2147483647, - "min": -2147483648 - } - } - }, - { - "details": [], - "name": "z", - "type": { - "is_bind_type": false, - "is_errorable": false, - "name": "int32", - "valid_range": { - "max": 2147483647, - "min": -2147483648 - } - } - } - ], + "arguments": [], "is_constructor": true, "name": "constructor", "return_type": { @@ -1070,7 +1003,7 @@ exports[`Changelog Diffing > Generates correct output for changelog diffs > chan { "arguments": [ { - "details": [], + "details": null, "name": "arg", "type": { "$old": { @@ -4337,9 +4270,6 @@ export class ClassWithConstructor { * @remarks * This function can't be called in restricted-execution mode. * - * @param x - * @param y - * @param z */ constructor(x: number, y: number, z: number); } @@ -4650,9 +4580,6 @@ export class ClassWithConstructor { * @remarks * This function can't be called in restricted-execution mode. * - * @param x - * @param y - * @param z */ constructor(x: number, y: number, z: number); /** diff --git a/tools/api-docs-generator-test-snapshots/test/minecraft_version_shipped_stable/__snapshots__/minecraftVersionShippedStable.spec.ts.snap b/tools/api-docs-generator-test-snapshots/test/minecraft_version_shipped_stable/__snapshots__/minecraftVersionShippedStable.spec.ts.snap index 2151501..545ec43 100644 --- a/tools/api-docs-generator-test-snapshots/test/minecraft_version_shipped_stable/__snapshots__/minecraftVersionShippedStable.spec.ts.snap +++ b/tools/api-docs-generator-test-snapshots/test/minecraft_version_shipped_stable/__snapshots__/minecraftVersionShippedStable.spec.ts.snap @@ -14,17 +14,7 @@ exports[`Minecraft Version Shipped Stable > Generates correct output for module "objects": [], "functions": [ { - "arguments": [ - { - "details": [], - "name": "arg", - "type": { - "is_bind_type": false, - "is_errorable": false, - "name": "string" - } - } - ], + "arguments": [], "is_constructor": false, "name": "TestFunction", "return_type": { @@ -62,17 +52,7 @@ exports[`Minecraft Version Shipped Stable > Generates correct output for module "objects": [], "functions": [ { - "arguments": [ - { - "details": [], - "name": "arg", - "type": { - "is_bind_type": false, - "is_errorable": false, - "name": "string" - } - } - ], + "arguments": [], "is_constructor": false, "name": "TestFunction", "return_type": { @@ -871,17 +851,7 @@ exports[`Minecraft Version Shipped Stable > Generates correct output for module "objects": [], "functions": [ { - "arguments": [ - { - "details": [], - "name": "arg", - "type": { - "is_bind_type": false, - "is_errorable": false, - "name": "string" - } - } - ], + "arguments": [], "is_constructor": false, "name": "TestFunction", "return_type": { @@ -919,17 +889,7 @@ exports[`Minecraft Version Shipped Stable > Generates correct output for module "objects": [], "functions": [ { - "arguments": [ - { - "details": [], - "name": "arg", - "type": { - "is_bind_type": false, - "is_errorable": false, - "name": "string" - } - } - ], + "arguments": [], "is_constructor": false, "name": "TestFunction", "return_type": { diff --git a/tools/api-docs-generator/src/filters/CommonFilters.ts b/tools/api-docs-generator/src/filters/CommonFilters.ts index e2b62b5..dccac71 100644 --- a/tools/api-docs-generator/src/filters/CommonFilters.ts +++ b/tools/api-docs-generator/src/filters/CommonFilters.ts @@ -1749,142 +1749,144 @@ function boundValues(releases: MinecraftRelease[]) { function boundChanges(releases: MinecraftRelease[]) { for (const release of releases) { for (const scriptModule of release.script_modules) { - if (moduleHasChangelog(scriptModule)) { - for (const changelog of scriptModule.changelog) { - for (const classJson of changelog.classes) { - for (const propertyJson of classJson.properties) { - const has_min = propertyJson.has_min as unknown as { - $old: boolean; - $new: boolean; - has_changes?: boolean; - }; + if (!moduleHasChangelog(scriptModule)) { + continue; + } - const min_value = propertyJson.min_value as { - $old: unknown; - $new: unknown; - has_changes?: boolean; - }; + for (const changelog of scriptModule.changelog) { + for (const classJson of changelog.classes) { + for (const propertyJson of classJson.properties) { + const has_min = propertyJson.has_min as unknown as { + $old: boolean; + $new: boolean; + has_changes?: boolean; + }; - if (has_min && min_value) { - if (has_min.$old === true && has_min.$new === true) { - if (min_value.$old && min_value.$new && min_value.$old !== min_value.$new) { - propertyJson.min_changed = true; - } else if (min_value.$old === undefined && min_value.$new) { - propertyJson.min_added = true; - } else if (min_value.$old && min_value.$new === undefined) { - propertyJson.min_removed = true; - } - } else if (has_min.$old === false && has_min.$new === true) { - if (min_value.$new !== undefined) { - propertyJson.min_added = true; - } - } else if (has_min.$old === true && has_min.$new === false) { - if (min_value.$old !== undefined) { - propertyJson.min_removed = true; - } - // Conversion to $old and $new failed, since no changes were made - } else if (propertyJson.has_min === true && min_value.$old !== min_value.$new) { + const min_value = propertyJson.min_value as { + $old: unknown; + $new: unknown; + has_changes?: boolean; + }; + + if (has_min && min_value) { + if (has_min.$old === true && has_min.$new === true) { + if (min_value.$old && min_value.$new && min_value.$old !== min_value.$new) { propertyJson.min_changed = true; + } else if (min_value.$old === undefined && min_value.$new) { + propertyJson.min_added = true; + } else if (min_value.$old && min_value.$new === undefined) { + propertyJson.min_removed = true; + } + } else if (has_min.$old === false && has_min.$new === true) { + if (min_value.$new !== undefined) { + propertyJson.min_added = true; } + } else if (has_min.$old === true && has_min.$new === false) { + if (min_value.$old !== undefined) { + propertyJson.min_removed = true; + } + // Conversion to $old and $new failed, since no changes were made + } else if (propertyJson.has_min === true && min_value.$old !== min_value.$new) { + propertyJson.min_changed = true; } + } - const has_max = propertyJson.has_max as unknown as { - $old: boolean; - $new: boolean; - has_changes?: boolean; - }; + const has_max = propertyJson.has_max as unknown as { + $old: boolean; + $new: boolean; + has_changes?: boolean; + }; - const max_value = propertyJson.max_value as { - $old: unknown; - $new: unknown; - has_changes?: boolean; - }; + const max_value = propertyJson.max_value as { + $old: unknown; + $new: unknown; + has_changes?: boolean; + }; - if (has_max && max_value) { - if (has_max.$old === true && has_max.$new === true) { - if (max_value.$old && max_value.$new && max_value.$old !== max_value.$new) { - propertyJson.max_changed = true; - } else if (max_value.$old === undefined && max_value.$new) { - propertyJson.max_added = true; - } else if (max_value.$old && max_value.$new === undefined) { - propertyJson.max_removed = true; - } - } else if (has_max.$old === false && has_max.$new === true) { - if (max_value.$new !== undefined) { - propertyJson.max_added = true; - } - } else if (has_max.$old === true && has_max.$new === false) { - if (max_value.$old !== undefined) { - propertyJson.max_removed = true; - } - // Conversion to $old and $new failed, since no changes were made - } else if (propertyJson.has_max === true && max_value.$old !== max_value.$new) { + if (has_max && max_value) { + if (has_max.$old === true && has_max.$new === true) { + if (max_value.$old && max_value.$new && max_value.$old !== max_value.$new) { propertyJson.max_changed = true; + } else if (max_value.$old === undefined && max_value.$new) { + propertyJson.max_added = true; + } else if (max_value.$old && max_value.$new === undefined) { + propertyJson.max_removed = true; + } + } else if (has_max.$old === false && has_max.$new === true) { + if (max_value.$new !== undefined) { + propertyJson.max_added = true; + } + } else if (has_max.$old === true && has_max.$new === false) { + if (max_value.$old !== undefined) { + propertyJson.max_removed = true; } + // Conversion to $old and $new failed, since no changes were made + } else if (propertyJson.has_max === true && max_value.$old !== max_value.$new) { + propertyJson.max_changed = true; } } + } - for (const functionJson of classJson.functions) { - for (const argumentJson of functionJson.arguments) { - type ArgumentDetails = { - default_value: unknown; - has_min: boolean; - min_value: unknown; - has_max: boolean; - max_value: unknown; - supported_values: unknown; - }; + for (const functionJson of classJson.functions) { + for (const argumentJson of functionJson.arguments) { + type ArgumentDetails = { + default_value: unknown; + has_min: boolean; + min_value: unknown; + has_max: boolean; + max_value: unknown; + supported_values: unknown; + }; - const details = argumentJson.details as { - $old: ArgumentDetails; - $new: ArgumentDetails; - has_changes?: boolean; - } | null; - - if ( - details === undefined || - // eslint-disable-next-line unicorn/no-null - details === null || - (details.$old === undefined && details.$new === undefined) - ) { - continue; - } + const details = argumentJson.details as { + $old: ArgumentDetails; + $new: ArgumentDetails; + has_changes?: boolean; + } | null; - if (details.$old !== undefined && details.$new === undefined) { - if (details.$old.has_min && details.$old.min_value !== undefined) { - argumentJson.min_removed = true; - } - if (details.$old.has_max && details.$old.max_value !== undefined) { - argumentJson.max_removed = true; - } - continue; + if ( + details === undefined || + // eslint-disable-next-line unicorn/no-null + details === null || + (details.$old === undefined && details.$new === undefined) + ) { + continue; + } + + if (details.$old !== undefined && details.$new === undefined) { + if (details.$old.has_min && details.$old.min_value !== undefined) { + argumentJson.min_removed = true; + } + if (details.$old.has_max && details.$old.max_value !== undefined) { + argumentJson.max_removed = true; } + continue; + } - if (details.$old === undefined && details.$new !== undefined) { - if (details.$new.has_min && details.$new.min_value !== undefined) { - argumentJson.min_added = true; - } - if (details.$new.has_max && details.$new.max_value !== undefined) { - argumentJson.max_added = true; - } - continue; + if (details.$old === undefined && details.$new !== undefined) { + if (details.$new.has_min && details.$new.min_value !== undefined) { + argumentJson.min_added = true; } + if (details.$new.has_max && details.$new.max_value !== undefined) { + argumentJson.max_added = true; + } + continue; + } - const validOldMin = details.$old.has_min && details.$old.min_value !== undefined; - const validOldMax = details.$old.has_max && details.$old.max_value !== undefined; + const validOldMin = details.$old.has_min && details.$old.min_value !== undefined; + const validOldMax = details.$old.has_max && details.$old.max_value !== undefined; - const validNewMin = details.$new.has_min && details.$new.min_value !== undefined; - const validNewMax = details.$new.has_max && details.$new.max_value !== undefined; + const validNewMin = details.$new.has_min && details.$new.min_value !== undefined; + const validNewMax = details.$new.has_max && details.$new.max_value !== undefined; - argumentJson.min_added = !validOldMin && validNewMin; - argumentJson.min_removed = validOldMin && !validNewMin; - argumentJson.min_changed = - validOldMin && validNewMin && details.$old.min_value !== details.$new.min_value; - argumentJson.max_added = !validOldMax && validNewMax; - argumentJson.max_removed = validOldMax && !validNewMax; - argumentJson.max_changed = - validOldMax && validNewMax && details.$old.max_value !== details.$new.max_value; - } + argumentJson.min_added = !validOldMin && validNewMin; + argumentJson.min_removed = validOldMin && !validNewMin; + argumentJson.min_changed = + validOldMin && validNewMin && details.$old.min_value !== details.$new.min_value; + argumentJson.max_added = !validOldMax && validNewMax; + argumentJson.max_removed = validOldMax && !validNewMax; + argumentJson.max_changed = + validOldMax && validNewMax && details.$old.max_value !== details.$new.max_value; } } } diff --git a/tools/api-docs-generator/src/modules/MinecraftScriptModule.ts b/tools/api-docs-generator/src/modules/MinecraftScriptModule.ts index 69ccbac..150addc 100644 --- a/tools/api-docs-generator/src/modules/MinecraftScriptModule.ts +++ b/tools/api-docs-generator/src/modules/MinecraftScriptModule.ts @@ -298,8 +298,6 @@ export const MinecraftConstantRecord = Intersect( Record({ type: MinecraftTypeRecord, is_read_only: Literal(true), - has_min: Optional(Boolean), - has_max: Optional(Boolean), is_static: Literal(true), value: Optional(Unknown), diff --git a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache index 5a72ffc..b7f241f 100644 --- a/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache +++ b/tools/markup-generators-plugin/templates/msdocs/script/module_changelog.mustache @@ -211,7 +211,7 @@ description: Changelog of the `{{{name}}}` module {{#$changed}} - Changed argument `{{{name}}}` type from {{#$old.type}}{{> type_with_links}}{{/$old.type}} to {{#$new.type}}{{> type_with_links}}{{/$new.type}} {{/$changed}} - {{/type}} + {{/type}} {{/$removed}}{{/$added}} {{/arguments}} {{/$removed}}{{/$added}}{{/has_changes}} From 05643f6e4bcc0c86103b442a195810f5b6154f66 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Wed, 3 Dec 2025 16:20:21 -0800 Subject: [PATCH 23/25] Only show arguments if notes are added including bounds --- .../test/bounds/__snapshots__/bounds.spec.ts.snap | 4 ---- .../src/filters/CommonFilters.ts | 14 ++++++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap b/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap index 2b178b8..1447474 100644 --- a/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap +++ b/tools/api-docs-generator-test-snapshots/test/bounds/__snapshots__/bounds.spec.ts.snap @@ -476,7 +476,6 @@ export class ClassWithBounds { * Minimum value: -255 * @param t * Maximum value: 1 - * @param u * @param v * Minimum value: -255 * Maximum value: -1 @@ -487,7 +486,6 @@ export class ClassWithBounds { * Minimum value: 1 * @param y * Maximum value: 255 - * @param z */ methodThatTakesBoundedValue( s: number, @@ -598,11 +596,9 @@ export class ClassWithBounds { * Minimum value: 1 * @param t * Maximum value: 255 - * @param u * @param v * Minimum value: 1 * Maximum value: 255 - * @param w * @param x * Maximum value: 255 * @param y diff --git a/tools/api-docs-generator/src/filters/CommonFilters.ts b/tools/api-docs-generator/src/filters/CommonFilters.ts index dccac71..b8560ae 100644 --- a/tools/api-docs-generator/src/filters/CommonFilters.ts +++ b/tools/api-docs-generator/src/filters/CommonFilters.ts @@ -1727,13 +1727,19 @@ function boundValues(releases: MinecraftRelease[]) { continue; } - if (argumentJson.details.min_value !== undefined) { - functionJson.has_bounds = true; + if ( + argumentJson.details.has_min !== undefined && + argumentJson.details.has_min === true && + argumentJson.details.min_value !== undefined + ) { argumentJson.has_bounds = true; } - if (argumentJson.details.max_value !== undefined) { - functionJson.has_bounds = true; + if ( + argumentJson.details.has_max !== undefined && + argumentJson.details.has_max === true && + argumentJson.details.max_value !== undefined + ) { argumentJson.has_bounds = true; } } From facdab0aad3dbc6a553f0f0b3512ea25fb7b2e8d Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Wed, 3 Dec 2025 17:24:42 -0800 Subject: [PATCH 24/25] Changed from simple_ordered_array to value --- tools/api-docs-generator/src/changelog.ts | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/tools/api-docs-generator/src/changelog.ts b/tools/api-docs-generator/src/changelog.ts index d048d09..e0e7e9f 100644 --- a/tools/api-docs-generator/src/changelog.ts +++ b/tools/api-docs-generator/src/changelog.ts @@ -108,14 +108,7 @@ const scriptingDataLayout: RootMetadataScope = { submembers: { type: TypeDataLayout, details: { - type: 'simple_ordered_array', - key: 'name', - submembers: { - has_min: { type: 'value' }, - has_max: { type: 'value' }, - min_value: { type: 'value' }, - max_value: { type: 'value' }, - }, + type: 'value', }, }, }, @@ -173,14 +166,7 @@ const scriptingDataLayout: RootMetadataScope = { submembers: { type: TypeDataLayout, details: { - type: 'simple_ordered_array', - key: 'name', - submembers: { - has_min: { type: 'value' }, - has_max: { type: 'value' }, - min_value: { type: 'value' }, - max_value: { type: 'value' }, - }, + type: 'value', }, }, }, From 4eca71bd9277af1a173fdd41b97ed4bf805d9ee1 Mon Sep 17 00:00:00 2001 From: Brandon Chan Date: Thu, 4 Dec 2025 14:01:56 -0800 Subject: [PATCH 25/25] Fix nit --- .../api-docs-generator/src/filters/CommonFilters.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tools/api-docs-generator/src/filters/CommonFilters.ts b/tools/api-docs-generator/src/filters/CommonFilters.ts index b8560ae..458d3a6 100644 --- a/tools/api-docs-generator/src/filters/CommonFilters.ts +++ b/tools/api-docs-generator/src/filters/CommonFilters.ts @@ -1727,19 +1727,11 @@ function boundValues(releases: MinecraftRelease[]) { continue; } - if ( - argumentJson.details.has_min !== undefined && - argumentJson.details.has_min === true && - argumentJson.details.min_value !== undefined - ) { + if (argumentJson.details.has_min && argumentJson.details.min_value !== undefined) { argumentJson.has_bounds = true; } - if ( - argumentJson.details.has_max !== undefined && - argumentJson.details.has_max === true && - argumentJson.details.max_value !== undefined - ) { + if (argumentJson.details.has_max && argumentJson.details.max_value !== undefined) { argumentJson.has_bounds = true; } }