Skip to content

fix(core): accept boolean attributes in headTags config validation #12238

Merged
slorber merged 8 commits into
facebook:mainfrom
DhineshPonnarasan:fix/headtags-boolean-attributes
Jul 9, 2026
Merged

fix(core): accept boolean attributes in headTags config validation #12238
slorber merged 8 commits into
facebook:mainfrom
DhineshPonnarasan:fix/headtags-boolean-attributes

Conversation

@DhineshPonnarasan

Copy link
Copy Markdown
Contributor

Fixes #12233

Summary

The headTags config validation rejects boolean HTML attribute values like async: true, even though the TypeScript types and renderer already support them.

Root cause

The attribute pattern in configValidation.ts uses Joi.string(), which only accepts string values. This was introduced in the original headTags PR and was not updated when boolean support was added to the types and renderer.

Solution

Change the pattern from Joi.string() to Joi.alternatives().try(Joi.string(), Joi.boolean()), matching the existing pattern used for storage.namespace in the same file.

Testing

Updated the existing validation test to reject non-string/non-boolean values (e.g., numbers) and added a regression test confirming boolean attributes like async: true are now accepted. All 223 config validation tests pass.

…#12120)

The example artifacts were regenerated for the v3.10.1 maintenance
release, which reverted the engine field from '>=24.14' back to
'>=20.0' and left the sandbox node version at '18'.

Update the examples to reflect current maintainer intent:
- Bump engines.node from '>=20.0' to '>=24.14'
  (reapplies PR facebook#11914 change overwritten by PR facebook#11985)
- Bump sandbox.config.json node from '18' to '24'
  (syncs with generateExamples.js updated in PR facebook#12080)
@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Jul 7, 2026
@netlify

netlify Bot commented Jul 7, 2026

Copy link
Copy Markdown

[V2]

Name Link
🔨 Latest commit 7fd4eb1
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6a4fb7d2bceaa300083784bb
😎 Deploy Preview https://deploy-preview-12238--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@DhineshPonnarasan DhineshPonnarasan changed the title fix(core): accept boolean attributes in headTags config validation (AI-assisted) fix(core): accept boolean attributes in headTags config validation Jul 8, 2026

@slorber slorber left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't modify examples, that's unrelated to the PR topic: one thing at a time

Comment thread examples/classic-typescript/package.json Outdated
Comment thread examples/classic-typescript/sandbox.config.json Outdated
Comment thread examples/classic-typescript/sandbox.config.json Outdated
Comment thread examples/classic/package.json Outdated
Comment thread examples/classic/sandbox.config.json Outdated
Comment thread examples/classic/sandbox.config.json Outdated
@slorber slorber merged commit f764082 into facebook:main Jul 9, 2026
36 of 37 checks passed
@slorber slorber added pr: bug fix This PR fixes a bug in a past release. to backport This PR is planned to be backported to a stable version of Docusaurus labels Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release. to backport This PR is planned to be backported to a stable version of Docusaurus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

headTags config validation rejects boolean HTML attribute values

2 participants