Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Add JSON schema for output of reuse lint --json #128

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 176 additions & 0 deletions 1.0.0_lint_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
{
"$schema": "https://reuse.software/schemas/1.0.0_lint_schema.json",
"$ref": "#/definitions/Result",
"definitions": {
"Result": {
"type": "object",
"additionalProperties": false,
"properties": {
"lint_version": {
"type": "string"
},
"reuse_spec_version": {
"type": "string"
},
"reuse_tool_version": {
"type": "string"
},
"files": {
"type": "array",
"items": {
"$ref": "#/definitions/File"
}
},
"non_compliant": {
"$ref": "#/definitions/NonCompliant"
},
"summary": {
"$ref": "#/definitions/Summary"
}
},
"required": [
"files",
"lint_version",
"non_compliant",
"reuse_spec_version",
"reuse_tool_version",
"summary"
],
"title": "Welcome"
},
"File": {
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"type": "string"
},
"copyrights": {
"type": "array",
"items": {
"$ref": "#/definitions/Copyright"
}
},
"licenses": {
"type": "array",
"items": {
"$ref": "#/definitions/Copyright"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the object name Copyright the correct name if it also used in a licensing context?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the alternative?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Details or FindingDetails?

}
}
},
"required": ["copyrights", "licenses", "path"],
"title": "File"
},
"Copyright": {
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"type": "string"
},
"source": {
"type": "string"
}
},
"required": ["source", "value"],
"title": "Copyright"
},
"NonCompliant": {
"type": "object",
"additionalProperties": false,
"properties": {
"missing_licenses": {
"$ref": "#/definitions/MissingLicenses"
},
"unused_licenses": {
"type": "array",
"items": {}
},
"deprecated_licenses": {
"type": "array",
"items": {}
},
"bad_licenses": {
"$ref": "#/definitions/BadLicenses"
},
"licenses_without_extension": {
"$ref": "#/definitions/LicensesWithoutExtension"
},
"missing_copyright_info": {
"type": "array",
"items": {
"type": "string"
}
},
"missing_licensing_info": {
"type": "array",
"items": {
"type": "string"
}
},
"read_errors": {
"type": "array",
"items": {}
}
},
"required": [
"bad_licenses",
"deprecated_licenses",
"licenses_without_extension",
"missing_copyright_info",
"missing_licenses",
"missing_licensing_info",
"read_errors",
"unused_licenses"
],
"title": "NonCompliant"
},
"BadLicenses": {
"type": "object",
"additionalProperties": { "type": "object" },
"title": "BadLicenses"
},
"LicensesWithoutExtension": {
"type": "object",
"additionalProperties": { "type": "object" },
"title": "LicensesWithoutExtension"
},
"MissingLicenses": {
"type": "object",
"additionalProperties": { "type": "object" },
"title": "MissingLicenses"
},
Comment on lines +128 to +142
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand it correctly these objects are not defined or explicitly structured.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, you're right. That's because the key of these objects is in a sense arbitrary, i.e. the license name. I don't know JSON schema well enough to know whether this can be alleviated. I think for a first version, this is fine though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Least we could do is force the keys to be strings https://stackoverflow.com/a/26848488

"Summary": {
"type": "object",
"additionalProperties": false,
"properties": {
"used_licenses": {
"type": "array",
"items": {
"type": "string"
}
},
"files_total": {
"type": "integer"
},
"files_with_copyright_info": {
"type": "integer"
},
"files_with_licensing_info": {
"type": "integer"
},
"compliant": {
"type": "boolean"
}
},
"required": [
"compliant",
"files_total",
"files_with_copyright_info",
"files_with_licensing_info",
"used_licenses"
],
"title": "Summary"
}
}
}