swh.deposit.api.checks module

Functional Metadata checks:

Mandatory fields: - ‘author’ - ‘name’ or ‘title’

Suggested fields: - metadata-provenance

swh.deposit.api.checks.extra_validator(element: Element, xsd_element: Xsd11Element) Optional[Iterator[XMLSchemaValidationError]][source]

Performs extra checks on Atom elements that cannot be implemented purely within XML Schema.

For now, this only checks URIs are absolute.

swh.deposit.api.checks.absolute_uri_validator(element: Element, xsd_element: Xsd11Element) Iterator[XMLSchemaValidationError][source]
class swh.deposit.api.checks.Schemas(swh: xmlschema.validators.schemas.XMLSchema11, codemeta: xmlschema.validators.schemas.XMLSchema11)[source]

Bases: object

swh: XMLSchema11
codemeta: XMLSchema11
swh.deposit.api.checks.schemas() Schemas[source]
swh.deposit.api.checks.check_metadata(metadata: Element) Tuple[bool, Optional[Dict]][source]

Check metadata for mandatory field presence and date format.

Parameters

metadata – Metadata dictionary to check

Returns

  • (True, None) if metadata are ok and suggested fields are also present

  • (True, <detailed-error>) if metadata are ok but some suggestions are missing

  • (False, <detailed-error>) otherwise.

Return type

tuple (status, error_detail)

swh.deposit.api.checks.check_url_match_provider(url: str, provider_url: str) None[source]

Check url matches the provider url.

Raises DepositError in case of mismatch