Skip to content

Document disabling validation in a prompt session - #2161

Open
JackyHsu-X wants to merge 1 commit into
prompt-toolkit:mainfrom
JackyHsu-X:docs/reset-session-validator
Open

JackyHsu-X wants to merge 1 commit into
prompt-toolkit:mainfrom
JackyHsu-X:docs/reset-session-validator

Conversation

@JackyHsu-X

Copy link
Copy Markdown

When reusing a PromptSession, passing validator=None keeps the previous validator. Add a tutorial example that switches from required to optional input with DummyValidator, and explain that the replacement also persists until another validator is supplied. This brings the existing PromptSession.prompt API guidance into the input-validation tutorial.

Related #2159. This documents the existing API and leaves the requested behavior change open for discussion.

Validation: executed the exact tutorial block using pipe input, including rejection of empty required input, None retention, accepting empty optional input, persistence, and restoring validation. HTML output and the API link were checked. Native Windows strict Sphinx builds have the same three platform autodoc warnings before and after; the relevant CLI/shortcut tests have the same three baseline failures (33 passing). No runtime code changes.

AI assistance: OpenAI Codex investigated, authored, and verified this documentation change. No independent human review is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant