fix(#638): Add custom field type discovery support#639
Merged
ryancheley merged 1 commit intomainfrom Mar 19, 2026
Merged
Conversation
Implement dynamic field type discovery to support all YouTrack custom field types, not just Enum types. The CLI now automatically detects field types from project configuration with proper fallback behavior. Changes: - Add field type discovery method discover_custom_field() to ProjectService - Add _project_to_issue_field_type() mapping for type conversion - Add missing field creation methods to CustomFieldManager: - create_simple_field() for integer/float fields - create_date_field() for date fields - create_single_version_field() for version fields - create_single_build_field() for build fields - create_field_by_type() for polymorphic field creation - Update create_issue() and update_issue() to use field type discovery - Add caching for discovered field types to improve performance - Update documentation with examples for all supported field types - Update CHANGELOG with fix details Supported field types: - Enum (single/multi) - Text - Simple (integer/float) - User (single/multi) - Version (single/multi) - Build (single/multi) - Date/DateTime - Period - State Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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
Implement dynamic field type discovery to support all YouTrack custom field types, not just Enum types. The CLI now automatically detects field types from project configuration with intelligent fallback behavior.
Previously, the
--custom-fieldoption only worked with Enum fields because it hardcoded all custom fields asSingleEnumIssueCustomField. Non-enum fields (Text, Integer, Date, User, Version, Build, etc.) would fail with type mismatch errors.Now, the CLI queries the project's custom field configuration to determine the actual field type and uses the appropriate field creation method. If type discovery fails, it gracefully falls back to enum type with a helpful warning.
Changes
Custom Field Manager (
youtrack_cli/custom_field_manager.py)create_simple_field()for integer/float custom fieldscreate_date_field()for date custom fieldscreate_single_version_field()for version fieldscreate_single_build_field()for build fieldscreate_field_by_type()polymorphic dispatcher that creates the appropriate field type based on discovered informationProject Service (
youtrack_cli/services/projects.py)discover_custom_field()method that:_project_to_issue_field_type()mapping to convert between project and issue field type constantsIssue Service (
youtrack_cli/services/issues.py)create_issue()to use field type discovery instead of hardcoding enum typesupdate_issue()with identical field discovery logicDocumentation (
docs/commands/issues.rst)Changelog (
CHANGELOG.md)Supported Field Types
The
--custom-fieldoption now supports all YouTrack field types:Team=BackendNotes=Implementation notesStoryPoints=5Reviewer=john.doeFixVersion=1.0Build=Release-123DueDate=1234567890000Technical Details
Type Discovery Pattern
Follows the established pattern from
discover_state_field()method:Fallback Behavior
If field type discovery fails for any reason:
Performance
Testing
Fixes #638