Skip to content

CBG-5715: use minLength/maxLength for string length constraints - #8649

Open
torcolvin wants to merge 1 commit into
mainfrom
CBG-5715-01-length-constraints
Open

CBG-5715: use minLength/maxLength for string length constraints#8649
torcolvin wants to merge 1 commit into
mainfrom
CBG-5715-01-length-constraints

Conversation

@torcolvin

@torcolvin torcolvin commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

CBG-5715

Split out of #8589 — stack 1/9, based on main.

minimum/maximum only apply to numeric schemas, so the length limits declared on these string schemas were silently ignored by validators and not rendered in the docs.

  • replicationid path parameter: 1-160 characters
  • Replication.replication_id: max 160 characters
  • Database.user_xattr_key: max 15 characters

Because maximum on a string is inert while maxLength actually binds, both values were checked against the code rather than carried over on trust:

  • db/sg_replicate_cfg.go:190if len(rc.ID) > 160, with a comment explaining the 160 (checkpoint-key prefix headroom). Note the adjacent error string says "less than 160" while the check admits exactly 160; maxLength: 160 matches the check.
  • rest/config.go:1145if len(*dbConfig.UserXattrKey) > 15.

Pre-review checklist

  • Logging sensitive data? N/A — docs only
  • Updated relevant information in the API specifications in docs/api

🤖 Generated with Claude Code

@torcolvin
torcolvin requested review from a team and a lite review from Copilot August 21, 2026 19:58
@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown

Redocly previews

@factory-droid

factory-droid Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Droid finished @torcolvin's task —— View job


LGTM, the OpenAPI schema keyword changes (minimum/maximum → minLength/maxLength for strings) are correct and consistent for the touched definitions.

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.

Pull request overview

Updates the Sync Gateway OpenAPI spec to express string-length constraints using minLength/maxLength (instead of numeric minimum/maximum), improving correctness of generated docs and schema validation.

Changes:

  • Switch Replication.replication_id and Database.user_xattr_key string constraints to maxLength in schemas.yaml.
  • Fix the replicationid path parameter constraints to minLength/maxLength in parameters.yaml.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
docs/api/components/schemas.yaml Replaces invalid string maximum usage with maxLength for affected schema properties.
docs/api/components/parameters.yaml Replaces invalid string minimum/maximum with minLength/maxLength for the replicationid path parameter.

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

`minimum`/`maximum` only apply to numeric schemas, so the length limits
declared on these string schemas were silently ignored by validators and
not rendered in the docs.

- `replicationid` path parameter: 1-160 characters
- `Replication.replication_id`: max 160 characters
- `Database.user_xattr_key`: max 15 characters

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@torcolvin
torcolvin force-pushed the CBG-5715-01-length-constraints branch from 7da0c56 to 1d65dd5 Compare August 24, 2026 17:42
@bbrks bbrks removed their assignment Aug 25, 2026
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.

3 participants