Represents an API compatibility target.
This module resolves compatibility information from a DSpace.API structure and provides
helpers for discovering API version information from a live DSpace or DSpace-CRIS instance.
Most users will not need to use this module directly. The functionality is mainly used
internally (it drives compatibility resolution when executing API operations).
CRIS fork compatibility
The published API spec for the CRIS fork does not list any branches or tags prior to the 2023.01.01 release. Unless where known otherwise, this release is therefore the assumed baseline for operation compatibility checks.
That means all versions prior to this release might be flagged as incompatible to execute an operation, even though they may actually be compatible with the API. If your application targets an older CRIS release and you suspect a false positive:
- test the operation in question without enabling compatibility checks by not setting
cris_versionof theDSpace.API.t/0when you perform it - selectively disable the compatibility check for an operation by modifying its
before_stepso thatapi_versionandcris_versionis set tonilin the passedDSpace.API.t/0or - do not enable compatibility checks at all
If you confirmed a false positive, please open an Issue
Summary
Functions
Fetches version information from the API.
Parses a CRIS release string into a Elixir.Version.t/0.
Parses a DSpace version string into a Elixir.Version.t/0.
Resolves compatibility information from a DSpace.API structure.
Types
@type distribution() :: :dspace | :cris | :unknown
Target distribution.
@type t() :: %DSpace.API.Version{ api_version: Version.t() | nil, cris_version: Version.t() | nil, distribution: distribution() }
Compatibility target for a DSpace.API client.
api_version always refers to the base DSpace version, even when the client is configured to
target the CRIS fork
Functions
@spec fetch() :: DSpace.API.Operation.t()
Fetches version information from the API.
Executing this operation returns a t/0 structure.
Example
client =
[endpoint: "https://example.com/server"]
|> DSpace.API.new()
{:ok, %DSpace.API.Version{} = version} =
DSpace.API.Version.fetch()
|> DSpace.API.request(client)
Parses a CRIS release string into a Elixir.Version.t/0.
Parses a DSpace version string into a Elixir.Version.t/0.
@spec resolve(DSpace.API.t()) :: t()
Resolves compatibility information from a DSpace.API structure.
The configured values are normalized. When both :api_version and :cris_version are
configured, :cris_version determines the distribution. If the base DSpace version is missing
or cannot be parsed, an internal CRIS release mapping is used as a fallback.