Skip to content

docs(api): document global_regex_flags and deny_list_score on PatternRecognizer - #2255

Merged
omri374 merged 3 commits into
data-privacy-stack:mainfrom
MohammedAlkindi:docs/pattern-recognizer-schema-fields
Sep 15, 2026
Merged

omri374 merged 3 commits into
data-privacy-stack:mainfrom
MohammedAlkindi:docs/pattern-recognizer-schema-fields

Conversation

@MohammedAlkindi

Copy link
Copy Markdown
Contributor

Change Description

AnalyzerRequest builds each ad-hoc recognizer with PatternRecognizer.from_dict(rec), which ends in cls(**entity_recognizer_dict), so every constructor keyword reaches the recognizer from the request body. Two that affect matching were undocumented.

global_regex_flags is the one that bites: it defaults to 26 (DOTALL | MULTILINE | IGNORECASE), so every ad-hoc pattern is case-insensitive unless a caller overrides it. That is the confusion in #1603, where you confirmed "yes, the api docs are not up to date in this case".

7 added lines, no deletions, no behaviour change, wording from pattern_recognizer.py's docstring. I computed 26 in both regex and stdlib re. ruff check . passes but does not lint this file, and I did not exercise the HTTP boundary.

Issue reference

Fixes #1603

Checklist

  • I have reviewed the contribution guidelines
  • I agree to follow this project's Code of Conduct
  • I confirm that I have the right to submit this contribution
  • My code includes unit tests
  • All unit tests and lint checks pass locally
  • My PR contains documentation updates / additions if required

No unit tests: an OpenAPI spec document has no runtime behaviour to assert.

🤖 Generated with Claude Code

…Recognizer

PatternRecognizer.from_dict passes every ad_hoc_recognizers key straight to the constructor, so both reach the REST API, but neither appeared in the documented schema. global_regex_flags matters most: it defaults to 26 (DOTALL|MULTILINE|IGNORECASE), which makes every ad-hoc pattern case-insensitive unless a caller overrides it.

Closes data-privacy-stack#1603

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

Documentation-only changes were reviewed with no blocking issues identified.

Pull request overview

Updates the OpenAPI schema to document two existing PatternRecognizer options.

Changes:

  • Documents deny_list_score.
  • Documents global_regex_flags, including its default and case-insensitive behavior.
File summaries
File Description
docs/api-docs/api-docs.yml Documents both recognizer configuration fields.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@omri374
omri374 merged commit 2b57747 into data-privacy-stack:main Sep 15, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

regex defined in ad_hoc_recognizers is always case-insensitive?

3 participants