crawlscope 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/docs/rules.md +6 -4
- data/lib/crawlscope/schemas.rb +51 -1
- data/lib/crawlscope/version.rb +1 -1
- data/test/crawlscope/schema_registry_test.rb +24 -0
- data/test/crawlscope/structured_data_audit_test.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bea98f57f31142cd6c7f4791ca9ac95b4d509b69aa9109a875e59ee1d24e886c
|
|
4
|
+
data.tar.gz: 0e08b2a0d22174d6b9642f6101a9191c49c67e8ee91c6d10b1e8c0f4a4ed9881
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 996fd42a217a6ddcf5157b9a8a4bf0df1afd35be999bda090ae1e33d73ce9d4603be05fe69190f8cfb6c56fb30f63751836d3b03148d6db4e63d8790394e0c46
|
|
7
|
+
data.tar.gz: 683d3e6888d2116df29b6ac6a9faf586b93dc7fabee28193b2d3e1f50566a10cd5c3a7f03058e658c714e66e809c6df5e9d60fe8ce6bdac88e0703c67035a929
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.12.1] - 2026-12-03
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- validate common types and contextual dataset metadata
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
8
17
|
## [0.12.0] - 2026-12-02
|
|
9
18
|
|
|
10
19
|
|
data/docs/rules.md
CHANGED
|
@@ -58,10 +58,12 @@ errors.
|
|
|
58
58
|
|
|
59
59
|
The Dataset schema follows [Google's dataset metadata guidance](https://developers.google.com/search/docs/appearance/structured-data/dataset).
|
|
60
60
|
It requires a name and description and validates download URLs when distributions
|
|
61
|
-
are supplied.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
are supplied. Warnings cover broadly applicable metadata: creator, license,
|
|
62
|
+
accessibility, keywords, measured variables and URL. Context-dependent metadata
|
|
63
|
+
(such as funding, coverage, versions, catalog membership and downloads) is
|
|
64
|
+
validated when supplied but is not required for every dataset. Download formats
|
|
65
|
+
are recommended when a distribution exists. DataCatalog and DataDownload are
|
|
66
|
+
registered independently.
|
|
65
67
|
|
|
66
68
|
Hosts can declare recommended properties in custom schemas using a
|
|
67
69
|
`recommended` list alongside JSON Schema's `required` list:
|
data/lib/crawlscope/schemas.rb
CHANGED
|
@@ -338,6 +338,43 @@ module Crawlscope
|
|
|
338
338
|
}
|
|
339
339
|
}.freeze
|
|
340
340
|
|
|
341
|
+
PERSON = {
|
|
342
|
+
type: "object",
|
|
343
|
+
required: ["@type"],
|
|
344
|
+
properties: {
|
|
345
|
+
"@type" => {const: "Person"},
|
|
346
|
+
:name => {type: "string", minLength: 1},
|
|
347
|
+
:url => {type: "string", format: "uri"},
|
|
348
|
+
:sameAs => {anyOf: [{type: "string", format: "uri"}, {type: "array", items: {type: "string", format: "uri"}}]},
|
|
349
|
+
:description => {type: "string"},
|
|
350
|
+
:jobTitle => {type: ["string", "object"]},
|
|
351
|
+
:worksFor => {type: ["object", "array"]}
|
|
352
|
+
}
|
|
353
|
+
}.freeze
|
|
354
|
+
|
|
355
|
+
COLLECTION_PAGE = {
|
|
356
|
+
type: "object",
|
|
357
|
+
required: ["@type"],
|
|
358
|
+
properties: {
|
|
359
|
+
"@type" => {const: "CollectionPage"},
|
|
360
|
+
:name => {type: "string", minLength: 1},
|
|
361
|
+
:url => {type: "string", format: "uri"},
|
|
362
|
+
:description => {type: "string"}
|
|
363
|
+
}
|
|
364
|
+
}.freeze
|
|
365
|
+
|
|
366
|
+
ITEM_LIST = {
|
|
367
|
+
type: "object",
|
|
368
|
+
required: ["@type"],
|
|
369
|
+
properties: {
|
|
370
|
+
"@type" => {const: "ItemList"},
|
|
371
|
+
:name => {type: "string"},
|
|
372
|
+
:url => {type: "string", format: "uri"},
|
|
373
|
+
:itemListElement => {anyOf: [{type: ["string", "object"]}, {type: "array", items: {type: ["string", "object"]}}]},
|
|
374
|
+
:numberOfItems => {type: "integer", minimum: 0}
|
|
375
|
+
}
|
|
376
|
+
}.freeze
|
|
377
|
+
|
|
341
378
|
JOB_POSTING = {
|
|
342
379
|
type: "object",
|
|
343
380
|
additionalProperties: true,
|
|
@@ -410,13 +447,23 @@ module Crawlscope
|
|
|
410
447
|
DATASET = {
|
|
411
448
|
type: "object",
|
|
412
449
|
required: %w[name description],
|
|
413
|
-
recommended: %w[
|
|
450
|
+
recommended: %w[creator isAccessibleForFree keywords license variableMeasured url],
|
|
414
451
|
properties: {
|
|
415
452
|
name: {type: "string", minLength: 1},
|
|
416
453
|
description: {type: "string", minLength: 50, maxLength: 5000},
|
|
417
454
|
license: {anyOf: [{type: "string", format: "uri"}, {type: "object", required: ["url"], properties: {url: {type: "string", format: "uri"}}}]},
|
|
418
455
|
isAccessibleForFree: {type: "boolean"},
|
|
419
456
|
url: {type: "string", format: "uri"},
|
|
457
|
+
alternateName: {type: ["string", "array"]},
|
|
458
|
+
citation: {type: ["string", "object", "array"]},
|
|
459
|
+
funder: {type: ["object", "array"]},
|
|
460
|
+
identifier: {type: ["string", "object", "array"]},
|
|
461
|
+
sameAs: {anyOf: [{type: "string", format: "uri"}, {type: "array", items: {type: "string", format: "uri"}}]},
|
|
462
|
+
version: {type: ["string", "number"]},
|
|
463
|
+
measurementTechnique: {type: ["string", "object", "array"]},
|
|
464
|
+
spatialCoverage: {type: ["string", "object", "array"]},
|
|
465
|
+
temporalCoverage: {type: ["string", "array"]},
|
|
466
|
+
includedInDataCatalog: {type: ["object", "array"]},
|
|
420
467
|
distribution: {anyOf: [DATA_DOWNLOAD, {type: "array", minItems: 1, items: DATA_DOWNLOAD}]}
|
|
421
468
|
}
|
|
422
469
|
}.freeze
|
|
@@ -440,6 +487,9 @@ module Crawlscope
|
|
|
440
487
|
"Event" => EVENT,
|
|
441
488
|
"VideoObject" => VIDEO_OBJECT,
|
|
442
489
|
"WebPage" => WEB_PAGE,
|
|
490
|
+
"Person" => PERSON,
|
|
491
|
+
"CollectionPage" => COLLECTION_PAGE,
|
|
492
|
+
"ItemList" => ITEM_LIST,
|
|
443
493
|
"JobPosting" => JOB_POSTING,
|
|
444
494
|
"Dataset" => DATASET,
|
|
445
495
|
"DataCatalog" => DATA_CATALOG,
|
data/lib/crawlscope/version.rb
CHANGED
|
@@ -142,6 +142,30 @@ class CrawlscopeSchemaRegistryTest < Minitest::Test
|
|
|
142
142
|
assert_equal "Unknown Crawlscope rules: unknown", error.message
|
|
143
143
|
end
|
|
144
144
|
|
|
145
|
+
def test_common_schema_types_validate_properties_without_unsupported_warnings
|
|
146
|
+
registry = Crawlscope::SchemaRegistry.default
|
|
147
|
+
[
|
|
148
|
+
[{"@type" => "Person", "name" => "Example", "sameAs" => ["https://example.com/author"]}, "name"],
|
|
149
|
+
[{"@type" => "CollectionPage", "name" => "Guides", "url" => "https://example.com/guides"}, "url"],
|
|
150
|
+
[{"@type" => "ItemList", "itemListElement" => [{"@type" => "ListItem", "position" => 1}]}, "itemListElement"]
|
|
151
|
+
].each do |item, field|
|
|
152
|
+
assert_empty registry.warnings(item)
|
|
153
|
+
assert_empty registry.validate(item)
|
|
154
|
+
refute_empty registry.validate(item.merge(field => 42))
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def test_dataset_recommendations_do_not_assume_optional_context
|
|
159
|
+
registry = Crawlscope::SchemaRegistry.default
|
|
160
|
+
dataset = {"@type" => "Dataset", "name" => "Ratings", "description" => "Aggregated local business ratings and review counts.",
|
|
161
|
+
"creator" => {"@type" => "Organization", "name" => "Example"}, "license" => "https://example.com/license",
|
|
162
|
+
"isAccessibleForFree" => true, "keywords" => ["ratings"], "variableMeasured" => ["rating"],
|
|
163
|
+
"url" => "https://example.com/ratings"}
|
|
164
|
+
assert_empty registry.warnings(dataset)
|
|
165
|
+
refute_empty registry.validate(dataset.merge("sameAs" => 42))
|
|
166
|
+
refute_empty registry.validate(dataset.merge("version" => {}))
|
|
167
|
+
end
|
|
168
|
+
|
|
145
169
|
def test_dataset_required_properties_and_download_validation
|
|
146
170
|
registry = Crawlscope::SchemaRegistry.default
|
|
147
171
|
dataset = {"@type" => "Dataset", "name" => "Ratings", "description" => "Aggregated local business ratings and review counts."}
|
|
@@ -28,7 +28,6 @@ class CrawlscopeStructuredDataAuditTest < Minitest::Test
|
|
|
28
28
|
|
|
29
29
|
assert_equal expected_ok, outcome.ok?, data.inspect
|
|
30
30
|
expected_codes = expected_ok ? [] : [:structured_data_missing_required_type]
|
|
31
|
-
expected_codes.unshift(:structured_data_unsupported_type) if data["@type"] == "ItemList"
|
|
32
31
|
assert_equal expected_codes, issues.map(&:code), data.inspect
|
|
33
32
|
unless expected_ok
|
|
34
33
|
assert_equal "page", outcome.entries.first.errors.first.fetch(:source)
|