Skip to content

Accept snake_case Zammad article ticket IDs - #2

Open
teodortalov wants to merge 3 commits into
Softoft-Orga:mainfrom
forward-force:main
Open

teodortalov wants to merge 3 commits into
Softoft-Orga:mainfrom
forward-force:main

Conversation

@teodortalov

Copy link
Copy Markdown

Summary

  • Accept Zammad API article responses that return ticket_id.
  • Preserve compatibility with existing ticketId input.
  • Enable populate_by_name=True on models so aliased fields also accept Python field names.

Why

Zammad ticket article responses can include ticket_id, which currently fails validation because the Article model only accepts the ticketId alias.

Verification

  • uv run python -m pytest tests/test_models.py -q

Copilot AI review requested due to automatic review settings July 7, 2026 19:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Pydantic models to accept Zammad article payloads that use snake_case (ticket_id) while maintaining compatibility with the existing camelCase (ticketId) format.

Changes:

  • Update the Article.ticket_id field validation to accept both ticket_id and ticketId.
  • Enable populate_by_name=True across models so aliased fields can also be populated via Python field names.
  • Add model tests covering both snake_case and camelCase article ticket ID inputs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/zammad_mcp_server/models.py Expands validation for Article.ticket_id and enables populate_by_name on models.
tests/test_models.py Adds parsing tests for Article accepting both ticket_id and ticketId.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


id: int
ticket_id: int = Field(alias="ticketId")
ticket_id: int = Field(validation_alias=AliasChoices("ticket_id", "ticketId"))
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.

2 participants