//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `registry/record/put`. Version: `0.1`.
#![allow(deprecated)]
/// Why this specification version is deprecated (SPEC "Superseded and
/// Withdrawn Versions"), or `None` while it is current.
pub const DEPRECATION: Option<&str> = Some("superseded by registry/record/put/0.3");
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
/// Error types.
pub mod error {
/// Error from a `TryFrom` or `FromStr` implementation.
pub struct ConversionError(::std::borrow::Cow<'static, str>);
impl ::std::error::Error for ConversionError {}
impl ::std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Display::fmt(&self.0, f)
}
}
impl ::std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct Ext(pub ::std::collections::HashMap<ExtKey, ::serde_json::Value>);
impl ::std::ops::Deref for Ext {
type Target = ::std::collections::HashMap<ExtKey, ::serde_json::Value>;
fn deref(&self) -> &::std::collections::HashMap<ExtKey, ::serde_json::Value> {
&self.0
}
}
impl ::std::convert::From<Ext> for ::std::collections::HashMap<ExtKey, ::serde_json::Value> {
fn from(value: Ext) -> Self {
value.0
}
}
impl ::std::convert::From<::std::collections::HashMap<ExtKey, ::serde_json::Value>> for Ext {
fn from(value: ::std::collections::HashMap<ExtKey, ::serde_json::Value>) -> Self {
Self(value)
}
}
///`ExtKey`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ExtKey(::std::string::String);
impl ::std::ops::Deref for ExtKey {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ExtKey> for ::std::string::String {
fn from(value: ExtKey) -> Self {
value.0
}
}
impl ::std::str::FromStr for ExtKey {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ExtKey {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///An administrator asks a trust registry to create or replace the trust record at its four-part key (entity+authority+action+resource). Create-or-update in one task, following the vault/upsert precedent; the optional `expectedExisting` assertion recovers the strict create-only / update-only semantics of the superseded registry/record/create and registry/record/update tasks.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
#[deprecated(note = "superseded by registry/record/put/0.3")]
pub struct Payload {
///Optional existence assertion. When true, the registry MUST reject with `registry/record/put:notFound` if no record exists at the key (strict update). When false, the registry MUST reject with `registry/record/put:alreadyExists` if one does (strict create). Omitted: pure create-or-update.
#[serde(
rename = "expectedExisting",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub expected_existing: ::std::option::Option<bool>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
pub record: TrustRecord,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///Whether the record asserts an authorization or a recognition relationship.
///
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum RecordType {
#[serde(rename = "authorization")]
Authorization,
#[serde(rename = "recognition")]
Recognition,
}
impl ::std::fmt::Display for RecordType {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Authorization => f.write_str("authorization"),
Self::Recognition => f.write_str("recognition"),
}
}
}
impl ::std::str::FromStr for RecordType {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"authorization" => Ok(Self::Authorization),
"recognition" => Ok(Self::Recognition),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for RecordType {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for RecordType {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for RecordType {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///`Response`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
#[deprecated(note = "superseded by registry/record/put/0.3")]
pub struct Response {
///True when the put created a new record, false when it replaced an existing one.
pub created: bool,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///Optional human-readable detail.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub message: ::std::option::Option<ResponseMessage>,
///Whether the record was stored.
pub ok: bool,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///Optional human-readable detail.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseMessage(::std::string::String);
impl ::std::ops::Deref for ResponseMessage {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseMessage> for ::std::string::String {
fn from(value: ResponseMessage) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseMessage {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 1024usize {
return Err("longer than 1024 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ResponseMessage {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ResponseMessage {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ResponseMessage {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ResponseMessage {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///`TrustRecord`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct TrustRecord {
pub action: ::std::string::String,
pub authority_id: ::std::string::String,
///Present on authorization records: whether the action+resource authorization is confirmed.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub authorized: ::std::option::Option<bool>,
///Opaque governance context attached to the record.
#[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
pub context: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
pub entity_id: ::std::string::String,
///Present on recognition records: whether the action+resource is recognised.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub recognized: ::std::option::Option<bool>,
pub record_type: RecordType,
pub resource: ::std::string::String,
}
impl TrustRecord {
pub fn builder() -> builder::TrustRecord {
Default::default()
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Payload {
expected_existing:
::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
record: ::std::result::Result<super::TrustRecord, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
expected_existing: Ok(Default::default()),
ext: Ok(Default::default()),
record: Err("no value supplied for record".to_string()),
}
}
}
impl Payload {
pub fn expected_existing<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<bool>>,
T::Error: ::std::fmt::Display,
{
self.expected_existing = value
.try_into()
.map_err(|e| format!("error converting supplied value for expected_existing: {e}"));
self
}
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn record<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::TrustRecord>,
T::Error: ::std::fmt::Display,
{
self.record = value
.try_into()
.map_err(|e| format!("error converting supplied value for record: {e}"));
self
}
}
impl ::std::convert::TryFrom<Payload> for super::Payload {
type Error = super::error::ConversionError;
fn try_from(value: Payload) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
expected_existing: value.expected_existing?,
ext: value.ext?,
record: value.record?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
expected_existing: Ok(value.expected_existing),
ext: Ok(value.ext),
record: Ok(value.record),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
created: ::std::result::Result<bool, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
message: ::std::result::Result<
::std::option::Option<super::ResponseMessage>,
::std::string::String,
>,
ok: ::std::result::Result<bool, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
created: Err("no value supplied for created".to_string()),
ext: Ok(Default::default()),
message: Ok(Default::default()),
ok: Err("no value supplied for ok".to_string()),
}
}
}
impl Response {
pub fn created<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.created = value
.try_into()
.map_err(|e| format!("error converting supplied value for created: {e}"));
self
}
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn message<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ResponseMessage>>,
T::Error: ::std::fmt::Display,
{
self.message = value
.try_into()
.map_err(|e| format!("error converting supplied value for message: {e}"));
self
}
pub fn ok<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.ok = value
.try_into()
.map_err(|e| format!("error converting supplied value for ok: {e}"));
self
}
}
impl ::std::convert::TryFrom<Response> for super::Response {
type Error = super::error::ConversionError;
fn try_from(value: Response) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
created: value.created?,
ext: value.ext?,
message: value.message?,
ok: value.ok?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
created: Ok(value.created),
ext: Ok(value.ext),
message: Ok(value.message),
ok: Ok(value.ok),
}
}
}
#[derive(Clone, Debug)]
pub struct TrustRecord {
action: ::std::result::Result<::std::string::String, ::std::string::String>,
authority_id: ::std::result::Result<::std::string::String, ::std::string::String>,
authorized: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
context: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
entity_id: ::std::result::Result<::std::string::String, ::std::string::String>,
recognized: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
record_type: ::std::result::Result<super::RecordType, ::std::string::String>,
resource: ::std::result::Result<::std::string::String, ::std::string::String>,
}
impl ::std::default::Default for TrustRecord {
fn default() -> Self {
Self {
action: Err("no value supplied for action".to_string()),
authority_id: Err("no value supplied for authority_id".to_string()),
authorized: Ok(Default::default()),
context: Ok(Default::default()),
entity_id: Err("no value supplied for entity_id".to_string()),
recognized: Ok(Default::default()),
record_type: Err("no value supplied for record_type".to_string()),
resource: Err("no value supplied for resource".to_string()),
}
}
}
impl TrustRecord {
pub fn action<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.action = value
.try_into()
.map_err(|e| format!("error converting supplied value for action: {e}"));
self
}
pub fn authority_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.authority_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for authority_id: {e}"));
self
}
pub fn authorized<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<bool>>,
T::Error: ::std::fmt::Display,
{
self.authorized = value
.try_into()
.map_err(|e| format!("error converting supplied value for authorized: {e}"));
self
}
pub fn context<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
>,
T::Error: ::std::fmt::Display,
{
self.context = value
.try_into()
.map_err(|e| format!("error converting supplied value for context: {e}"));
self
}
pub fn entity_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.entity_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for entity_id: {e}"));
self
}
pub fn recognized<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<bool>>,
T::Error: ::std::fmt::Display,
{
self.recognized = value
.try_into()
.map_err(|e| format!("error converting supplied value for recognized: {e}"));
self
}
pub fn record_type<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::RecordType>,
T::Error: ::std::fmt::Display,
{
self.record_type = value
.try_into()
.map_err(|e| format!("error converting supplied value for record_type: {e}"));
self
}
pub fn resource<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.resource = value
.try_into()
.map_err(|e| format!("error converting supplied value for resource: {e}"));
self
}
}
impl ::std::convert::TryFrom<TrustRecord> for super::TrustRecord {
type Error = super::error::ConversionError;
fn try_from(
value: TrustRecord,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
action: value.action?,
authority_id: value.authority_id?,
authorized: value.authorized?,
context: value.context?,
entity_id: value.entity_id?,
recognized: value.recognized?,
record_type: value.record_type?,
resource: value.resource?,
})
}
}
impl ::std::convert::From<super::TrustRecord> for TrustRecord {
fn from(value: super::TrustRecord) -> Self {
Self {
action: Ok(value.action),
authority_id: Ok(value.authority_id),
authorized: Ok(value.authorized),
context: Ok(value.context),
entity_id: Ok(value.entity_id),
recognized: Ok(value.recognized),
record_type: Ok(value.record_type),
resource: Ok(value.resource),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/registry/record/put/0.1";
const IS_PROOF_REQUIRED: bool = true;
const IS_ISSUED_AT_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\"$defs\":{\"Ext\":{\"additionalProperties\":true,\"description\":\"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\"minProperties\":1,\"propertyNames\":{\"pattern\":\"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"},\"title\":\"Ext\",\"type\":\"object\"},\"RecordType\":{\"description\":\"Whether the record asserts an authorization or a recognition relationship.\",\"enum\":[\"authorization\",\"recognition\"],\"title\":\"RecordType\",\"type\":\"string\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"properties\":{\"created\":{\"description\":\"True when the put created a new record, false when it replaced an existing one.\",\"type\":\"boolean\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"message\":{\"description\":\"Optional human-readable detail.\",\"maxLength\":1024,\"type\":\"string\"},\"ok\":{\"description\":\"Whether the record was stored.\",\"type\":\"boolean\"}},\"required\":[\"ok\",\"created\"],\"title\":\"Registry Record Put — response payload\",\"type\":\"object\"},\"TrustRecord\":{\"additionalProperties\":false,\"properties\":{\"action\":{\"type\":\"string\"},\"authority_id\":{\"type\":\"string\"},\"authorized\":{\"description\":\"Present on authorization records: whether the action+resource authorization is confirmed.\",\"type\":\"boolean\"},\"context\":{\"additionalProperties\":true,\"description\":\"Opaque governance context attached to the record.\",\"type\":\"object\"},\"entity_id\":{\"type\":\"string\"},\"recognized\":{\"description\":\"Present on recognition records: whether the action+resource is recognised.\",\"type\":\"boolean\"},\"record_type\":{\"$ref\":\"#/$defs/RecordType\"},\"resource\":{\"type\":\"string\"}},\"required\":[\"entity_id\",\"authority_id\",\"action\",\"resource\",\"record_type\"],\"title\":\"TrustRecord\",\"type\":\"object\"}},\"$id\":\"https://trusttasks.org/spec/registry/record/put/0.1\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"additionalProperties\":false,\"description\":\"An administrator asks a trust registry to create or replace the trust record at its four-part key (entity+authority+action+resource). Create-or-update in one task, following the vault/upsert precedent; the optional `expectedExisting` assertion recovers the strict create-only / update-only semantics of the superseded registry/record/create and registry/record/update tasks.\",\"properties\":{\"expectedExisting\":{\"description\":\"Optional existence assertion. When true, the registry MUST reject with `registry/record/put:notFound` if no record exists at the key (strict update). When false, the registry MUST reject with `registry/record/put:alreadyExists` if one does (strict create). Omitted: pure create-or-update.\",\"type\":\"boolean\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"record\":{\"$ref\":\"#/$defs/TrustRecord\"}},\"required\":[\"record\"],\"title\":\"Registry Record Put — payload\",\"type\":\"object\"}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/registry/record/put/0.1#response";
const IS_PROOF_REQUIRED: bool = true;
const IS_ISSUED_AT_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\"$defs\":{\"Ext\":{\"additionalProperties\":true,\"description\":\"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\"minProperties\":1,\"propertyNames\":{\"pattern\":\"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"},\"title\":\"Ext\",\"type\":\"object\"},\"RecordType\":{\"description\":\"Whether the record asserts an authorization or a recognition relationship.\",\"enum\":[\"authorization\",\"recognition\"],\"title\":\"RecordType\",\"type\":\"string\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"properties\":{\"created\":{\"description\":\"True when the put created a new record, false when it replaced an existing one.\",\"type\":\"boolean\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"message\":{\"description\":\"Optional human-readable detail.\",\"maxLength\":1024,\"type\":\"string\"},\"ok\":{\"description\":\"Whether the record was stored.\",\"type\":\"boolean\"}},\"required\":[\"ok\",\"created\"],\"title\":\"Registry Record Put — response payload\",\"type\":\"object\"},\"TrustRecord\":{\"additionalProperties\":false,\"properties\":{\"action\":{\"type\":\"string\"},\"authority_id\":{\"type\":\"string\"},\"authorized\":{\"description\":\"Present on authorization records: whether the action+resource authorization is confirmed.\",\"type\":\"boolean\"},\"context\":{\"additionalProperties\":true,\"description\":\"Opaque governance context attached to the record.\",\"type\":\"object\"},\"entity_id\":{\"type\":\"string\"},\"recognized\":{\"description\":\"Present on recognition records: whether the action+resource is recognised.\",\"type\":\"boolean\"},\"record_type\":{\"$ref\":\"#/$defs/RecordType\"},\"resource\":{\"type\":\"string\"}},\"required\":[\"entity_id\",\"authority_id\",\"action\",\"resource\",\"record_type\"],\"title\":\"TrustRecord\",\"type\":\"object\"}},\"$ref\":\"#/$defs/Response\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\"}\n",
);
}
impl crate::RequestPayload for Payload {
type Response = Response;
}
/// The earlier `MAJOR.MINOR` of this slug that this version declares it
/// extends (front matter `extends`, SPEC §5.2 "Declared extension"), or
/// `None`. Only the direct declaration; walk a chain with
/// [`crate::extension::extends_for`].
pub const EXTENDS: Option<&str> = None;
/// The extended error codes this specification declares (SPEC §7.3 item 9,
/// §8.5), in declaration order. Empty when it declares none.
pub const ERROR_CODES: &[crate::DeclaredErrorCode] =
&[error_codes::ALREADY_EXISTS, error_codes::NOT_FOUND];
/// One constant per extended error code this specification declares
/// (SPEC §7.3 item 9), named for its local part.
///
/// Emit these rather than a string literal: the code is read from the
/// specification, so it cannot name a code the specification never
/// declared.
pub mod error_codes {
/// `registry/record/put:alreadyExists`
///
/// `expectedExisting: false` was asserted but a record already exists for the given entity+authority+action+resource key.
///
/// Declared `retryable: false`.
pub const ALREADY_EXISTS: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "registry/record/put:alreadyExists",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `registry/record/put:notFound`
///
/// `expectedExisting: true` was asserted but no record exists for the given entity+authority+action+resource key.
///
/// Declared `retryable: false`.
pub const NOT_FOUND: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "registry/record/put:notFound",
retryable: false,
details_schema: ::core::option::Option::None,
};
}