René's URL Explorer Experiment


Title: feat(customize): add required field for input questions by bearomorphism · Pull Request #1984 · commitizen-tools/commitizen · GitHub

Open Graph Title: feat(customize): add required field for input questions by bearomorphism · Pull Request #1984 · commitizen-tools/commitizen

X Title: feat(customize): add required field for input questions by bearomorphism · Pull Request #1984 · commitizen-tools/commitizen

Description: Description Closes #1231. Adds a required field to cz_customize input questions so users can enforce non-empty answers without writing a custom Python validator. Why Users who configure commit rules entirely through pyproject.toml / .cz.json / .cz.yaml have no way to mark a free-text question as mandatory. They must either accept empty answers silently or write a Python class just to add a one-line validator. This PR provides a zero-code path for the common case. What changed File Change commitizen/question.py Added validate and required optional fields to InputQuestion TypedDict commitizen/cz/customize/customize.py questions() now shallow-copies each question dict; if type == "input" and required=True, pops required and injects a validate callable that rejects blank input docs/customization/config_file.md Added required row to the questions field table; added required = true to the TOML example tests/test_cz_customize.py Seven new unit tests covering the required validator behaviour How it works When questions() processes each question from the config: A shallow copy of the question dict is made (avoids mutating the parsed config on repeated calls). If the question has type = "input" and required = true, the required key is popped and replaced with validate = _required_validator. _required_validator returns True for non-blank strings and "This answer is required." for empty/whitespace-only input — the exact signature questionary expects. All other question types (list, confirm) pass through unchanged; required is meaningless there since both always return a value. Backward compatibility Fully backward-compatible. The required key defaults to False (absent), so existing configs are unaffected. No CLI flags, exit codes, or public APIs changed. Checklist I have read the contributing guidelines Was generative AI tooling used to co-author this PR? Yes (GitHub Copilot CLI) Code Changes Add test cases to all the changes you introduce Run uv run poe all locally to ensure this change passes linter check and tests Manually test the changes: Verify the feature/bug fix works as expected in real-world scenarios Test edge cases and error conditions Ensure backward compatibility is maintained Document any manual testing steps performed Update the documentation for the changes Expected Behavior Scenario Before After required = true on an input question KeyError / unknown key passed to questionary validate callable injected; empty input is rejected with "This answer is required." required absent / false question passes through as-is question passes through as-is (no change) list or confirm question with no required key unchanged unchanged calling questions() twice on the same config N/A second call still works correctly (no mutation) Steps to Test This Pull Request # pyproject.toml [tool.commitizen] name = "cz_customize" [tool.commitizen.customize] message_template = "{{change_type}}: {{message}}" [[tool.commitizen.customize.questions]] type = "list" name = "change_type" message = "Type" choices = [{value = "feat", name = "feat"}, {value = "fix", name = "fix"}] [[tool.commitizen.customize.questions]] type = "input" name = "message" message = "Describe the change (required):" required = true [[tool.commitizen.customize.questions]] type = "input" name = "note" message = "Optional note:" # 1. Reproduce original problem (empty answer silently accepted) git checkout v4.15.1 cz commit # pick a type, press Enter on empty message -> commit succeeds # 2. Verify fix git checkout feat/1231-customize-question-required cz commit # pick a type, press Enter on empty message -> "This answer is required." shown # type something -> commit proceeds normally Additional Context Related issue: #1231

Open Graph Description: Description Closes #1231. Adds a required field to cz_customize input questions so users can enforce non-empty answers without writing a custom Python validator. Why Users who configure commit rule...

X Description: Description Closes #1231. Adds a required field to cz_customize input questions so users can enforce non-empty answers without writing a custom Python validator. Why Users who configure commit rule...

