Skip to content

[BE] Implement versionPattern for version name #244

@nilesh25890

Description

@nilesh25890

Description

Implement backend functionality to support a global versionPattern configuration for system-wide version validation. This includes validation enforcement, precedence rules with package-level patterns, and error handling.

Requirements

Global Configuration

  • Allow system administrators to configure a global versionPattern via API and UI.
  • This pattern applies system-wide to all version validations (draft, release, archived).

Validation Rules

  • Apply the Global Version Pattern validation to Draft, Release, and Archived statuses.
  • For versions with Release status, enforce both the global versionPattern and package-level releaseVersionPattern if exists and if the Package-level releaseVersionPattern is empty, skip this validation.
  • The global regex defines the baseline constraints.
  • Package-level regex can only restrict further and cannot loosen or override global constraints.
  • If the global regex disallows certain characters or patterns, the package-level regex cannot re-enable them.

Default Pattern

  • The versionPattern cannot be empty.
  • By default, apply a regex allowing:
    • Uppercase letters A–Z, lowercase letters a–z, digits 0–9
    • Underscore _, period ., tilde ~, hyphen -, and space
  • Version names must not start or end with a space and must contain at least one non-space character.

Enforcement on Update

  • New or updated versionPattern applies to all newly created version names only.
  • Existing versions remain unaffected.

Regex Validation

  • Upon clicking Save, validate the syntax of the entered versionPattern using standard regex compilation (similar to the behavior of the Release Version Pattern field).
  • If the regex is invalid (i.e., fails to compile), reject the input and display the following error message:
    "Version Pattern '<pattern>' has invalid pattern format."
    Example: "Version Pattern '[a-Z]' has invalid pattern format."

API Design

  • Need to implement new API to update the versionPattern parameter.
  • Need to update existing API to include the versionPattern parameter in its response for retrieving current configuration details.
  • Please refer to the associated PR-111 for implementation details and API specifications.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Ready for Dev

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions