//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `vtc/join-requests/submit`. Version: `0.2`.
#[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())
})
}
}
///`Payload`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/vtc/join-requests/submit/0.2",
/// "title": "Payload",
/// "type": "object",
/// "required": [
/// "vp"
/// ],
/// "properties": {
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "extensions": {
/// "description": "Opaque applicant-supplied extension bag.",
/// "type": "object"
/// },
/// "registryConsent": {
/// "description": "Whether the applicant consents to trust-registry publication.",
/// "type": "boolean"
/// },
/// "vp": {
/// "description": "The applicant's W3C Verifiable Presentation (opaque here), satisfying the community's join policy. The applicant DID is the document proof's signer — not a payload field.",
/// "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>,
///Opaque applicant-supplied extension bag.
#[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
pub extensions: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
///Whether the applicant consents to trust-registry publication.
#[serde(
rename = "registryConsent",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub registry_consent: ::std::option::Option<bool>,
///The applicant's W3C Verifiable Presentation (opaque here), satisfying the community's join policy. The applicant DID is the document proof's signer — not a payload field.
pub vp: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///`Response`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "type": "object",
/// "required": [
/// "requestId",
/// "verdict"
/// ],
/// "properties": {
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "requestId": {
/// "description": "Id of the created join request (a UUID).",
/// "type": "string",
/// "minLength": 1
/// },
/// "verdict": {
/// "description": "\nWhat the community decided about this submission.\n\n`0.1` returned `status: \"pending\"` — a constant, which could express only one of the four outcomes a submission actually has. A policy that admits outright, refuses outright, or asks for more evidence had to be reported as 'pending' or not at all.",
/// "$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>,
///Id of the created join request (a UUID).
#[serde(rename = "requestId")]
pub request_id: ResponseRequestId,
/**
What the community decided about this submission.
`0.1` returned `status: "pending"` — a constant, which could express only one of the four outcomes a submission actually has. A policy that admits outright, refuses outright, or asks for more evidence had to be reported as 'pending' or not at all.*/
pub verdict: Verdict,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///Id of the created join request (a UUID).
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Id of the created join request (a UUID).",
/// "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,
>,
registry_consent: ::std::result::Result<::std::option::Option<bool>, ::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()),
registry_consent: 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 registry_consent<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<bool>>,
T::Error: ::std::fmt::Display,
{
self.registry_consent = value
.try_into()
.map_err(|e| format!("error converting supplied value for registry_consent: {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?,
registry_consent: value.registry_consent?,
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),
registry_consent: Ok(value.registry_consent),
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/submit/0.2";
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 \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"requestId\": {\n \"description\": \"Id of the created join request (a UUID).\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"verdict\": {\n \"$ref\": \"#/$defs/Verdict\",\n \"description\": \"What the community decided about this submission.\\n\\n`0.1` returned `status: \\\"pending\\\"` — a constant, which could express only one of the four outcomes a submission actually has. A policy that admits outright, refuses outright, or asks for more evidence had to be reported as 'pending' or not at all.\"\n }\n },\n \"required\": [\n \"requestId\",\n \"verdict\"\n ],\n \"title\": \"VTC Join-Requests Submit — 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/submit/0.2\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"extensions\": {\n \"description\": \"Opaque applicant-supplied extension bag.\",\n \"type\": \"object\"\n },\n \"registryConsent\": {\n \"description\": \"Whether the applicant consents to trust-registry publication.\",\n \"type\": \"boolean\"\n },\n \"vp\": {\n \"description\": \"The applicant's W3C Verifiable Presentation (opaque here), satisfying the community's join policy. The applicant DID is the document proof's signer — not a payload field.\",\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"vp\"\n ],\n \"title\": \"VTC Join-Requests Submit — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/vtc/join-requests/submit/0.2#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 \"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 \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"requestId\": {\n \"description\": \"Id of the created join request (a UUID).\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"verdict\": {\n \"$ref\": \"#/$defs/Verdict\",\n \"description\": \"What the community decided about this submission.\\n\\n`0.1` returned `status: \\\"pending\\\"` — a constant, which could express only one of the four outcomes a submission actually has. A policy that admits outright, refuses outright, or asks for more evidence had to be reported as 'pending' or not at all.\"\n }\n },\n \"required\": [\n \"requestId\",\n \"verdict\"\n ],\n \"title\": \"VTC Join-Requests Submit — 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;
}
#[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 \"vp\": {}\n}",
),
("`vp` is required.", "{\n \"registryConsent\": true\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
);
}
}
}