//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `vtc/join-requests/supplement`. 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())
}
}
}
///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())
})
}
}
///The evidence an applicant offers in answer to a community's request for more, against the join request they already have open. The outer document members (id, type, issuer, recipient, issuedAt, expiresAt, proof) are owned by the framework — SPEC §6.3.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/vtc/join-requests/supplement/0.1",
/// "title": "Payload",
/// "description": "The evidence an applicant offers in answer to a community's request for more, against the join request they already have open. The outer document members (id, type, issuer, recipient, issuedAt, expiresAt, proof) are owned by the framework — SPEC §6.3.",
/// "type": "object",
/// "required": [
/// "vp"
/// ],
/// "properties": {
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "extensions": {
/// "description": "An opaque bag the community stores verbatim and this task does not interpret. Replaces the bag on the request on the same terms as `vp`.",
/// "type": "object"
/// },
/// "requestId": {
/// "description": "The request to supplement. OPTIONAL: an applicant whose submit response was lost never received one, and the consumer then resolves the request from the authenticated applicant. A consumer given this value MUST prefer it over inferring the request from the caller.",
/// "type": "string",
/// "minLength": 1
/// },
/// "vp": {
/// "description": "The Verifiable Presentation satisfying the `presentationDefinition` the community returned when it deferred. It REPLACES the presentation on the request rather than adding to it, so it carries everything the community requires and not only the shortfall — see the spec's Definitions.",
/// "type": "object"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///An opaque bag the community stores verbatim and this task does not interpret. Replaces the bag on the request on the same terms as `vp`.
#[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
pub extensions: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
///The request to supplement. OPTIONAL: an applicant whose submit response was lost never received one, and the consumer then resolves the request from the authenticated applicant. A consumer given this value MUST prefer it over inferring the request from the caller.
#[serde(
rename = "requestId",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub request_id: ::std::option::Option<PayloadRequestId>,
///The Verifiable Presentation satisfying the `presentationDefinition` the community returned when it deferred. It REPLACES the presentation on the request rather than adding to it, so it carries everything the community requires and not only the shortfall — see the spec's Definitions.
pub vp: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///The request to supplement. OPTIONAL: an applicant whose submit response was lost never received one, and the consumer then resolves the request from the authenticated applicant. A consumer given this value MUST prefer it over inferring the request from the caller.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The request to supplement. OPTIONAL: an applicant whose submit response was lost never received one, and the consumer then resolves the request from the authenticated applicant. A consumer given this value MUST prefer it over inferring the request from the caller.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadRequestId(::std::string::String);
impl ::std::ops::Deref for PayloadRequestId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadRequestId> for ::std::string::String {
fn from(value: PayloadRequestId) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadRequestId {
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 PayloadRequestId {
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 PayloadRequestId {
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 PayloadRequestId {
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 PayloadRequestId {
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())
})
}
}
///The community's fresh decision on the re-presented evidence. Failures use trust-task-error, not this shape.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "description": "The community's fresh decision on the re-presented evidence. Failures use trust-task-error, not this shape.",
/// "type": "object",
/// "required": [
/// "requestId",
/// "verdict"
/// ],
/// "properties": {
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "requestId": {
/// "description": "The request that was re-decided (a UUID). Returned even when the request omitted it, so an applicant who used the id-less form learns which request they answered.",
/// "type": "string",
/// "minLength": 1
/// },
/// "verdict": {
/// "description": "What the community decided on the new evidence, in the same shape `vtc/join-requests/submit` returns. MAY be any outcome a submission can produce, including a further request for more evidence and including a refusal.",
/// "$ref": "#/definitions/Verdict"
/// }
/// },
/// "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>,
///The request that was re-decided (a UUID). Returned even when the request omitted it, so an applicant who used the id-less form learns which request they answered.
#[serde(rename = "requestId")]
pub request_id: ResponseRequestId,
///What the community decided on the new evidence, in the same shape `vtc/join-requests/submit` returns. MAY be any outcome a submission can produce, including a further request for more evidence and including a refusal.
pub verdict: Verdict,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///The request that was re-decided (a UUID). Returned even when the request omitted it, so an applicant who used the id-less form learns which request they answered.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The request that was re-decided (a UUID). Returned even when the request omitted it, so an applicant who used the id-less form learns which request they answered.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseRequestId(::std::string::String);
impl ::std::ops::Deref for ResponseRequestId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseRequestId> for ::std::string::String {
fn from(value: ResponseRequestId) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseRequestId {
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 ResponseRequestId {
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 ResponseRequestId {
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 ResponseRequestId {
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 ResponseRequestId {
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())
})
}
}
///A ceremony decision: the effect, plus its effect-dependent detail.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Verdict",
/// "description": "A ceremony decision: the effect, plus its effect-dependent detail.",
/// "type": "object",
/// "required": [
/// "effect",
/// "with"
/// ],
/// "properties": {
/// "effect": {
/// "$ref": "#/definitions/VerdictEffect"
/// },
/// "with": {
/// "$ref": "#/definitions/VerdictWith"
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "verdict"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Verdict {
pub effect: VerdictEffect,
pub with: VerdictWith,
}
impl Verdict {
pub fn builder() -> builder::Verdict {
Default::default()
}
}
/**
What the policy decided.
`allow` — admitted. `deny` — refused, terminally for this submission. `refer` — parked for a human or quorum decision; the applicant is neither in nor out. `requestMore` — the policy cannot decide yet and names what further evidence it needs.
The four are not reducible to a pending/decided pair. `refer` and `requestMore` are both 'not decided', but they place the next action with different parties: `refer` waits on the community, `requestMore` waits on the applicant. A consumer that cannot tell them apart cannot tell a user whether to wait or to act.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "VerdictEffect",
/// "description": "\nWhat the policy decided.\n\n`allow` — admitted. `deny` — refused, terminally for this submission. `refer` — parked for a human or quorum decision; the applicant is neither in nor out. `requestMore` — the policy cannot decide yet and names what further evidence it needs.\n\nThe four are not reducible to a pending/decided pair. `refer` and `requestMore` are both 'not decided', but they place the next action with different parties: `refer` waits on the community, `requestMore` waits on the applicant. A consumer that cannot tell them apart cannot tell a user whether to wait or to act.",
/// "type": "string",
/// "enum": [
/// "allow",
/// "deny",
/// "refer",
/// "requestMore"
/// ],
/// "$anchor": "verdictEffect"
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum VerdictEffect {
#[serde(rename = "allow")]
Allow,
#[serde(rename = "deny")]
Deny,
#[serde(rename = "refer")]
Refer,
#[serde(rename = "requestMore")]
RequestMore,
}
impl ::std::fmt::Display for VerdictEffect {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Allow => f.write_str("allow"),
Self::Deny => f.write_str("deny"),
Self::Refer => f.write_str("refer"),
Self::RequestMore => f.write_str("requestMore"),
}
}
}
impl ::std::str::FromStr for VerdictEffect {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"allow" => Ok(Self::Allow),
"deny" => Ok(Self::Deny),
"refer" => Ok(Self::Refer),
"requestMore" => Ok(Self::RequestMore),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for VerdictEffect {
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 VerdictEffect {
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 VerdictEffect {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
/**
The effect-dependent detail of a verdict.
Every member is optional at the schema level and which ones are meaningful depends on `effect`: `role` / `obligations` / `bundleRef` on `allow`, `code` / `reason` on `deny`, `queue` / `reason` on `refer`, `needs` / `presentationDefinition` on `requestMore`. The dependency is stated here rather than enforced by `if`/`then` per effect, so that the shape stays a single flat object a generated type can carry without a discriminated union per family — a deliberate trade of schema strictness for implementability, and the reason a consumer MUST branch on `effect` rather than on which members happen to be present.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "VerdictWith",
/// "description": "\nThe effect-dependent detail of a verdict.\n\nEvery member is optional at the schema level and which ones are meaningful depends on `effect`: `role` / `obligations` / `bundleRef` on `allow`, `code` / `reason` on `deny`, `queue` / `reason` on `refer`, `needs` / `presentationDefinition` on `requestMore`. The dependency is stated here rather than enforced by `if`/`then` per effect, so that the shape stays a single flat object a generated type can carry without a discriminated union per family — a deliberate trade of schema strictness for implementability, and the reason a consumer MUST branch on `effect` rather than on which members happen to be present.",
/// "type": "object",
/// "properties": {
/// "bundleRef": {
/// "description": "Pointer to a sealed credential bundle, added by the community where issuance occurred rather than emitted by the policy. `allow` only.",
/// "type": "object"
/// },
/// "code": {
/// "description": "Stable refusal code, safe to branch on. `deny` only.",
/// "type": "string",
/// "minLength": 1
/// },
/// "needs": {
/// "description": "What further evidence is required, named so the applicant can act without a support conversation. `requestMore` only.",
/// "type": "array",
/// "items": {
/// "type": "string",
/// "minLength": 1
/// }
/// },
/// "obligations": {
/// "description": "Conditions attached to the grant. `allow` only.",
/// "type": "object"
/// },
/// "presentationDefinition": {
/// "description": "A machine-readable statement of the same request, so a wallet can satisfy it without a human reading `needs`. `requestMore` only.",
/// "type": "object"
/// },
/// "queue": {
/// "description": "Which review queue the decision was parked in, so an applicant can be told who now holds it. `refer` only.",
/// "type": "string",
/// "minLength": 1
/// },
/// "reason": {
/// "description": "Elaboration in prose, when the decider gave one. `deny` and `refer`.",
/// "type": [
/// "string",
/// "null"
/// ],
/// "maxLength": 1024
/// },
/// "role": {
/// "description": "The granted local role. `allow` only.",
/// "type": "string",
/// "minLength": 1
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "verdictWith"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct VerdictWith {
///Pointer to a sealed credential bundle, added by the community where issuance occurred rather than emitted by the policy. `allow` only.
#[serde(
rename = "bundleRef",
default,
skip_serializing_if = "::serde_json::Map::is_empty"
)]
pub bundle_ref: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
///Stable refusal code, safe to branch on. `deny` only.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub code: ::std::option::Option<VerdictWithCode>,
///What further evidence is required, named so the applicant can act without a support conversation. `requestMore` only.
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub needs: ::std::vec::Vec<VerdictWithNeedsItem>,
///Conditions attached to the grant. `allow` only.
#[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
pub obligations: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
///A machine-readable statement of the same request, so a wallet can satisfy it without a human reading `needs`. `requestMore` only.
#[serde(
rename = "presentationDefinition",
default,
skip_serializing_if = "::serde_json::Map::is_empty"
)]
pub presentation_definition: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
///Which review queue the decision was parked in, so an applicant can be told who now holds it. `refer` only.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub queue: ::std::option::Option<VerdictWithQueue>,
///Elaboration in prose, when the decider gave one. `deny` and `refer`.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub reason: ::std::option::Option<VerdictWithReason>,
///The granted local role. `allow` only.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub role: ::std::option::Option<VerdictWithRole>,
}
impl ::std::default::Default for VerdictWith {
fn default() -> Self {
Self {
bundle_ref: Default::default(),
code: Default::default(),
needs: Default::default(),
obligations: Default::default(),
presentation_definition: Default::default(),
queue: Default::default(),
reason: Default::default(),
role: Default::default(),
}
}
}
impl VerdictWith {
pub fn builder() -> builder::VerdictWith {
Default::default()
}
}
///Stable refusal code, safe to branch on. `deny` only.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Stable refusal code, safe to branch on. `deny` only.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct VerdictWithCode(::std::string::String);
impl ::std::ops::Deref for VerdictWithCode {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<VerdictWithCode> for ::std::string::String {
fn from(value: VerdictWithCode) -> Self {
value.0
}
}
impl ::std::str::FromStr for VerdictWithCode {
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 VerdictWithCode {
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 VerdictWithCode {
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 VerdictWithCode {
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 VerdictWithCode {
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())
})
}
}
///`VerdictWithNeedsItem`
///
/// <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 VerdictWithNeedsItem(::std::string::String);
impl ::std::ops::Deref for VerdictWithNeedsItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<VerdictWithNeedsItem> for ::std::string::String {
fn from(value: VerdictWithNeedsItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for VerdictWithNeedsItem {
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 VerdictWithNeedsItem {
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 VerdictWithNeedsItem {
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 VerdictWithNeedsItem {
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 VerdictWithNeedsItem {
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())
})
}
}
///Which review queue the decision was parked in, so an applicant can be told who now holds it. `refer` only.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Which review queue the decision was parked in, so an applicant can be told who now holds it. `refer` only.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct VerdictWithQueue(::std::string::String);
impl ::std::ops::Deref for VerdictWithQueue {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<VerdictWithQueue> for ::std::string::String {
fn from(value: VerdictWithQueue) -> Self {
value.0
}
}
impl ::std::str::FromStr for VerdictWithQueue {
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 VerdictWithQueue {
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 VerdictWithQueue {
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 VerdictWithQueue {
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 VerdictWithQueue {
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())
})
}
}
///Elaboration in prose, when the decider gave one. `deny` and `refer`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Elaboration in prose, when the decider gave one. `deny` and `refer`.",
/// "type": "string",
/// "maxLength": 1024
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct VerdictWithReason(::std::string::String);
impl ::std::ops::Deref for VerdictWithReason {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<VerdictWithReason> for ::std::string::String {
fn from(value: VerdictWithReason) -> Self {
value.0
}
}
impl ::std::str::FromStr for VerdictWithReason {
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 VerdictWithReason {
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 VerdictWithReason {
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 VerdictWithReason {
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 VerdictWithReason {
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())
})
}
}
///The granted local role. `allow` only.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The granted local role. `allow` only.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct VerdictWithRole(::std::string::String);
impl ::std::ops::Deref for VerdictWithRole {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<VerdictWithRole> for ::std::string::String {
fn from(value: VerdictWithRole) -> Self {
value.0
}
}
impl ::std::str::FromStr for VerdictWithRole {
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 VerdictWithRole {
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 VerdictWithRole {
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 VerdictWithRole {
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 VerdictWithRole {
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())
})
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Payload {
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,
>,
request_id: ::std::result::Result<
::std::option::Option<super::PayloadRequestId>,
::std::string::String,
>,
vp: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
extensions: Ok(Default::default()),
request_id: Ok(Default::default()),
vp: Err("no value supplied for vp".to_string()),
}
}
}
impl Payload {
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 request_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadRequestId>>,
T::Error: ::std::fmt::Display,
{
self.request_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for request_id: {e}"));
self
}
pub fn vp<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.vp = value
.try_into()
.map_err(|e| format!("error converting supplied value for vp: {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 {
ext: value.ext?,
extensions: value.extensions?,
request_id: value.request_id?,
vp: value.vp?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
ext: Ok(value.ext),
extensions: Ok(value.extensions),
request_id: Ok(value.request_id),
vp: Ok(value.vp),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
request_id: ::std::result::Result<super::ResponseRequestId, ::std::string::String>,
verdict: ::std::result::Result<super::Verdict, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
request_id: Err("no value supplied for request_id".to_string()),
verdict: Err("no value supplied for verdict".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 request_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseRequestId>,
T::Error: ::std::fmt::Display,
{
self.request_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for request_id: {e}"));
self
}
pub fn verdict<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Verdict>,
T::Error: ::std::fmt::Display,
{
self.verdict = value
.try_into()
.map_err(|e| format!("error converting supplied value for verdict: {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?,
request_id: value.request_id?,
verdict: value.verdict?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
ext: Ok(value.ext),
request_id: Ok(value.request_id),
verdict: Ok(value.verdict),
}
}
}
#[derive(Clone, Debug)]
pub struct Verdict {
effect: ::std::result::Result<super::VerdictEffect, ::std::string::String>,
with: ::std::result::Result<super::VerdictWith, ::std::string::String>,
}
impl ::std::default::Default for Verdict {
fn default() -> Self {
Self {
effect: Err("no value supplied for effect".to_string()),
with: Err("no value supplied for with".to_string()),
}
}
}
impl Verdict {
pub fn effect<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::VerdictEffect>,
T::Error: ::std::fmt::Display,
{
self.effect = value
.try_into()
.map_err(|e| format!("error converting supplied value for effect: {e}"));
self
}
pub fn with<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::VerdictWith>,
T::Error: ::std::fmt::Display,
{
self.with = value
.try_into()
.map_err(|e| format!("error converting supplied value for with: {e}"));
self
}
}
impl ::std::convert::TryFrom<Verdict> for super::Verdict {
type Error = super::error::ConversionError;
fn try_from(value: Verdict) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
effect: value.effect?,
with: value.with?,
})
}
}
impl ::std::convert::From<super::Verdict> for Verdict {
fn from(value: super::Verdict) -> Self {
Self {
effect: Ok(value.effect),
with: Ok(value.with),
}
}
}
#[derive(Clone, Debug)]
pub struct VerdictWith {
bundle_ref: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
code: ::std::result::Result<
::std::option::Option<super::VerdictWithCode>,
::std::string::String,
>,
needs: ::std::result::Result<
::std::vec::Vec<super::VerdictWithNeedsItem>,
::std::string::String,
>,
obligations: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
presentation_definition: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
queue: ::std::result::Result<
::std::option::Option<super::VerdictWithQueue>,
::std::string::String,
>,
reason: ::std::result::Result<
::std::option::Option<super::VerdictWithReason>,
::std::string::String,
>,
role: ::std::result::Result<
::std::option::Option<super::VerdictWithRole>,
::std::string::String,
>,
}
impl ::std::default::Default for VerdictWith {
fn default() -> Self {
Self {
bundle_ref: Ok(Default::default()),
code: Ok(Default::default()),
needs: Ok(Default::default()),
obligations: Ok(Default::default()),
presentation_definition: Ok(Default::default()),
queue: Ok(Default::default()),
reason: Ok(Default::default()),
role: Ok(Default::default()),
}
}
}
impl VerdictWith {
pub fn bundle_ref<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.bundle_ref = value
.try_into()
.map_err(|e| format!("error converting supplied value for bundle_ref: {e}"));
self
}
pub fn code<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::VerdictWithCode>>,
T::Error: ::std::fmt::Display,
{
self.code = value
.try_into()
.map_err(|e| format!("error converting supplied value for code: {e}"));
self
}
pub fn needs<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::VerdictWithNeedsItem>>,
T::Error: ::std::fmt::Display,
{
self.needs = value
.try_into()
.map_err(|e| format!("error converting supplied value for needs: {e}"));
self
}
pub fn obligations<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.obligations = value
.try_into()
.map_err(|e| format!("error converting supplied value for obligations: {e}"));
self
}
pub fn presentation_definition<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.presentation_definition = value.try_into().map_err(|e| {
format!("error converting supplied value for presentation_definition: {e}")
});
self
}
pub fn queue<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::VerdictWithQueue>>,
T::Error: ::std::fmt::Display,
{
self.queue = value
.try_into()
.map_err(|e| format!("error converting supplied value for queue: {e}"));
self
}
pub fn reason<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::VerdictWithReason>>,
T::Error: ::std::fmt::Display,
{
self.reason = value
.try_into()
.map_err(|e| format!("error converting supplied value for reason: {e}"));
self
}
pub fn role<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::VerdictWithRole>>,
T::Error: ::std::fmt::Display,
{
self.role = value
.try_into()
.map_err(|e| format!("error converting supplied value for role: {e}"));
self
}
}
impl ::std::convert::TryFrom<VerdictWith> for super::VerdictWith {
type Error = super::error::ConversionError;
fn try_from(
value: VerdictWith,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
bundle_ref: value.bundle_ref?,
code: value.code?,
needs: value.needs?,
obligations: value.obligations?,
presentation_definition: value.presentation_definition?,
queue: value.queue?,
reason: value.reason?,
role: value.role?,
})
}
}
impl ::std::convert::From<super::VerdictWith> for VerdictWith {
fn from(value: super::VerdictWith) -> Self {
Self {
bundle_ref: Ok(value.bundle_ref),
code: Ok(value.code),
needs: Ok(value.needs),
obligations: Ok(value.obligations),
presentation_definition: Ok(value.presentation_definition),
queue: Ok(value.queue),
reason: Ok(value.reason),
role: Ok(value.role),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/vtc/join-requests/supplement/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 \"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 \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"The community's fresh decision on the re-presented evidence. Failures use trust-task-error, not this shape.\",\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"requestId\": {\n \"description\": \"The request that was re-decided (a UUID). Returned even when the request omitted it, so an applicant who used the id-less form learns which request they answered.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"verdict\": {\n \"$ref\": \"#/$defs/Verdict\",\n \"description\": \"What the community decided on the new evidence, in the same shape `vtc/join-requests/submit` returns. MAY be any outcome a submission can produce, including a further request for more evidence and including a refusal.\"\n }\n },\n \"required\": [\n \"requestId\",\n \"verdict\"\n ],\n \"title\": \"VTC Join-Requests Supplement — response payload\",\n \"type\": \"object\"\n },\n \"Verdict\": {\n \"$anchor\": \"verdict\",\n \"additionalProperties\": false,\n \"description\": \"A ceremony decision: the effect, plus its effect-dependent detail.\",\n \"properties\": {\n \"effect\": {\n \"$ref\": \"#/$defs/VerdictEffect\"\n },\n \"with\": {\n \"$ref\": \"#/$defs/VerdictWith\"\n }\n },\n \"required\": [\n \"effect\",\n \"with\"\n ],\n \"title\": \"Verdict\",\n \"type\": \"object\"\n },\n \"VerdictEffect\": {\n \"$anchor\": \"verdictEffect\",\n \"description\": \"What the policy decided.\\n\\n`allow` — admitted. `deny` — refused, terminally for this submission. `refer` — parked for a human or quorum decision; the applicant is neither in nor out. `requestMore` — the policy cannot decide yet and names what further evidence it needs.\\n\\nThe four are not reducible to a pending/decided pair. `refer` and `requestMore` are both 'not decided', but they place the next action with different parties: `refer` waits on the community, `requestMore` waits on the applicant. A consumer that cannot tell them apart cannot tell a user whether to wait or to act.\",\n \"enum\": [\n \"allow\",\n \"deny\",\n \"refer\",\n \"requestMore\"\n ],\n \"title\": \"VerdictEffect\",\n \"type\": \"string\"\n },\n \"VerdictWith\": {\n \"$anchor\": \"verdictWith\",\n \"additionalProperties\": false,\n \"description\": \"The effect-dependent detail of a verdict.\\n\\nEvery member is optional at the schema level and which ones are meaningful depends on `effect`: `role` / `obligations` / `bundleRef` on `allow`, `code` / `reason` on `deny`, `queue` / `reason` on `refer`, `needs` / `presentationDefinition` on `requestMore`. The dependency is stated here rather than enforced by `if`/`then` per effect, so that the shape stays a single flat object a generated type can carry without a discriminated union per family — a deliberate trade of schema strictness for implementability, and the reason a consumer MUST branch on `effect` rather than on which members happen to be present.\",\n \"properties\": {\n \"bundleRef\": {\n \"description\": \"Pointer to a sealed credential bundle, added by the community where issuance occurred rather than emitted by the policy. `allow` only.\",\n \"type\": \"object\"\n },\n \"code\": {\n \"description\": \"Stable refusal code, safe to branch on. `deny` only.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"needs\": {\n \"description\": \"What further evidence is required, named so the applicant can act without a support conversation. `requestMore` only.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"obligations\": {\n \"description\": \"Conditions attached to the grant. `allow` only.\",\n \"type\": \"object\"\n },\n \"presentationDefinition\": {\n \"description\": \"A machine-readable statement of the same request, so a wallet can satisfy it without a human reading `needs`. `requestMore` only.\",\n \"type\": \"object\"\n },\n \"queue\": {\n \"description\": \"Which review queue the decision was parked in, so an applicant can be told who now holds it. `refer` only.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"reason\": {\n \"description\": \"Elaboration in prose, when the decider gave one. `deny` and `refer`.\",\n \"maxLength\": 1024,\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"role\": {\n \"description\": \"The granted local role. `allow` only.\",\n \"minLength\": 1,\n \"type\": \"string\"\n }\n },\n \"title\": \"VerdictWith\",\n \"type\": \"object\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/vtc/join-requests/supplement/0.1\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"description\": \"The evidence an applicant offers in answer to a community's request for more, against the join request they already have open. The outer document members (id, type, issuer, recipient, issuedAt, expiresAt, proof) are owned by the framework — SPEC §6.3.\",\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"extensions\": {\n \"description\": \"An opaque bag the community stores verbatim and this task does not interpret. Replaces the bag on the request on the same terms as `vp`.\",\n \"type\": \"object\"\n },\n \"requestId\": {\n \"description\": \"The request to supplement. OPTIONAL: an applicant whose submit response was lost never received one, and the consumer then resolves the request from the authenticated applicant. A consumer given this value MUST prefer it over inferring the request from the caller.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"vp\": {\n \"description\": \"The Verifiable Presentation satisfying the `presentationDefinition` the community returned when it deferred. It REPLACES the presentation on the request rather than adding to it, so it carries everything the community requires and not only the shortfall — see the spec's Definitions.\",\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"vp\"\n ],\n \"title\": \"VTC Join-Requests Supplement — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/vtc/join-requests/supplement/0.1#response";
const IS_ISSUED_AT_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\n \"$defs\": {\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 \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"The community's fresh decision on the re-presented evidence. Failures use trust-task-error, not this shape.\",\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"requestId\": {\n \"description\": \"The request that was re-decided (a UUID). Returned even when the request omitted it, so an applicant who used the id-less form learns which request they answered.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"verdict\": {\n \"$ref\": \"#/$defs/Verdict\",\n \"description\": \"What the community decided on the new evidence, in the same shape `vtc/join-requests/submit` returns. MAY be any outcome a submission can produce, including a further request for more evidence and including a refusal.\"\n }\n },\n \"required\": [\n \"requestId\",\n \"verdict\"\n ],\n \"title\": \"VTC Join-Requests Supplement — response payload\",\n \"type\": \"object\"\n },\n \"Verdict\": {\n \"$anchor\": \"verdict\",\n \"additionalProperties\": false,\n \"description\": \"A ceremony decision: the effect, plus its effect-dependent detail.\",\n \"properties\": {\n \"effect\": {\n \"$ref\": \"#/$defs/VerdictEffect\"\n },\n \"with\": {\n \"$ref\": \"#/$defs/VerdictWith\"\n }\n },\n \"required\": [\n \"effect\",\n \"with\"\n ],\n \"title\": \"Verdict\",\n \"type\": \"object\"\n },\n \"VerdictEffect\": {\n \"$anchor\": \"verdictEffect\",\n \"description\": \"What the policy decided.\\n\\n`allow` — admitted. `deny` — refused, terminally for this submission. `refer` — parked for a human or quorum decision; the applicant is neither in nor out. `requestMore` — the policy cannot decide yet and names what further evidence it needs.\\n\\nThe four are not reducible to a pending/decided pair. `refer` and `requestMore` are both 'not decided', but they place the next action with different parties: `refer` waits on the community, `requestMore` waits on the applicant. A consumer that cannot tell them apart cannot tell a user whether to wait or to act.\",\n \"enum\": [\n \"allow\",\n \"deny\",\n \"refer\",\n \"requestMore\"\n ],\n \"title\": \"VerdictEffect\",\n \"type\": \"string\"\n },\n \"VerdictWith\": {\n \"$anchor\": \"verdictWith\",\n \"additionalProperties\": false,\n \"description\": \"The effect-dependent detail of a verdict.\\n\\nEvery member is optional at the schema level and which ones are meaningful depends on `effect`: `role` / `obligations` / `bundleRef` on `allow`, `code` / `reason` on `deny`, `queue` / `reason` on `refer`, `needs` / `presentationDefinition` on `requestMore`. The dependency is stated here rather than enforced by `if`/`then` per effect, so that the shape stays a single flat object a generated type can carry without a discriminated union per family — a deliberate trade of schema strictness for implementability, and the reason a consumer MUST branch on `effect` rather than on which members happen to be present.\",\n \"properties\": {\n \"bundleRef\": {\n \"description\": \"Pointer to a sealed credential bundle, added by the community where issuance occurred rather than emitted by the policy. `allow` only.\",\n \"type\": \"object\"\n },\n \"code\": {\n \"description\": \"Stable refusal code, safe to branch on. `deny` only.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"needs\": {\n \"description\": \"What further evidence is required, named so the applicant can act without a support conversation. `requestMore` only.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"obligations\": {\n \"description\": \"Conditions attached to the grant. `allow` only.\",\n \"type\": \"object\"\n },\n \"presentationDefinition\": {\n \"description\": \"A machine-readable statement of the same request, so a wallet can satisfy it without a human reading `needs`. `requestMore` only.\",\n \"type\": \"object\"\n },\n \"queue\": {\n \"description\": \"Which review queue the decision was parked in, so an applicant can be told who now holds it. `refer` only.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"reason\": {\n \"description\": \"Elaboration in prose, when the decider gave one. `deny` and `refer`.\",\n \"maxLength\": 1024,\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"role\": {\n \"description\": \"The granted local role. `allow` only.\",\n \"minLength\": 1,\n \"type\": \"string\"\n }\n },\n \"title\": \"VerdictWith\",\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::NOT_FOUND,
error_codes::NOT_AWAITING_EVIDENCE,
error_codes::ALREADY_DECIDED,
];
/// 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/join-requests/supplement:notFound`
///
/// The applicant has no open request, or the named `requestId` is not theirs. Answered the same way for both, so that a caller cannot use this task to probe whether a given request id exists on this community.
///
/// Declared `retryable: false`.
pub const NOT_FOUND: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/join-requests/supplement:notFound",
retryable: false,
};
/// `vtc/join-requests/supplement:notAwaitingEvidence`
///
/// The request is open, but the community has not asked this applicant for anything — it is queued for a decision the community owes. Retrying is futile until the community defers the request, which is why this is distinct from a transient failure.
///
/// Declared `retryable: false`.
pub const NOT_AWAITING_EVIDENCE: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/join-requests/supplement:notAwaitingEvidence",
retryable: false,
};
/// `vtc/join-requests/supplement:alreadyDecided`
///
/// The request has reached a terminal state — approved, rejected or withdrawn — so there is no open decision left to supplement. Distinct from `notFound` because the applicant is entitled to know the outcome of their own request, and because retrying will never change it.
///
/// Declared `retryable: false`.
pub const ALREADY_DECIDED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/join-requests/supplement:alreadyDecided",
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).
#[test]
fn request_example_1() {
const JSON: &str = "{\n \"id\": \"urn:uuid:00000000-0000-4000-8000-000000000001\",\n \"type\": \"https://trusttasks.org/spec/vtc/join-requests/supplement/0.1#request\",\n \"issuer\": \"did:example:producer\",\n \"recipient\": \"did:example:recipient\",\n \"issuedAt\": \"2026-01-01T00:00:00Z\",\n \"threadId\": \"urn:uuid:00000000-0000-4000-8000-0000000000ff\",\n \"payload\": {\n \"vp\": {\n \"type\": [\"VerifiablePresentation\"],\n \"holder\": \"did:example:producer\"\n }\n }\n}\n";
let doc: crate::TrustTask<super::Payload> =
serde_json::from_str(JSON).expect("deserialize request example");
let rendered = serde_json::to_value(&doc).expect("re-serialize");
let expected: serde_json::Value = serde_json::from_str(JSON).expect("re-parse expected");
assert_eq!(rendered, expected, "request example failed round-trip");
}
#[test]
fn response_example_1() {
const JSON: &str = "{\n \"id\": \"urn:uuid:00000000-0000-4000-8000-000000000002\",\n \"type\": \"https://trusttasks.org/spec/vtc/join-requests/supplement/0.1#response\",\n \"issuer\": \"did:example:recipient\",\n \"recipient\": \"did:example:producer\",\n \"issuedAt\": \"2026-01-01T00:00:01Z\",\n \"threadId\": \"urn:uuid:00000000-0000-4000-8000-0000000000ff\",\n \"payload\": {\n \"requestId\": \"urn:uuid:00000000-0000-4000-8000-00000000a1b2\",\n \"verdict\": {\n \"effect\": \"allow\",\n \"with\": {\n \"role\": \"member\"\n }\n }\n }\n}\n";
let doc: crate::TrustTask<super::Response> =
serde_json::from_str(JSON).expect("deserialize response example");
let rendered = serde_json::to_value(&doc).expect("re-serialize");
let expected: serde_json::Value = serde_json::from_str(JSON).expect("re-parse expected");
assert_eq!(rendered, expected, "response example failed round-trip");
}
/// 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}"),
(
"`vp` is required — a supplement with no evidence answers nothing.",
"{\n \"requestId\": \"urn:uuid:00000000-0000-4000-8000-00000000a1b2\"\n}",
),
(
"`vp` is an object, not a string — the presentation is carried, not referenced.",
"{\n \"vp\": \"https://example.org/presentations/1\"\n}",
),
(
"`requestId` must not be empty — the id-less form omits it rather than sending a blank.",
"{\n \"requestId\": \"\",\n \"vp\": {}\n}",
),
(
"`requestId` is a string, not a number.",
"{\n \"requestId\": 42,\n \"vp\": {}\n}",
),
(
"`extensions` is an object bag, not an array.",
"{\n \"extensions\": [],\n \"vp\": {}\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
);
}
}
}