[PR #25161] refactor: improve plugin version validation to support full semantic versioning #30956

Closed
opened 2026-02-21 20:48:33 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/25161

State: closed
Merged: Yes


Summary

This PR improves the plugin version validation in the backend to support full semantic versioning by replacing regex patterns with the packaging library's Version validator.

Changes:

  • Replace regex validation with packaging.version.Version validator for version and minimum_dify_version fields
  • Add proper field validators using Pydantic's @field_validator decorator
  • Import necessary components from the packaging library

Benefits:

  • Support for prerelease versions with dots (e.g., 2.0.0-beta.1, 1.2.3-alpha.2)
  • Support for build metadata (e.g., 1.0.0+build.123)
  • Consistent validation across the codebase (packaging library is already used for version comparison)
  • Alignment with frontend's semver capabilities

Fixes #25160

**Original Pull Request:** https://github.com/langgenius/dify/pull/25161 **State:** closed **Merged:** Yes --- ## Summary This PR improves the plugin version validation in the backend to support full semantic versioning by replacing regex patterns with the `packaging` library's `Version` validator. ### Changes: - Replace regex validation with `packaging.version.Version` validator for `version` and `minimum_dify_version` fields - Add proper field validators using Pydantic's `@field_validator` decorator - Import necessary components from the `packaging` library ### Benefits: - ✅ Support for prerelease versions with dots (e.g., `2.0.0-beta.1`, `1.2.3-alpha.2`) - ✅ Support for build metadata (e.g., `1.0.0+build.123`) - ✅ Consistent validation across the codebase (packaging library is already used for version comparison) - ✅ Alignment with frontend's semver capabilities Fixes #25160
yindo added the pull-request label 2026-02-21 20:48:33 -05:00
yindo closed this issue 2026-02-21 20:48:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#30956