Skip to content

Commit

Permalink
docs(spdx-utils): Document each main class with a link to the spec
Browse files Browse the repository at this point in the history
Also slightly reword the existing docs while at it.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Oct 30, 2024
1 parent 24f44d8 commit 6f3aaa5
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 13 deletions.
1 change: 1 addition & 0 deletions utils/spdx/src/main/kotlin/model/SpdxAnnotation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.ossreviewtoolkit.utils.spdx.SpdxConstants

/**
* An annotation which can relate to [SpdxDocument]s, [SpdxFile]s, or [SpdxPackage]s.
* See https://spdx.github.io/spdx-spec/v2.2.2/annotations/.
*/
data class SpdxAnnotation(
/**
Expand Down
3 changes: 2 additions & 1 deletion utils/spdx/src/main/kotlin/model/SpdxChecksum.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
package org.ossreviewtoolkit.utils.spdx.model

/**
* Specifies checksum value and algorithm.
* A checksum for an [SpdxFile].
* See https://spdx.github.io/spdx-spec/v2.2.2/file-information/#84-file-checksum-field.
*/
data class SpdxChecksum(
/**
Expand Down
3 changes: 2 additions & 1 deletion utils/spdx/src/main/kotlin/model/SpdxCreationInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import com.fasterxml.jackson.annotation.JsonInclude
import java.time.Instant

/**
* Metadata corresponding to a [SpdxDocument].
* Creation information for an [SpdxDocument].
* See https://spdx.github.io/spdx-spec/v2.2.2/document-creation-information/.
*/
data class SpdxCreationInfo(
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ package org.ossreviewtoolkit.utils.spdx.model
import org.ossreviewtoolkit.utils.spdx.SpdxConstants

/**
* [SpdxExternalDocumentReference]s are used by [SpdxDocument]s to list all external documents which are referenced from
* that particular [SpdxDocument].
* A reference from one [SpdxDocument] to another external [SpdxDocument].
* See https://spdx.github.io/spdx-spec/v2.2.2/document-creation-information/#66-external-document-references-field.
*/
data class SpdxExternalDocumentReference(
/**
Expand Down
4 changes: 2 additions & 2 deletions utils/spdx/src/main/kotlin/model/SpdxExternalReference.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.databind.deser.std.StdDeserializer

/**
* References an external source of additional information, metadata, enumerations, asset identifiers, or downloadable
* content believed to be relevant to the Package.
* A reference to an external source of additional information for an [SpdxPackage].
* See https://spdx.github.io/spdx-spec/v2.2.2/package-information/#721-external-reference-field.
*/
data class SpdxExternalReference(
/**
Expand Down
3 changes: 2 additions & 1 deletion utils/spdx/src/main/kotlin/model/SpdxExtractedLicenseInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ package org.ossreviewtoolkit.utils.spdx.model
import com.fasterxml.jackson.annotation.JsonInclude

/**
* This class holds information about any license not on the SPDX license list.
* Information about other licenses that are not found on the SPDX license list.
* See https://spdx.github.io/spdx-spec/v2.2.2/other-licensing-information-detected/.
*
* Note: The above specification says that several fields are mandatory only if the license is not on the SPDX license
* list and at the same time says that instances of this class should only be created for licenses not on the SPDX
Expand Down
3 changes: 2 additions & 1 deletion utils/spdx/src/main/kotlin/model/SpdxFile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import org.ossreviewtoolkit.utils.spdx.SpdxExpression.Strictness.ALLOW_LICENSERE
import org.ossreviewtoolkit.utils.spdx.isSpdxExpressionOrNotPresent

/**
* Provides important metadata about a particular file of a software package.
* Information about a file used in an [SpdxDocument].
* See https://spdx.github.io/spdx-spec/v2.2.2/file-information/.
*/
@JsonIgnoreProperties("ranges") // TODO: Implement ranges which is broken in the specification examples.
data class SpdxFile(
Expand Down
3 changes: 2 additions & 1 deletion utils/spdx/src/main/kotlin/model/SpdxPackage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import org.ossreviewtoolkit.utils.spdx.SpdxExpression.Strictness.ALLOW_LICENSERE
import org.ossreviewtoolkit.utils.spdx.isSpdxExpressionOrNotPresent

/**
* Describes a software package.
* Information about a package used in an [SpdxDocument].
* See https://spdx.github.io/spdx-spec/v2.2.2/package-information/.
*/
data class SpdxPackage(
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ package org.ossreviewtoolkit.utils.spdx.model
import com.fasterxml.jackson.annotation.JsonInclude

/**
* A unique identifier based on the file contents of a package.
* An identifier for an [SpdxPackage] based on its file contents.
* See https://spdx.github.io/spdx-spec/v2.2.2/package-information/#79-package-verification-code-field.
*/
data class SpdxPackageVerificationCode(
/**
Expand Down
3 changes: 2 additions & 1 deletion utils/spdx/src/main/kotlin/model/SpdxRelationship.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ package org.ossreviewtoolkit.utils.spdx.model
import com.fasterxml.jackson.annotation.JsonInclude

/**
* A relationship between two SPDX documents, packages or files.
* A relationship between two [SpdxDocument]s, [SpdxPackage]s or [SpdxFile]s.
* See https://spdx.github.io/spdx-spec/v2.2.2/relationships-between-SPDX-elements/.
*/
data class SpdxRelationship(
/**
Expand Down
4 changes: 2 additions & 2 deletions utils/spdx/src/main/kotlin/model/SpdxSnippet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import org.ossreviewtoolkit.utils.spdx.SpdxExpression.Strictness.ALLOW_LICENSERE
import org.ossreviewtoolkit.utils.spdx.isSpdxExpressionOrNotPresent

/**
* A Snippet can be used when a file is known to have some content that has been included from another original source.
* It can be used to denote when a part of a file may have been originally created under another license.
* Information about a snippet that has different licenses and / or copyright than the containing file.
* See https://spdx.github.io/spdx-spec/v2.2.2/snippet-information/.
*/
@JsonIgnoreProperties("ranges") // TODO: Implement ranges which is broken in the specification examples.
data class SpdxSnippet(
Expand Down

0 comments on commit 6f3aaa5

Please sign in to comment.