Repository navigation
Accept snake_case Zammad article ticket IDs - #2
Open
teodortalov wants to merge 3 commits into
Open
teodortalov wants to merge 3 commits into
teodortalov wants to merge 3 commits into
Conversation
Fix aliased Zammad model field parsing
There was a problem hiding this comment.
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_idfield validation to accept bothticket_idandticketId. - Enable
populate_by_name=Trueacross 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")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ticket_id.ticketIdinput.populate_by_name=Trueon models so aliased fields also accept Python field names.Why
Zammad ticket article responses can include
ticket_id, which currently fails validation because theArticlemodel only accepts theticketIdalias.Verification
uv run python -m pytest tests/test_models.py -q