Blaze 0.0.1
The ultra high-performance JSON Schema evaluator
Loading...
Searching...
No Matches
Configuration

A configuration manifest for JSON Schema projects. More...

Classes

struct  sourcemeta::blaze::Configuration
class  sourcemeta::blaze::ConfigurationParseError

Detailed Description

A configuration manifest for JSON Schema projects.

This functionality is included as follows:

#include <sourcemeta/blaze/configuration.h>

Class Documentation

◆ sourcemeta::blaze::Configuration

struct sourcemeta::blaze::Configuration

A configuration file format for JSON Schema projects

Public Types

enum class  FetchMode : std::uint8_t { Missing , All }
 The mode for fetching dependencies with a mutable lock. More...
using ReadCallback
 A callback to read file contents from a path.
using FetchCallback
 A callback to fetch a JSON Schema from a URI.
using WriteCallback
 A callback to write a JSON Schema to a path.

Public Member Functions

auto fetch (Lock &lock, const FetchCallback &fetcher, const sourcemeta::core::SchemaResolver &resolver, const ReadCallback &reader, const WriteCallback &writer, const FetchEvent::Callback &on_event, FetchMode mode, std::size_t concurrency=1) const -> void
 Fetch dependencies, modifying the lock in-place.
auto fetch (const Lock &lock, const FetchCallback &fetcher, const sourcemeta::core::SchemaResolver &resolver, const ReadCallback &reader, const WriteCallback &writer, const FetchEvent::Callback &on_event, bool dry_run=false, std::size_t concurrency=1) const -> void
 Fetch dependencies without modifying the lock file (frozen mode).
auto add_dependency (const sourcemeta::core::URI &uri, const std::filesystem::path &path) -> void
 Add a dependency to the configuration.
auto applies_to (const std::filesystem::path &path) const -> bool
auto to_json () const -> sourcemeta::core::JSON
 Serialize a configuration to JSON.

Static Public Member Functions

static auto from_json (const sourcemeta::core::JSON &value, const std::filesystem::path &base_path) -> Configuration
 Parse a configuration file from its contents.
static auto read_json (const std::filesystem::path &path, const ReadCallback &reader) -> Configuration
 Read and parse a configuration file.
static auto find (const std::filesystem::path &path) -> std::optional< std::filesystem::path >
 A nearest ancestor configuration lookup.

Public Attributes

std::optional< sourcemeta::core::JSON::String > title
std::optional< sourcemeta::core::JSON::String > description
std::optional< sourcemeta::core::JSON::String > email
std::optional< sourcemeta::core::JSON::String > github
std::optional< sourcemeta::core::JSON::String > website
std::filesystem::path absolute_path
bool absolute_path_explicit {false}
std::filesystem::path base_path
sourcemeta::core::JSON::String base
sourcemeta::core::URI base_uri
std::optional< sourcemeta::core::JSON::String > default_dialect
std::unordered_set< sourcemeta::core::JSON::String > extension
std::unordered_map< sourcemeta::core::JSON::String, sourcemeta::core::JSON::String > resolve
std::map< sourcemeta::core::JSON::String, std::filesystem::path > dependencies
std::vector< std::filesystem::path > ignore
Lint lint
sourcemeta::core::JSON extra = sourcemeta::core::JSON::make_object()

Member Typedef Documentation

◆ FetchCallback

Initial value:
std::function<sourcemeta::core::JSON(std::string_view uri)>

A callback to fetch a JSON Schema from a URI.

◆ ReadCallback

Initial value:
std::function<std::string(const std::filesystem::path &)>

A callback to read file contents from a path.

◆ WriteCallback

Initial value:
std::function<void(const std::filesystem::path &,
const sourcemeta::core::JSON &)>

A callback to write a JSON Schema to a path.

Member Enumeration Documentation

◆ FetchMode

enum class sourcemeta::blaze::Configuration::FetchMode : std::uint8_t
strong

The mode for fetching dependencies with a mutable lock.

Enumerator
Missing 

Fetch only what's missing or untracked.

All 

Re-fetch everything regardless of current state.

Member Function Documentation

◆ applies_to()

auto sourcemeta::blaze::Configuration::applies_to ( const std::filesystem::path & path) const->bool
nodiscard

Check if the given path represents a schema described by this configuration

Member Data Documentation

◆ extension

std::unordered_set<sourcemeta::core::JSON::String> sourcemeta::blaze::Configuration::extension
Initial value:
{".json", ".yml",
".yaml"}

◆ sourcemeta::blaze::ConfigurationParseError

class sourcemeta::blaze::ConfigurationParseError
Inheritance diagram for sourcemeta::blaze::ConfigurationParseError:

Public Member Functions

 ConfigurationParseError (const char *message, sourcemeta::core::Pointer location)
 ConfigurationParseError (std::string message, sourcemeta::core::Pointer location)=delete
 ConfigurationParseError (std::string &&message, sourcemeta::core::Pointer location)=delete
 ConfigurationParseError (std::string_view message, sourcemeta::core::Pointer location)=delete
auto what () const noexcept -> const char *override
auto location () const noexcept -> const auto &