Opengraph URL: https://github.com/commitizen-tools/commitizen/pull/1984

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:4a67588b-db3d-5e6d-849d-c4ea8dfa3358
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE2C8:3BB6AC:BE5592:116D769:6A4E27BC
html-safe-nonce97ce5a9f4164c6041524e043d81c391694e37c1803bde27afe2e87812f44f547
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMkM4OjNCQjZBQzpCRTU1OTI6MTE2RDc2OTo2QTRFMjdCQyIsInZpc2l0b3JfaWQiOiI2MDQ2NjI0MTM1NTU5MTI5MDIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmace53d967ec6a357bdf2ecb240176d23c1cc7951ecb01a8c225d19e52857b47255
hovercard-subject-tagpull_request:3655048409
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/commitizen-tools/commitizen/pull/1984/files
twitter:imagehttps://avatars.githubusercontent.com/u/26526132?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/26526132?s=400&v=4
og:image:altDescription Closes #1231. Adds a required field to cz_customize input questions so users can enforce non-empty answers without writing a custom Python validator. Why Users who configure commit rule...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/commitizen-tools/commitizen git https://github.com/commitizen-tools/commitizen.git
octolytics-dimension-user_id62252524
octolytics-dimension-user_logincommitizen-tools
octolytics-dimension-repository_id106127589
octolytics-dimension-repository_nwocommitizen-tools/commitizen
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id106127589
octolytics-dimension-repository_network_root_nwocommitizen-tools/commitizen
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
released9dd20d38f8ae3c4cb6b597807431db300d0bd2a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/commitizen-tools/commitizen/pull/1984/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcommitizen-tools%2Fcommitizen%2Fpull%2F1984%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcommitizen-tools%2Fcommitizen%2Fpull%2F1984%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=commitizen-tools%2Fcommitizen
Reloadhttps://github.com/commitizen-tools/commitizen/pull/1984/files
Reloadhttps://github.com/commitizen-tools/commitizen/pull/1984/files
Reloadhttps://github.com/commitizen-tools/commitizen/pull/1984/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1984/files
commitizen-tools https://github.com/commitizen-tools
commitizenhttps://github.com/commitizen-tools/commitizen
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1984/files
Notifications https://github.com/login?return_to=%2Fcommitizen-tools%2Fcommitizen
Fork 344 https://github.com/login?return_to=%2Fcommitizen-tools%2Fcommitizen
Star 3.5k https://github.com/login?return_to=%2Fcommitizen-tools%2Fcommitizen
Code https://github.com/commitizen-tools/commitizen
Issues 116 https://github.com/commitizen-tools/commitizen/issues
Pull requests 45 https://github.com/commitizen-tools/commitizen/pulls
Discussions https://github.com/commitizen-tools/commitizen/discussions
Actions https://github.com/commitizen-tools/commitizen/actions
Projects https://github.com/commitizen-tools/commitizen/projects
Security and quality 0 https://github.com/commitizen-tools/commitizen/security
Insights https://github.com/commitizen-tools/commitizen/pulse
Code https://github.com/commitizen-tools/commitizen
Issues https://github.com/commitizen-tools/commitizen/issues
Pull requests https://github.com/commitizen-tools/commitizen/pulls
Discussions https://github.com/commitizen-tools/commitizen/discussions
Actions https://github.com/commitizen-tools/commitizen/actions
Projects https://github.com/commitizen-tools/commitizen/projects
Security and quality https://github.com/commitizen-tools/commitizen/security
Insights https://github.com/commitizen-tools/commitizen/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fcommitizen-tools%2Fcommitizen%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fcommitizen-tools%2Fcommitizen%2Fissues%2Fnew%2Fchoose
bearomorphismhttps://github.com/bearomorphism
commitizen-tools:masterhttps://github.com/commitizen-tools/commitizen/tree/master
bearomorphism:feat/1231-customize-question-requiredhttps://github.com/bearomorphism/commitizen/tree/feat/1231-customize-question-required
Conversation 7 https://github.com/commitizen-tools/commitizen/pull/1984
Commits 1 https://github.com/commitizen-tools/commitizen/pull/1984/commits
Checks 20 https://github.com/commitizen-tools/commitizen/pull/1984/checks
Files changed https://github.com/commitizen-tools/commitizen/pull/1984/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1984/files
feat(customize): add required field for input questions https://github.com/commitizen-tools/commitizen/pull/1984/files#top
Show all changes 1 commit https://github.com/commitizen-tools/commitizen/pull/1984/files
5c85feb feat(customize): add required field for input questions bearomorphism May 9, 2026 https://github.com/commitizen-tools/commitizen/pull/1984/commits/5c85febd698e09aac4af49083f0f1dda89cfaac6
Clear filters https://github.com/commitizen-tools/commitizen/pull/1984/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1984/files
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1984/files
customize.py https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-9902f7d08f081f8ccb8e4acb71ad8e74dfb11df78618580dc8323c3386517aa4
question.py https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-bb142ffe4a415c1d98f5f8d19b84c41f7986ef8815dc516e704a4168aa3bb311
config_file.md https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-96129c8da149d8284a80c35c97233fb2c599b7b102c18f3388f08e02d867a205
test_cz_customize.py https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-f5ec5ad6526890a0807a07554a2e54509c6e151065e880125006cb4518281732
commitizen/cz/customize/customize.pyhttps://github.com/commitizen-tools/commitizen/pull/1984/files#diff-9902f7d08f081f8ccb8e4acb71ad8e74dfb11df78618580dc8323c3386517aa4
View file https://github.com/bearomorphism/commitizen/blob/5c85febd698e09aac4af49083f0f1dda89cfaac6/commitizen/cz/customize/customize.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/commitizen-tools/commitizen/pull/1984/{{ revealButtonHref }}
https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-9902f7d08f081f8ccb8e4acb71ad8e74dfb11df78618580dc8323c3386517aa4
https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-9902f7d08f081f8ccb8e4acb71ad8e74dfb11df78618580dc8323c3386517aa4
https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-9902f7d08f081f8ccb8e4acb71ad8e74dfb11df78618580dc8323c3386517aa4
https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-9902f7d08f081f8ccb8e4acb71ad8e74dfb11df78618580dc8323c3386517aa4
https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-9902f7d08f081f8ccb8e4acb71ad8e74dfb11df78618580dc8323c3386517aa4
commitizen/question.pyhttps://github.com/commitizen-tools/commitizen/pull/1984/files#diff-bb142ffe4a415c1d98f5f8d19b84c41f7986ef8815dc516e704a4168aa3bb311
View file https://github.com/bearomorphism/commitizen/blob/5c85febd698e09aac4af49083f0f1dda89cfaac6/commitizen/question.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/commitizen-tools/commitizen/pull/1984/{{ revealButtonHref }}
https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-bb142ffe4a415c1d98f5f8d19b84c41f7986ef8815dc516e704a4168aa3bb311
https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-bb142ffe4a415c1d98f5f8d19b84c41f7986ef8815dc516e704a4168aa3bb311
docs/customization/config_file.mdhttps://github.com/commitizen-tools/commitizen/pull/1984/files#diff-96129c8da149d8284a80c35c97233fb2c599b7b102c18f3388f08e02d867a205
View file https://github.com/bearomorphism/commitizen/blob/5c85febd698e09aac4af49083f0f1dda89cfaac6/docs/customization/config_file.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/commitizen-tools/commitizen/pull/1984/{{ revealButtonHref }}
https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-96129c8da149d8284a80c35c97233fb2c599b7b102c18f3388f08e02d867a205
https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-96129c8da149d8284a80c35c97233fb2c599b7b102c18f3388f08e02d867a205
https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-96129c8da149d8284a80c35c97233fb2c599b7b102c18f3388f08e02d867a205
https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-96129c8da149d8284a80c35c97233fb2c599b7b102c18f3388f08e02d867a205
tests/test_cz_customize.pyhttps://github.com/commitizen-tools/commitizen/pull/1984/files#diff-f5ec5ad6526890a0807a07554a2e54509c6e151065e880125006cb4518281732
View file https://github.com/bearomorphism/commitizen/blob/5c85febd698e09aac4af49083f0f1dda89cfaac6/tests/test_cz_customize.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/commitizen-tools/commitizen/pull/1984/{{ revealButtonHref }}
https://github.com/commitizen-tools/commitizen/pull/1984/files#diff-f5ec5ad6526890a0807a07554a2e54509c6e151065e880125006cb4518281732
Please reload this pagehttps://github.com/commitizen-tools/commitizen/pull/1984/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.