Closed aarondewindt closed 1 year ago
Unfortunately, the SimpleSpec
bit is an ad-hoc description, without a formal grammar.
However, it's in maintenance mode, and no new features are planned; you could use the implementation regexp located here:
>>> import semantic_version as semver
>>> semver.SimpleSpec.Parser.NAIVE_SPEC
That bit described one section, and a SimpleSpec
will accept any comma-separated list of values matching that regexp.
Hope this helps!
I'm closing this issue, but please reopen it if you have more questions!
I'm creating a few pydantic models that will contain version specification. SimpleSpec is easy enough for our less techy people to understand so I'd like to use these, however I want to make sure these files are properly validated before loading.
This is not an issue in python/pydantic, since I can create a validator that parsed the string using this package to check if it's valid. My issue is that I'll be writing a frontend in react/typescript that will also need to validate these strings, ideally without calling the backend.
My idea is to use the pydantic models to generate some json schema which I can use with some javascript validation library to validate objects. So to validate the version specifications I'll need a regex describing them.
In the worst case scenario I can always use the NPM specifications, the less techy people will probably be copy pasting things until it works anyways.