Repository navigation
Conversation
…er in common.news Since 6.2.2 the package test validates io-package.json against the js-controller schema, which allows only version numbers as keys of common.news. Between two releases the tree carries the NEXT placeholder of @alcalzone/release-script-plugin-iobroker (replaced by the version number on release), so `npm test` failed on every such tree with `/common/news: must NOT have additional properties "NEXT"`. The downloaded schema now gets `^NEXT$` as a second patternProperties entry that points to the same multilingual definition as the version keys — the placeholder is validated like every other entry, nothing else changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Not sure if we really should allow NEXT within the SCHEMA. Maybe the releasescritp should be adapted. Or testing could detect LOCAL runs. NEXT must NOT be present within io.package committed to github at all as this would cause NEXT to propaget to builder and installations causein problems there. AND if we really want to allow ist why not add it to the schema directly and hanle it at all relevant places? Remember: The content of the io.package.json (incl. news) is loaded into the official repofiles and hence delivered to the user systems. So if theres a 'NEXT' this will arrive at user systems too and must be handled by admin etc. So next at a local system test run is OK, but it should never be allowed at github in my oppinion. |
|
You are right — the placeholder must never sit in a committed io-package.json. We have changed our release tooling accordingly: the NEXT entry now lives outside the repository and is only injected into the working tree right before the release-script cut, so the schema check in 6.2.2 never sees it on GitHub or in CI. With that, this PR is no longer needed on our side and I'm closing it. Thanks for the feedback. |
What happens
Since 6.2.2,
tests.packageFiles()validatesio-package.jsonagainst the js-controller schema. That schema allows only version numbers as keys ofcommon.news, so every tree that carries the release-script'sNEXTplaceholder fails:(measured with 6.2.2 on a real adapter tree, see below)
Why the placeholder is legitimate
common.news.NEXTis where@alcalzone/release-script-plugin-iobrokercollects the news of the next version while its number does not exist yet. On release, the plugin replaces the key with the version number (packages/plugin-iobroker/src/index.tsL150–162, covered by its test "preserves the NEXT news in io-package.json"). So the placeholder exists exactly between two releases — which is whennpm testruns on every commit and pull request. It never reaches a published package, so the js-controller schema is right not to know it; the package test, however, runs on the development tree.ignoreIoPackageValidation: trueis not a good answer here, because it turns off the whole check for one placeholder.The change
getIoPackageValidator()now adds the placeholder to the downloaded schema before compiling it — the same approachadaptSchemaForTab()already takes for the jsonConfig schema.^NEXT$is registered as a secondpatternPropertiesentry that points to the same#/definitions/multilingualdefinition as the version keys, so the placeholder's content stays validated (enrequired, only known languages, strings), error paths read/common/news/NEXT/..., andmin/maxPropertieskeep counting it like the version it becomes. Nothing else changes; the document itself is not touched.src/tests/packageFiles/index.ts:NEWS_PLACEHOLDER,adaptSchemaForNewsPlaceholder(), one call ingetIoPackageValidator()src/tests/packageFiles/index.test.ts: unit tests (schema rejects the placeholder before the adaptation, accepts it after, still validates its content, still rejects any other key)README.md,CHANGELOG.md,build/Verification
npm run check,npm run lint,npm run build,npm test(64 passing)common.news.NEXT(ioBroker.homeconnect before its 1.19.1 cut):test:packagewith 6.2.2 → 1 failing (the error above); with this branch → 73 passing. Counter-checks on the same tree with this branch: a typo language insideNEXT("dx") →/common/news/NEXT: must NOT have additional properties "dx";common.installedFrom→ still rejected.🤖 Generated with Claude Code