Semver icon

Semver

Semantic Versioning utilities for version management

Overview

This node performs semantic version comparisons using the "Greater Than or Equal" operation within the broader context of semantic versioning utilities. It compares two version strings to determine if the first version is greater than or equal to the second version, following semantic versioning rules.

Common scenarios where this node is useful include:

  • Validating software version compatibility.
  • Automating deployment pipelines by checking if a version meets minimum requirements.
  • Conditional workflows that depend on version thresholds.

For example, you can use this node to check if a deployed application version (e.g., "1.2.3") is at least "1.2.0" before proceeding with an update or feature rollout.

Properties

Name Meaning
Version 1 The first version string to compare (e.g., "1.2.3").
Version 2 The second version string to compare (e.g., "1.2.4").
Options Collection of optional flags affecting comparison behavior:
- Loose: Whether to use loose parsing for version strings (boolean).
- Include Prerelease: Whether to include prerelease versions in range matching (boolean).
- RTL (Right to Left): Not applicable for this resource-operation combination.

Output

The output JSON contains the original input data merged with a result object describing the comparison outcome:

{
  "operation": "gte",
  "version1": "1.2.3",
  "version2": "1.2.4",
  "result": false
}
  • operation: The performed operation ("gte" for Greater Than or Equal).
  • version1: The first version string provided.
  • version2: The second version string provided.
  • result: A boolean indicating whether version1 >= version2.

No binary data output is produced by this node.

Dependencies

  • Uses the external semver library for semantic version parsing and comparison.
  • No external API keys or services are required.
  • No special environment variables or n8n credentials are needed.

Troubleshooting

  • Invalid version strings: If either version string is malformed or not a valid semantic version, the comparison may fail or return unexpected results. Ensure version inputs conform to semantic versioning format (e.g., "1.2.3").
  • Loose parsing option: Enabling "Loose" parsing allows more permissive version formats but may lead to ambiguous comparisons. Use it only if necessary.
  • Prerelease handling: By default, prerelease versions are excluded from some comparisons unless "Include Prerelease" is enabled.
  • Error messages: Errors typically indicate invalid input versions or unknown resources/operations. Verify property values and ensure the resource is set to "Comparison" and operation to "Greater Than or Equal".

Links and References

Discussion