//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `vtc/community/profile/update`. Version: `0.1`.
#[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())
}
}
}
/**
A community profile **as read**: every member of CommunityProfile, plus the immutable identity a reader needs and an update must never set.
CommunityProfile is the update-facing view and omits `communityDid` on purpose, so that a patch cannot re-point a community's identity. That is right for a payload and wrong for a response: a client holding a profile has no other way to learn which DID to verify that community's credentials against, and `community/profile/show` returning the update-facing view left the one member a consumer most needs undefined.
So reads get this and updates keep CommunityProfile. The split is the point — the immutability of `communityDid` is enforced by it being absent from the payload, not by prose asking implementers not to honour it.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "CommunityProfileView",
/// "description": "\nA community profile **as read**: every member of CommunityProfile, plus the immutable identity a reader needs and an update must never set.\n\nCommunityProfile is the update-facing view and omits `communityDid` on purpose, so that a patch cannot re-point a community's identity. That is right for a payload and wrong for a response: a client holding a profile has no other way to learn which DID to verify that community's credentials against, and `community/profile/show` returning the update-facing view left the one member a consumer most needs undefined.\n\nSo reads get this and updates keep CommunityProfile. The split is the point — the immutability of `communityDid` is enforced by it being absent from the payload, not by prose asking implementers not to honour it.",
/// "type": "object",
/// "required": [
/// "communityDid",
/// "language",
/// "name"
/// ],
/// "properties": {
/// "communityDid": {
/// "description": "The community's own DID — the identifier every credential it issues names as `issuer`, and the one a member's credential binds them to. Immutable: set when the community is created and not settable through an update.",
/// "type": "string",
/// "minLength": 1
/// },
/// "contactEmail": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "createdAt": {
/// "description": "When the community was created. Immutable, like `communityDid`.",
/// "type": "string",
/// "format": "date-time"
/// },
/// "description": {
/// "type": "string",
/// "maxLength": 1024
/// },
/// "extensions": {
/// "description": "Opaque community-defined extension bag.",
/// "type": "object"
/// },
/// "language": {
/// "type": "string",
/// "minLength": 1
/// },
/// "logoUrl": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "name": {
/// "type": "string",
/// "maxLength": 256,
/// "minLength": 1
/// },
/// "personhood": {
/// "description": "What this community's governance asserts about the personhood of its members.",
/// "$ref": "#/definitions/PersonhoodGovernance"
/// },
/// "publicUrl": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "registryStatus": {
/// "description": "Trust-registry reachability. Populated on reads; not settable.",
/// "type": "string",
/// "enum": [
/// "active",
/// "degraded"
/// ]
/// },
/// "relationshipIdentifierDefault": {
/// "description": "Which identifier form the community expects members to issue relationship credentials under. `attributed` means the member's membership DID, so an edge names them; `pairwise` means a relationship DID unique to each counterparty. A declaration, not an enforcement: the member still chooses per relationship, and a community that wants to require one form does so in its own policy. Absent means the community has not declared one; implementations default to `pairwise`, matching the DTG Credentials recommendation.",
/// "type": "string",
/// "enum": [
/// "attributed",
/// "pairwise"
/// ]
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "communityProfileView"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct CommunityProfileView {
///The community's own DID — the identifier every credential it issues names as `issuer`, and the one a member's credential binds them to. Immutable: set when the community is created and not settable through an update.
#[serde(rename = "communityDid")]
pub community_did: CommunityProfileViewCommunityDid,
#[serde(
rename = "contactEmail",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub contact_email: ::std::option::Option<::std::string::String>,
///When the community was created. Immutable, like `communityDid`.
#[serde(
rename = "createdAt",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub created_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<CommunityProfileViewDescription>,
///Opaque community-defined extension bag.
#[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
pub extensions: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
pub language: CommunityProfileViewLanguage,
#[serde(
rename = "logoUrl",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub logo_url: ::std::option::Option<::std::string::String>,
pub name: CommunityProfileViewName,
///What this community's governance asserts about the personhood of its members.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub personhood: ::std::option::Option<PersonhoodGovernance>,
#[serde(
rename = "publicUrl",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub public_url: ::std::option::Option<::std::string::String>,
///Trust-registry reachability. Populated on reads; not settable.
#[serde(
rename = "registryStatus",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub registry_status: ::std::option::Option<CommunityProfileViewRegistryStatus>,
///Which identifier form the community expects members to issue relationship credentials under. `attributed` means the member's membership DID, so an edge names them; `pairwise` means a relationship DID unique to each counterparty. A declaration, not an enforcement: the member still chooses per relationship, and a community that wants to require one form does so in its own policy. Absent means the community has not declared one; implementations default to `pairwise`, matching the DTG Credentials recommendation.
#[serde(
rename = "relationshipIdentifierDefault",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub relationship_identifier_default:
::std::option::Option<CommunityProfileViewRelationshipIdentifierDefault>,
}
impl CommunityProfileView {
pub fn builder() -> builder::CommunityProfileView {
Default::default()
}
}
///The community's own DID — the identifier every credential it issues names as `issuer`, and the one a member's credential binds them to. Immutable: set when the community is created and not settable through an update.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The community's own DID — the identifier every credential it issues names as `issuer`, and the one a member's credential binds them to. Immutable: set when the community is created and not settable through an update.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct CommunityProfileViewCommunityDid(::std::string::String);
impl ::std::ops::Deref for CommunityProfileViewCommunityDid {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<CommunityProfileViewCommunityDid> for ::std::string::String {
fn from(value: CommunityProfileViewCommunityDid) -> Self {
value.0
}
}
impl ::std::str::FromStr for CommunityProfileViewCommunityDid {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for CommunityProfileViewCommunityDid {
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 CommunityProfileViewCommunityDid {
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 CommunityProfileViewCommunityDid {
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 CommunityProfileViewCommunityDid {
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())
})
}
}
///`CommunityProfileViewDescription`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "maxLength": 1024
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct CommunityProfileViewDescription(::std::string::String);
impl ::std::ops::Deref for CommunityProfileViewDescription {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<CommunityProfileViewDescription> for ::std::string::String {
fn from(value: CommunityProfileViewDescription) -> Self {
value.0
}
}
impl ::std::str::FromStr for CommunityProfileViewDescription {
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 CommunityProfileViewDescription {
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 CommunityProfileViewDescription {
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 CommunityProfileViewDescription {
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 CommunityProfileViewDescription {
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())
})
}
}
///`CommunityProfileViewLanguage`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct CommunityProfileViewLanguage(::std::string::String);
impl ::std::ops::Deref for CommunityProfileViewLanguage {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<CommunityProfileViewLanguage> for ::std::string::String {
fn from(value: CommunityProfileViewLanguage) -> Self {
value.0
}
}
impl ::std::str::FromStr for CommunityProfileViewLanguage {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for CommunityProfileViewLanguage {
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 CommunityProfileViewLanguage {
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 CommunityProfileViewLanguage {
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 CommunityProfileViewLanguage {
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())
})
}
}
///`CommunityProfileViewName`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "maxLength": 256,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct CommunityProfileViewName(::std::string::String);
impl ::std::ops::Deref for CommunityProfileViewName {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<CommunityProfileViewName> for ::std::string::String {
fn from(value: CommunityProfileViewName) -> Self {
value.0
}
}
impl ::std::str::FromStr for CommunityProfileViewName {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 256usize {
return Err("longer than 256 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for CommunityProfileViewName {
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 CommunityProfileViewName {
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 CommunityProfileViewName {
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 CommunityProfileViewName {
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())
})
}
}
///Trust-registry reachability. Populated on reads; not settable.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Trust-registry reachability. Populated on reads; not settable.",
/// "type": "string",
/// "enum": [
/// "active",
/// "degraded"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum CommunityProfileViewRegistryStatus {
#[serde(rename = "active")]
Active,
#[serde(rename = "degraded")]
Degraded,
}
impl ::std::fmt::Display for CommunityProfileViewRegistryStatus {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Active => f.write_str("active"),
Self::Degraded => f.write_str("degraded"),
}
}
}
impl ::std::str::FromStr for CommunityProfileViewRegistryStatus {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"active" => Ok(Self::Active),
"degraded" => Ok(Self::Degraded),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for CommunityProfileViewRegistryStatus {
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 CommunityProfileViewRegistryStatus {
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 CommunityProfileViewRegistryStatus {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///Which identifier form the community expects members to issue relationship credentials under. `attributed` means the member's membership DID, so an edge names them; `pairwise` means a relationship DID unique to each counterparty. A declaration, not an enforcement: the member still chooses per relationship, and a community that wants to require one form does so in its own policy. Absent means the community has not declared one; implementations default to `pairwise`, matching the DTG Credentials recommendation.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Which identifier form the community expects members to issue relationship credentials under. `attributed` means the member's membership DID, so an edge names them; `pairwise` means a relationship DID unique to each counterparty. A declaration, not an enforcement: the member still chooses per relationship, and a community that wants to require one form does so in its own policy. Absent means the community has not declared one; implementations default to `pairwise`, matching the DTG Credentials recommendation.",
/// "type": "string",
/// "enum": [
/// "attributed",
/// "pairwise"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum CommunityProfileViewRelationshipIdentifierDefault {
#[serde(rename = "attributed")]
Attributed,
#[serde(rename = "pairwise")]
Pairwise,
}
impl ::std::fmt::Display for CommunityProfileViewRelationshipIdentifierDefault {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Attributed => f.write_str("attributed"),
Self::Pairwise => f.write_str("pairwise"),
}
}
}
impl ::std::str::FromStr for CommunityProfileViewRelationshipIdentifierDefault {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"attributed" => Ok(Self::Attributed),
"pairwise" => Ok(Self::Pairwise),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for CommunityProfileViewRelationshipIdentifierDefault {
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 CommunityProfileViewRelationshipIdentifierDefault
{
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 CommunityProfileViewRelationshipIdentifierDefault
{
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///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.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Ext",
/// "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.",
/// "type": "object",
/// "minProperties": 1,
/// "additionalProperties": true,
/// "propertyNames": {
/// "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
/// }
///}
/// ```
/// </details>
#[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`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
///}
/// ```
/// </details>
#[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())
})
}
}
///`Payload`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/vtc/community/profile/update/0.1",
/// "title": "Payload",
/// "type": "object",
/// "properties": {
/// "contactEmail": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "description": {
/// "type": "string",
/// "maxLength": 1024
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "extensions": {
/// "description": "Opaque community-defined extension bag (maintainer-capped).",
/// "type": "object"
/// },
/// "language": {
/// "type": "string",
/// "minLength": 1
/// },
/// "logoUrl": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "name": {
/// "type": "string",
/// "maxLength": 256,
/// "minLength": 1
/// },
/// "personhood": {
/// "description": "Set the community's published personhood position. See `CommunityProfile.personhood` in the `vtc/_shared/0.1/community` schema. Replaces the whole object — a partial update would leave a verifier unable to tell an unset member from a cleared one. Omit to leave it unchanged.",
/// "$ref": "#/definitions/PersonhoodGovernance"
/// },
/// "publicUrl": {
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "relationshipIdentifierDefault": {
/// "description": "Set the community's declared relationship-identifier default. See `CommunityProfile.relationshipIdentifierDefault` in the `vtc/_shared/0.1/community` schema. Omit to leave it unchanged.",
/// "type": "string",
/// "enum": [
/// "attributed",
/// "pairwise"
/// ]
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
#[serde(
rename = "contactEmail",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub contact_email: ::std::option::Option<::std::string::String>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub description: ::std::option::Option<PayloadDescription>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///Opaque community-defined extension bag (maintainer-capped).
#[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
pub extensions: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub language: ::std::option::Option<PayloadLanguage>,
#[serde(
rename = "logoUrl",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub logo_url: ::std::option::Option<::std::string::String>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub name: ::std::option::Option<PayloadName>,
///Set the community's published personhood position. See `CommunityProfile.personhood` in the `vtc/_shared/0.1/community` schema. Replaces the whole object — a partial update would leave a verifier unable to tell an unset member from a cleared one. Omit to leave it unchanged.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub personhood: ::std::option::Option<PersonhoodGovernance>,
#[serde(
rename = "publicUrl",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub public_url: ::std::option::Option<::std::string::String>,
///Set the community's declared relationship-identifier default. See `CommunityProfile.relationshipIdentifierDefault` in the `vtc/_shared/0.1/community` schema. Omit to leave it unchanged.
#[serde(
rename = "relationshipIdentifierDefault",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub relationship_identifier_default:
::std::option::Option<PayloadRelationshipIdentifierDefault>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
contact_email: Default::default(),
description: Default::default(),
ext: Default::default(),
extensions: Default::default(),
language: Default::default(),
logo_url: Default::default(),
name: Default::default(),
personhood: Default::default(),
public_url: Default::default(),
relationship_identifier_default: Default::default(),
}
}
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///`PayloadDescription`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "maxLength": 1024
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadDescription(::std::string::String);
impl ::std::ops::Deref for PayloadDescription {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadDescription> for ::std::string::String {
fn from(value: PayloadDescription) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadDescription {
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 PayloadDescription {
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 PayloadDescription {
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 PayloadDescription {
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 PayloadDescription {
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())
})
}
}
///`PayloadLanguage`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadLanguage(::std::string::String);
impl ::std::ops::Deref for PayloadLanguage {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadLanguage> for ::std::string::String {
fn from(value: PayloadLanguage) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadLanguage {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PayloadLanguage {
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 PayloadLanguage {
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 PayloadLanguage {
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 PayloadLanguage {
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())
})
}
}
///`PayloadName`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "maxLength": 256,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadName(::std::string::String);
impl ::std::ops::Deref for PayloadName {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadName> for ::std::string::String {
fn from(value: PayloadName) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadName {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 256usize {
return Err("longer than 256 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PayloadName {
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 PayloadName {
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 PayloadName {
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 PayloadName {
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())
})
}
}
///Set the community's declared relationship-identifier default. See `CommunityProfile.relationshipIdentifierDefault` in the `vtc/_shared/0.1/community` schema. Omit to leave it unchanged.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Set the community's declared relationship-identifier default. See `CommunityProfile.relationshipIdentifierDefault` in the `vtc/_shared/0.1/community` schema. Omit to leave it unchanged.",
/// "type": "string",
/// "enum": [
/// "attributed",
/// "pairwise"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum PayloadRelationshipIdentifierDefault {
#[serde(rename = "attributed")]
Attributed,
#[serde(rename = "pairwise")]
Pairwise,
}
impl ::std::fmt::Display for PayloadRelationshipIdentifierDefault {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Attributed => f.write_str("attributed"),
Self::Pairwise => f.write_str("pairwise"),
}
}
}
impl ::std::str::FromStr for PayloadRelationshipIdentifierDefault {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"attributed" => Ok(Self::Attributed),
"pairwise" => Ok(Self::Pairwise),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for PayloadRelationshipIdentifierDefault {
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 PayloadRelationshipIdentifierDefault {
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 PayloadRelationshipIdentifierDefault {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
/**
A community's published position on personhood.
DTG Credentials §Personhood Credentials places PHC status here rather than in the credential — "PHC status is determined by governance and trust registries, not by credential structure" — so a verifier deciding whether a VMC carries personhood weight reads this, not the credential's type array. §Governance Considerations item 1 makes the acceptable-IDVP list the community's to define and publish.
Every member is a declaration, not an enforcement: what a community actually accepts is decided by its own policy. Absent means the community has not published a position, which is not the same as asserting the negative.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "PersonhoodGovernance",
/// "description": "\nA community's published position on personhood.\n\nDTG Credentials §Personhood Credentials places PHC status here rather than in the credential — \"PHC status is determined by governance and trust registries, not by credential structure\" — so a verifier deciding whether a VMC carries personhood weight reads this, not the credential's type array. §Governance Considerations item 1 makes the acceptable-IDVP list the community's to define and publish.\n\nEvery member is a declaration, not an enforcement: what a community actually accepts is decided by its own policy. Absent means the community has not published a position, which is not the same as asserting the negative.",
/// "type": "object",
/// "properties": {
/// "acceptedIdvps": {
/// "description": "DIDs of the identity-verification providers whose credentials this community accepts as personhood evidence. A community that vets its own members in person lists its own community DID here — it is acting as its own IDVP, which §IDVC permits. An empty list means no list has been published, not that everything is accepted.",
/// "type": "array",
/// "items": {
/// "type": "string",
/// "minLength": 1
/// }
/// },
/// "governanceFrameworkUrl": {
/// "description": "Where the governance framework these assertions refer to can be read.",
/// "type": [
/// "string",
/// "null"
/// ]
/// },
/// "realHuman": {
/// "description": "Governance requires that members are real humans. Defaults to `false` when absent: a community that has not considered the question asserts nothing, which is the only safe default for a claim a verifier may rely on.",
/// "type": "boolean"
/// },
/// "singleMembership": {
/// "description": "Governance requires that each person holds at most one membership in **this** community. Per-community by definition — the glossary says \"exactly one membership in that VTC\" — so a single community can satisfy it without any network above it.",
/// "type": "boolean"
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "personhoodGovernance"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct PersonhoodGovernance {
///DIDs of the identity-verification providers whose credentials this community accepts as personhood evidence. A community that vets its own members in person lists its own community DID here — it is acting as its own IDVP, which §IDVC permits. An empty list means no list has been published, not that everything is accepted.
#[serde(
rename = "acceptedIdvps",
default,
skip_serializing_if = "::std::vec::Vec::is_empty"
)]
pub accepted_idvps: ::std::vec::Vec<PersonhoodGovernanceAcceptedIdvpsItem>,
///Where the governance framework these assertions refer to can be read.
#[serde(
rename = "governanceFrameworkUrl",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub governance_framework_url: ::std::option::Option<::std::string::String>,
///Governance requires that members are real humans. Defaults to `false` when absent: a community that has not considered the question asserts nothing, which is the only safe default for a claim a verifier may rely on.
#[serde(
rename = "realHuman",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub real_human: ::std::option::Option<bool>,
///Governance requires that each person holds at most one membership in **this** community. Per-community by definition — the glossary says "exactly one membership in that VTC" — so a single community can satisfy it without any network above it.
#[serde(
rename = "singleMembership",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub single_membership: ::std::option::Option<bool>,
}
impl ::std::default::Default for PersonhoodGovernance {
fn default() -> Self {
Self {
accepted_idvps: Default::default(),
governance_framework_url: Default::default(),
real_human: Default::default(),
single_membership: Default::default(),
}
}
}
impl PersonhoodGovernance {
pub fn builder() -> builder::PersonhoodGovernance {
Default::default()
}
}
///`PersonhoodGovernanceAcceptedIdvpsItem`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PersonhoodGovernanceAcceptedIdvpsItem(::std::string::String);
impl ::std::ops::Deref for PersonhoodGovernanceAcceptedIdvpsItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PersonhoodGovernanceAcceptedIdvpsItem> for ::std::string::String {
fn from(value: PersonhoodGovernanceAcceptedIdvpsItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for PersonhoodGovernanceAcceptedIdvpsItem {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PersonhoodGovernanceAcceptedIdvpsItem {
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 PersonhoodGovernanceAcceptedIdvpsItem {
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 PersonhoodGovernanceAcceptedIdvpsItem {
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 PersonhoodGovernanceAcceptedIdvpsItem {
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())
})
}
}
///`Response`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "type": "object",
/// "required": [
/// "profile"
/// ],
/// "properties": {
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "fieldsChanged": {
/// "description": "Names of the profile members this update actually changed, in the wire spelling. Empty when the submitted values all matched what was already stored. Lets a caller distinguish a no-op from an applied change without diffing the returned profile against the one it sent.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "profile": {
/// "description": "The community's profile as read, including the immutable `communityDid` an update cannot set.",
/// "$ref": "#/definitions/CommunityProfileView"
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "response"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///Names of the profile members this update actually changed, in the wire spelling. Empty when the submitted values all matched what was already stored. Lets a caller distinguish a no-op from an applied change without diffing the returned profile against the one it sent.
#[serde(
rename = "fieldsChanged",
default,
skip_serializing_if = "::std::vec::Vec::is_empty"
)]
pub fields_changed: ::std::vec::Vec<::std::string::String>,
///The community's profile as read, including the immutable `communityDid` an update cannot set.
pub profile: CommunityProfileView,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct CommunityProfileView {
community_did:
::std::result::Result<super::CommunityProfileViewCommunityDid, ::std::string::String>,
contact_email: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
created_at: ::std::result::Result<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
::std::string::String,
>,
description: ::std::result::Result<
::std::option::Option<super::CommunityProfileViewDescription>,
::std::string::String,
>,
extensions: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
language: ::std::result::Result<super::CommunityProfileViewLanguage, ::std::string::String>,
logo_url: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
name: ::std::result::Result<super::CommunityProfileViewName, ::std::string::String>,
personhood: ::std::result::Result<
::std::option::Option<super::PersonhoodGovernance>,
::std::string::String,
>,
public_url: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
registry_status: ::std::result::Result<
::std::option::Option<super::CommunityProfileViewRegistryStatus>,
::std::string::String,
>,
relationship_identifier_default: ::std::result::Result<
::std::option::Option<super::CommunityProfileViewRelationshipIdentifierDefault>,
::std::string::String,
>,
}
impl ::std::default::Default for CommunityProfileView {
fn default() -> Self {
Self {
community_did: Err("no value supplied for community_did".to_string()),
contact_email: Ok(Default::default()),
created_at: Ok(Default::default()),
description: Ok(Default::default()),
extensions: Ok(Default::default()),
language: Err("no value supplied for language".to_string()),
logo_url: Ok(Default::default()),
name: Err("no value supplied for name".to_string()),
personhood: Ok(Default::default()),
public_url: Ok(Default::default()),
registry_status: Ok(Default::default()),
relationship_identifier_default: Ok(Default::default()),
}
}
}
impl CommunityProfileView {
pub fn community_did<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::CommunityProfileViewCommunityDid>,
T::Error: ::std::fmt::Display,
{
self.community_did = value
.try_into()
.map_err(|e| format!("error converting supplied value for community_did: {e}"));
self
}
pub fn contact_email<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.contact_email = value
.try_into()
.map_err(|e| format!("error converting supplied value for contact_email: {e}"));
self
}
pub fn created_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
>,
T::Error: ::std::fmt::Display,
{
self.created_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for created_at: {e}"));
self
}
pub fn description<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<super::CommunityProfileViewDescription>,
>,
T::Error: ::std::fmt::Display,
{
self.description = value
.try_into()
.map_err(|e| format!("error converting supplied value for description: {e}"));
self
}
pub fn extensions<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.extensions = value
.try_into()
.map_err(|e| format!("error converting supplied value for extensions: {e}"));
self
}
pub fn language<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::CommunityProfileViewLanguage>,
T::Error: ::std::fmt::Display,
{
self.language = value
.try_into()
.map_err(|e| format!("error converting supplied value for language: {e}"));
self
}
pub fn logo_url<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.logo_url = value
.try_into()
.map_err(|e| format!("error converting supplied value for logo_url: {e}"));
self
}
pub fn name<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::CommunityProfileViewName>,
T::Error: ::std::fmt::Display,
{
self.name = value
.try_into()
.map_err(|e| format!("error converting supplied value for name: {e}"));
self
}
pub fn personhood<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PersonhoodGovernance>>,
T::Error: ::std::fmt::Display,
{
self.personhood = value
.try_into()
.map_err(|e| format!("error converting supplied value for personhood: {e}"));
self
}
pub fn public_url<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.public_url = value
.try_into()
.map_err(|e| format!("error converting supplied value for public_url: {e}"));
self
}
pub fn registry_status<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<super::CommunityProfileViewRegistryStatus>,
>,
T::Error: ::std::fmt::Display,
{
self.registry_status = value
.try_into()
.map_err(|e| format!("error converting supplied value for registry_status: {e}"));
self
}
pub fn relationship_identifier_default<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<super::CommunityProfileViewRelationshipIdentifierDefault>,
>,
T::Error: ::std::fmt::Display,
{
self.relationship_identifier_default = value.try_into().map_err(|e| {
format!("error converting supplied value for relationship_identifier_default: {e}")
});
self
}
}
impl ::std::convert::TryFrom<CommunityProfileView> for super::CommunityProfileView {
type Error = super::error::ConversionError;
fn try_from(
value: CommunityProfileView,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
community_did: value.community_did?,
contact_email: value.contact_email?,
created_at: value.created_at?,
description: value.description?,
extensions: value.extensions?,
language: value.language?,
logo_url: value.logo_url?,
name: value.name?,
personhood: value.personhood?,
public_url: value.public_url?,
registry_status: value.registry_status?,
relationship_identifier_default: value.relationship_identifier_default?,
})
}
}
impl ::std::convert::From<super::CommunityProfileView> for CommunityProfileView {
fn from(value: super::CommunityProfileView) -> Self {
Self {
community_did: Ok(value.community_did),
contact_email: Ok(value.contact_email),
created_at: Ok(value.created_at),
description: Ok(value.description),
extensions: Ok(value.extensions),
language: Ok(value.language),
logo_url: Ok(value.logo_url),
name: Ok(value.name),
personhood: Ok(value.personhood),
public_url: Ok(value.public_url),
registry_status: Ok(value.registry_status),
relationship_identifier_default: Ok(value.relationship_identifier_default),
}
}
}
#[derive(Clone, Debug)]
pub struct Payload {
contact_email: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
description: ::std::result::Result<
::std::option::Option<super::PayloadDescription>,
::std::string::String,
>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
extensions: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
language: ::std::result::Result<
::std::option::Option<super::PayloadLanguage>,
::std::string::String,
>,
logo_url: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
name:
::std::result::Result<::std::option::Option<super::PayloadName>, ::std::string::String>,
personhood: ::std::result::Result<
::std::option::Option<super::PersonhoodGovernance>,
::std::string::String,
>,
public_url: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
relationship_identifier_default: ::std::result::Result<
::std::option::Option<super::PayloadRelationshipIdentifierDefault>,
::std::string::String,
>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
contact_email: Ok(Default::default()),
description: Ok(Default::default()),
ext: Ok(Default::default()),
extensions: Ok(Default::default()),
language: Ok(Default::default()),
logo_url: Ok(Default::default()),
name: Ok(Default::default()),
personhood: Ok(Default::default()),
public_url: Ok(Default::default()),
relationship_identifier_default: Ok(Default::default()),
}
}
}
impl Payload {
pub fn contact_email<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.contact_email = value
.try_into()
.map_err(|e| format!("error converting supplied value for contact_email: {e}"));
self
}
pub fn description<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadDescription>>,
T::Error: ::std::fmt::Display,
{
self.description = value
.try_into()
.map_err(|e| format!("error converting supplied value for description: {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 extensions<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.extensions = value
.try_into()
.map_err(|e| format!("error converting supplied value for extensions: {e}"));
self
}
pub fn language<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadLanguage>>,
T::Error: ::std::fmt::Display,
{
self.language = value
.try_into()
.map_err(|e| format!("error converting supplied value for language: {e}"));
self
}
pub fn logo_url<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.logo_url = value
.try_into()
.map_err(|e| format!("error converting supplied value for logo_url: {e}"));
self
}
pub fn name<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadName>>,
T::Error: ::std::fmt::Display,
{
self.name = value
.try_into()
.map_err(|e| format!("error converting supplied value for name: {e}"));
self
}
pub fn personhood<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PersonhoodGovernance>>,
T::Error: ::std::fmt::Display,
{
self.personhood = value
.try_into()
.map_err(|e| format!("error converting supplied value for personhood: {e}"));
self
}
pub fn public_url<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.public_url = value
.try_into()
.map_err(|e| format!("error converting supplied value for public_url: {e}"));
self
}
pub fn relationship_identifier_default<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<super::PayloadRelationshipIdentifierDefault>,
>,
T::Error: ::std::fmt::Display,
{
self.relationship_identifier_default = value.try_into().map_err(|e| {
format!("error converting supplied value for relationship_identifier_default: {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 {
contact_email: value.contact_email?,
description: value.description?,
ext: value.ext?,
extensions: value.extensions?,
language: value.language?,
logo_url: value.logo_url?,
name: value.name?,
personhood: value.personhood?,
public_url: value.public_url?,
relationship_identifier_default: value.relationship_identifier_default?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
contact_email: Ok(value.contact_email),
description: Ok(value.description),
ext: Ok(value.ext),
extensions: Ok(value.extensions),
language: Ok(value.language),
logo_url: Ok(value.logo_url),
name: Ok(value.name),
personhood: Ok(value.personhood),
public_url: Ok(value.public_url),
relationship_identifier_default: Ok(value.relationship_identifier_default),
}
}
}
#[derive(Clone, Debug)]
pub struct PersonhoodGovernance {
accepted_idvps: ::std::result::Result<
::std::vec::Vec<super::PersonhoodGovernanceAcceptedIdvpsItem>,
::std::string::String,
>,
governance_framework_url: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
real_human: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
single_membership:
::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
}
impl ::std::default::Default for PersonhoodGovernance {
fn default() -> Self {
Self {
accepted_idvps: Ok(Default::default()),
governance_framework_url: Ok(Default::default()),
real_human: Ok(Default::default()),
single_membership: Ok(Default::default()),
}
}
}
impl PersonhoodGovernance {
pub fn accepted_idvps<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::vec::Vec<super::PersonhoodGovernanceAcceptedIdvpsItem>,
>,
T::Error: ::std::fmt::Display,
{
self.accepted_idvps = value
.try_into()
.map_err(|e| format!("error converting supplied value for accepted_idvps: {e}"));
self
}
pub fn governance_framework_url<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.governance_framework_url = value.try_into().map_err(|e| {
format!("error converting supplied value for governance_framework_url: {e}")
});
self
}
pub fn real_human<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<bool>>,
T::Error: ::std::fmt::Display,
{
self.real_human = value
.try_into()
.map_err(|e| format!("error converting supplied value for real_human: {e}"));
self
}
pub fn single_membership<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<bool>>,
T::Error: ::std::fmt::Display,
{
self.single_membership = value
.try_into()
.map_err(|e| format!("error converting supplied value for single_membership: {e}"));
self
}
}
impl ::std::convert::TryFrom<PersonhoodGovernance> for super::PersonhoodGovernance {
type Error = super::error::ConversionError;
fn try_from(
value: PersonhoodGovernance,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
accepted_idvps: value.accepted_idvps?,
governance_framework_url: value.governance_framework_url?,
real_human: value.real_human?,
single_membership: value.single_membership?,
})
}
}
impl ::std::convert::From<super::PersonhoodGovernance> for PersonhoodGovernance {
fn from(value: super::PersonhoodGovernance) -> Self {
Self {
accepted_idvps: Ok(value.accepted_idvps),
governance_framework_url: Ok(value.governance_framework_url),
real_human: Ok(value.real_human),
single_membership: Ok(value.single_membership),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
fields_changed:
::std::result::Result<::std::vec::Vec<::std::string::String>, ::std::string::String>,
profile: ::std::result::Result<super::CommunityProfileView, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
fields_changed: Ok(Default::default()),
profile: Err("no value supplied for profile".to_string()),
}
}
}
impl Response {
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 fields_changed<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.fields_changed = value
.try_into()
.map_err(|e| format!("error converting supplied value for fields_changed: {e}"));
self
}
pub fn profile<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::CommunityProfileView>,
T::Error: ::std::fmt::Display,
{
self.profile = value
.try_into()
.map_err(|e| format!("error converting supplied value for profile: {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 {
ext: value.ext?,
fields_changed: value.fields_changed?,
profile: value.profile?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
ext: Ok(value.ext),
fields_changed: Ok(value.fields_changed),
profile: Ok(value.profile),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/vtc/community/profile/update/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(
"{\n \"$defs\": {\n \"CommunityProfileView\": {\n \"$anchor\": \"communityProfileView\",\n \"additionalProperties\": false,\n \"description\": \"A community profile **as read**: every member of CommunityProfile, plus the immutable identity a reader needs and an update must never set.\\n\\nCommunityProfile is the update-facing view and omits `communityDid` on purpose, so that a patch cannot re-point a community's identity. That is right for a payload and wrong for a response: a client holding a profile has no other way to learn which DID to verify that community's credentials against, and `community/profile/show` returning the update-facing view left the one member a consumer most needs undefined.\\n\\nSo reads get this and updates keep CommunityProfile. The split is the point — the immutability of `communityDid` is enforced by it being absent from the payload, not by prose asking implementers not to honour it.\",\n \"properties\": {\n \"communityDid\": {\n \"description\": \"The community's own DID — the identifier every credential it issues names as `issuer`, and the one a member's credential binds them to. Immutable: set when the community is created and not settable through an update.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"contactEmail\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"createdAt\": {\n \"description\": \"When the community was created. Immutable, like `communityDid`.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"description\": {\n \"maxLength\": 1024,\n \"type\": \"string\"\n },\n \"extensions\": {\n \"description\": \"Opaque community-defined extension bag.\",\n \"type\": \"object\"\n },\n \"language\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"logoUrl\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"name\": {\n \"maxLength\": 256,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"personhood\": {\n \"$ref\": \"#/$defs/PersonhoodGovernance\",\n \"description\": \"What this community's governance asserts about the personhood of its members.\"\n },\n \"publicUrl\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"registryStatus\": {\n \"description\": \"Trust-registry reachability. Populated on reads; not settable.\",\n \"enum\": [\n \"active\",\n \"degraded\"\n ],\n \"type\": \"string\"\n },\n \"relationshipIdentifierDefault\": {\n \"description\": \"Which identifier form the community expects members to issue relationship credentials under. `attributed` means the member's membership DID, so an edge names them; `pairwise` means a relationship DID unique to each counterparty. A declaration, not an enforcement: the member still chooses per relationship, and a community that wants to require one form does so in its own policy. Absent means the community has not declared one; implementations default to `pairwise`, matching the DTG Credentials recommendation.\",\n \"enum\": [\n \"attributed\",\n \"pairwise\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"communityDid\",\n \"name\",\n \"language\"\n ],\n \"title\": \"CommunityProfileView\",\n \"type\": \"object\"\n },\n \"Ext\": {\n \"additionalProperties\": true,\n \"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.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"PersonhoodGovernance\": {\n \"$anchor\": \"personhoodGovernance\",\n \"additionalProperties\": false,\n \"description\": \"A community's published position on personhood.\\n\\nDTG Credentials §Personhood Credentials places PHC status here rather than in the credential — \\\"PHC status is determined by governance and trust registries, not by credential structure\\\" — so a verifier deciding whether a VMC carries personhood weight reads this, not the credential's type array. §Governance Considerations item 1 makes the acceptable-IDVP list the community's to define and publish.\\n\\nEvery member is a declaration, not an enforcement: what a community actually accepts is decided by its own policy. Absent means the community has not published a position, which is not the same as asserting the negative.\",\n \"properties\": {\n \"acceptedIdvps\": {\n \"description\": \"DIDs of the identity-verification providers whose credentials this community accepts as personhood evidence. A community that vets its own members in person lists its own community DID here — it is acting as its own IDVP, which §IDVC permits. An empty list means no list has been published, not that everything is accepted.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"governanceFrameworkUrl\": {\n \"description\": \"Where the governance framework these assertions refer to can be read.\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"realHuman\": {\n \"description\": \"Governance requires that members are real humans. Defaults to `false` when absent: a community that has not considered the question asserts nothing, which is the only safe default for a claim a verifier may rely on.\",\n \"type\": \"boolean\"\n },\n \"singleMembership\": {\n \"description\": \"Governance requires that each person holds at most one membership in **this** community. Per-community by definition — the glossary says \\\"exactly one membership in that VTC\\\" — so a single community can satisfy it without any network above it.\",\n \"type\": \"boolean\"\n }\n },\n \"title\": \"PersonhoodGovernance\",\n \"type\": \"object\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"fieldsChanged\": {\n \"description\": \"Names of the profile members this update actually changed, in the wire spelling. Empty when the submitted values all matched what was already stored. Lets a caller distinguish a no-op from an applied change without diffing the returned profile against the one it sent.\",\n \"items\": {\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"profile\": {\n \"$ref\": \"#/$defs/CommunityProfileView\",\n \"description\": \"The community's profile as read, including the immutable `communityDid` an update cannot set.\"\n }\n },\n \"required\": [\n \"profile\"\n ],\n \"title\": \"VTC Community Profile Update — response payload\",\n \"type\": \"object\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/vtc/community/profile/update/0.1\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"properties\": {\n \"contactEmail\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"description\": {\n \"maxLength\": 1024,\n \"type\": \"string\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"extensions\": {\n \"description\": \"Opaque community-defined extension bag (maintainer-capped).\",\n \"type\": \"object\"\n },\n \"language\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"logoUrl\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"name\": {\n \"maxLength\": 256,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"personhood\": {\n \"$ref\": \"#/$defs/PersonhoodGovernance\",\n \"description\": \"Set the community's published personhood position. See `CommunityProfile.personhood` in the `vtc/_shared/0.1/community` schema. Replaces the whole object — a partial update would leave a verifier unable to tell an unset member from a cleared one. Omit to leave it unchanged.\"\n },\n \"publicUrl\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"relationshipIdentifierDefault\": {\n \"description\": \"Set the community's declared relationship-identifier default. See `CommunityProfile.relationshipIdentifierDefault` in the `vtc/_shared/0.1/community` schema. Omit to leave it unchanged.\",\n \"enum\": [\n \"attributed\",\n \"pairwise\"\n ],\n \"type\": \"string\"\n }\n },\n \"title\": \"VTC Community Profile Update — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/vtc/community/profile/update/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(
"{\n \"$defs\": {\n \"CommunityProfileView\": {\n \"$anchor\": \"communityProfileView\",\n \"additionalProperties\": false,\n \"description\": \"A community profile **as read**: every member of CommunityProfile, plus the immutable identity a reader needs and an update must never set.\\n\\nCommunityProfile is the update-facing view and omits `communityDid` on purpose, so that a patch cannot re-point a community's identity. That is right for a payload and wrong for a response: a client holding a profile has no other way to learn which DID to verify that community's credentials against, and `community/profile/show` returning the update-facing view left the one member a consumer most needs undefined.\\n\\nSo reads get this and updates keep CommunityProfile. The split is the point — the immutability of `communityDid` is enforced by it being absent from the payload, not by prose asking implementers not to honour it.\",\n \"properties\": {\n \"communityDid\": {\n \"description\": \"The community's own DID — the identifier every credential it issues names as `issuer`, and the one a member's credential binds them to. Immutable: set when the community is created and not settable through an update.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"contactEmail\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"createdAt\": {\n \"description\": \"When the community was created. Immutable, like `communityDid`.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"description\": {\n \"maxLength\": 1024,\n \"type\": \"string\"\n },\n \"extensions\": {\n \"description\": \"Opaque community-defined extension bag.\",\n \"type\": \"object\"\n },\n \"language\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"logoUrl\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"name\": {\n \"maxLength\": 256,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"personhood\": {\n \"$ref\": \"#/$defs/PersonhoodGovernance\",\n \"description\": \"What this community's governance asserts about the personhood of its members.\"\n },\n \"publicUrl\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"registryStatus\": {\n \"description\": \"Trust-registry reachability. Populated on reads; not settable.\",\n \"enum\": [\n \"active\",\n \"degraded\"\n ],\n \"type\": \"string\"\n },\n \"relationshipIdentifierDefault\": {\n \"description\": \"Which identifier form the community expects members to issue relationship credentials under. `attributed` means the member's membership DID, so an edge names them; `pairwise` means a relationship DID unique to each counterparty. A declaration, not an enforcement: the member still chooses per relationship, and a community that wants to require one form does so in its own policy. Absent means the community has not declared one; implementations default to `pairwise`, matching the DTG Credentials recommendation.\",\n \"enum\": [\n \"attributed\",\n \"pairwise\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"communityDid\",\n \"name\",\n \"language\"\n ],\n \"title\": \"CommunityProfileView\",\n \"type\": \"object\"\n },\n \"Ext\": {\n \"additionalProperties\": true,\n \"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.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"PersonhoodGovernance\": {\n \"$anchor\": \"personhoodGovernance\",\n \"additionalProperties\": false,\n \"description\": \"A community's published position on personhood.\\n\\nDTG Credentials §Personhood Credentials places PHC status here rather than in the credential — \\\"PHC status is determined by governance and trust registries, not by credential structure\\\" — so a verifier deciding whether a VMC carries personhood weight reads this, not the credential's type array. §Governance Considerations item 1 makes the acceptable-IDVP list the community's to define and publish.\\n\\nEvery member is a declaration, not an enforcement: what a community actually accepts is decided by its own policy. Absent means the community has not published a position, which is not the same as asserting the negative.\",\n \"properties\": {\n \"acceptedIdvps\": {\n \"description\": \"DIDs of the identity-verification providers whose credentials this community accepts as personhood evidence. A community that vets its own members in person lists its own community DID here — it is acting as its own IDVP, which §IDVC permits. An empty list means no list has been published, not that everything is accepted.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"governanceFrameworkUrl\": {\n \"description\": \"Where the governance framework these assertions refer to can be read.\",\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"realHuman\": {\n \"description\": \"Governance requires that members are real humans. Defaults to `false` when absent: a community that has not considered the question asserts nothing, which is the only safe default for a claim a verifier may rely on.\",\n \"type\": \"boolean\"\n },\n \"singleMembership\": {\n \"description\": \"Governance requires that each person holds at most one membership in **this** community. Per-community by definition — the glossary says \\\"exactly one membership in that VTC\\\" — so a single community can satisfy it without any network above it.\",\n \"type\": \"boolean\"\n }\n },\n \"title\": \"PersonhoodGovernance\",\n \"type\": \"object\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"fieldsChanged\": {\n \"description\": \"Names of the profile members this update actually changed, in the wire spelling. Empty when the submitted values all matched what was already stored. Lets a caller distinguish a no-op from an applied change without diffing the returned profile against the one it sent.\",\n \"items\": {\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"profile\": {\n \"$ref\": \"#/$defs/CommunityProfileView\",\n \"description\": \"The community's profile as read, including the immutable `communityDid` an update cannot set.\"\n }\n },\n \"required\": [\n \"profile\"\n ],\n \"title\": \"VTC Community Profile Update — response payload\",\n \"type\": \"object\"\n }\n },\n \"$ref\": \"#/$defs/Response\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\"\n}\n",
);
}
impl crate::RequestPayload for Payload {
type Response = Response;
}
/// 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::VALIDATION_FAILED];
/// 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 {
/// `vtc/community/profile/update:validationFailed`
///
/// A supplied field failed validation (e.g. empty name, malformed URL).
///
/// Declared `retryable: false`.
pub const VALIDATION_FAILED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/community/profile/update:validationFailed",
retryable: false,
};
}
#[cfg(test)]
mod conformance {
//! Round-trip tests harvested from the spec's `spec.md`,
//! plus a `rejects_invalid_examples` test for any fixtures
//! in `payload.invalid-examples.json` (validate feature).
/// Each fixture in `payload.invalid-examples.json` MUST be
/// rejected by at least one of: serde deserialization, or
/// JSON-Schema validation under the `validate` feature. The
/// fixture file documents the producer-side bug class that
/// each payload exemplifies; this generated test pins it.
#[cfg(feature = "validate")]
#[test]
fn rejects_invalid_examples() {
use crate::validate::ValidatedPayload;
let fixtures: &[(&str, &str)] = &[
(
"Unknown top-level member is rejected.",
"{\n \"__x__\": true,\n \"name\": \"Acme\"\n}",
),
(
"registryStatus is read-only, not settable.",
"{\n \"registryStatus\": \"active\"\n}",
),
];
for (i, (note, raw)) in fixtures.iter().enumerate() {
let value: serde_json::Value = match serde_json::from_str(raw) {
Ok(v) => v,
Err(_) => continue,
};
let serde_ok = serde_json::from_value::<super::Payload>(value.clone()).is_ok();
let schema_ok = super::Payload::validate_value(&value).is_ok();
assert!(
!(serde_ok && schema_ok),
"invalid-example #{} ({:?}) was accepted by both serde and JSON Schema; \
the fixture's stated failure class is no longer caught:\n{}",
i + 1,
note,
raw
);
}
}
}