-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge SemVer
and specVersion
#377
Conversation
Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with the approach - @zvr should we wait for the spec parser to be updated before merging?
I think updating the parser before merging would be better, else we get a continuously failing pipeline again that everybody simply ignores. |
@zvr, @goneall: The spec-parser PR is ready for review here: spdx/spec-parser#57 |
The pattern in specVersion.md conflicts with the SemVer specification:
Issue 1: v3.0.0 that appears in our examples is not valid according to SemVer. Do we want to allow alpha characters in SPDX versions or just non-negative integers? Issue 2: SPDX is a standard, not a software product. Do we want to force all specVersions to have a patch version, or should 2.3 and 3.0 be valid SPDX versions? Issue 3: Since SemVer is used by more than just SPDX, should SemVer be left as a reusable Core type that could be included in profile-defined Elements? |
@davaya: Your issues 1 and 2 should be separate issues from this PR as I did not change anything regarding the formatting of |
Gary agrees with getting rid of the SemVer type, and I don't have a strong objection. But there should be a good rationale for getting rid of something that already exists in Core today and might be used and re-introduced in the future. I don't think there is a great benefit to making this change. IF we got rid of it, and That's a speculative scenario, but I always like to promote re-use by default if it causes no harm. What is the harm in keeping it? |
Can you explain, @davaya ? If this is the regex pattern, I took it from the official semver.org site. Other comments:
This PR gets rid of the |
The model file is currently:
The format pattern allows things like RCs and alpha/betas that are useful for software releases, but it is more permissive than SemVer item 2 that uses only integers. The latter seems more appropriate for documents - do we ever want to have elements with specVersion =
XSD doesn't use the word "class", it has its normal English meaning: a category of things as opposed to instances of that category. Putting restrictions like length or range or pattern on fundamental classes like string and integer is "subclassing" them. For example, "Age" is a SubclassOf: "xs:integer" with range restriction of 0-120 years: https://www.w3schools.com/xml/schema_facets.asp. Being able to re-use restricted fundamental types like SemVer or Age is the reason for defining the restrictions in Class model files. Getting rid of re-usable definitions is a step backwards. |
To the first point, yes, we definitely will be using To the second point, the link you provided shows exactly what I've been saying above; you can add a restriction to the value of the property This is what this PR is doing. Since we cannot have |
Semantics means "meaning", and the logical model is intended to capture meaning to enable reasoning about data. The semantics of SemVer is that it has major, minor, and patch integers, as well as pre-release and build metadata components. A reasoner should be able to ask for all spdx v3 (major version) elements or all pre-release elements and software should be able to find them. To enable that, SemVer needs to be a Class with five properties, not a string. Serialization turns those five properties into a single string for most applications to use, but semantic applications parse that string back into named components that can be processed in a graph.
|
How so? The example in https://www.w3.org/TR/xmlschema11-1/#Complex_Type_Definitions shows a PurchaseOrderType containing several properties with name and type attributes. A CreationInfo XML instance (shortened to two properties for illustration), and in XML format instead of JSON since we're defining types using XSD rather than JSON Schema, would be:
with the corresponding Class definition following the PurchaseOrderType example:
The SemVer type (with the pattern shortened to three digits) validates 3.0.0 but correctly rejects v3.0.0, demonstrating that the SemVer type works fine whether you call it a "subclass" of its base xs:string or not. The same SemVer can of course be defined in JSON Schema in a #definitions list like all other types, and used as a property type like all other types. The above suggestion to make SemVer a structure can be accepted or rejected on its own merits, but the ability to define a SemVer Class to specify property types doesn't depend on what the type looks like (string or structure). The question is whether SemVer and DateTime types should be defined so that they can be used in more than one place. I believe they are generally useful and thus should be defined in Class files. The SubclassOf metadata item is blank or explicitly "none" for all datatypes except xsd:string; if it is treated consistently with the others this perceived problem disappears. |
This is obsoleted by #424. |
this is part of #368
Note: This moves the heading "Format" to Properties files, so the spec-parser needs to be adapted.