Skip to content

Add regex check for semver formatting in versioned python objects #347

@ahouseholder

Description

@ahouseholder

See https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
...which describes:

^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$

We should implement a check at the init time of ssvc._mixins._Versioned that verifies this regex and throws an error if it is not matched.

Explainer: https://regex101.com/r/Ly7O1x/3/

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesttech/backendBack-end tools, code, infrastructuretoolsSoftware Tools

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions