//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `git-ns/repo/list`. 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())
}
}
}
///Whether each step that turns commit trust on for a repository is in place, as last reported. A step that this forge's plan does not need reads `true`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Bootstrap",
/// "description": "Whether each step that turns commit trust on for a repository is in place, as last reported. A step that this forge's plan does not need reads `true`.",
/// "type": "object",
/// "required": [
/// "keyring",
/// "requiredCheck",
/// "variables",
/// "workflow"
/// ],
/// "properties": {
/// "keyring": {
/// "description": "The exempt platform keyring for forge-signed merge commits is committed, or the forge's plan does not need one.",
/// "type": "boolean"
/// },
/// "requiredCheck": {
/// "description": "The forge refuses to merge into the default branch unless the verify-trust check passes, with no bypass, and a pull request cannot change what that check runs: an organisation-required workflow, code-owner review of workflow files, or protected workflow paths, as the forge allows.",
/// "type": "boolean"
/// },
/// "variables": {
/// "description": "The repository names the Trust Registry and this VTC as its trust anchors.",
/// "type": "boolean"
/// },
/// "workflow": {
/// "description": "The verify-trust check runs on the repository's pull requests — from a workflow committed to it, or, where the forge supports it, required on it from the namespace's own bridge-managed workflow repository at a pinned commit.",
/// "type": "boolean"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Bootstrap {
///The exempt platform keyring for forge-signed merge commits is committed, or the forge's plan does not need one.
pub keyring: bool,
///The forge refuses to merge into the default branch unless the verify-trust check passes, with no bypass, and a pull request cannot change what that check runs: an organisation-required workflow, code-owner review of workflow files, or protected workflow paths, as the forge allows.
#[serde(rename = "requiredCheck")]
pub required_check: bool,
///The repository names the Trust Registry and this VTC as its trust anchors.
pub variables: bool,
///The verify-trust check runs on the repository's pull requests — from a workflow committed to it, or, where the forge supports it, required on it from the namespace's own bridge-managed workflow repository at a pinned commit.
pub workflow: bool,
}
impl Bootstrap {
pub fn builder() -> builder::Bootstrap {
Default::default()
}
}
///A bare DID in the W3C DID Core syntax (§3.1): `did:`, a method name of lowercase letters and digits, `:`, and a method-specific id of colon-separated segments drawn from `A-Z a-z 0-9 . - _` and percent-encoded octets, the last segment non-empty. A DID URL is not a DID: no path, query or fragment (`/`, `?`, `#`), so a verification-method id such as `did:key:z6Mk…#z6Mk…` is refused. Compared by exact string equality — no case folding or percent-decoding. A consumer MUST still treat the value as data: the pattern keeps shell metacharacters, whitespace and quotes out of the wire form, but it does not make a DID safe to splice into a command or markup.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Did",
/// "description": "A bare DID in the W3C DID Core syntax (§3.1): `did:`, a method name of lowercase letters and digits, `:`, and a method-specific id of colon-separated segments drawn from `A-Z a-z 0-9 . - _` and percent-encoded octets, the last segment non-empty. A DID URL is not a DID: no path, query or fragment (`/`, `?`, `#`), so a verification-method id such as `did:key:z6Mk…#z6Mk…` is refused. Compared by exact string equality — no case folding or percent-decoding. A consumer MUST still treat the value as data: the pattern keeps shell metacharacters, whitespace and quotes out of the wire form, but it does not make a DID safe to splice into a command or markup.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^did:[a-z0-9]+:(?:(?:[A-Za-z0-9._-]|%[0-9A-Fa-f]{2})*:)*(?:[A-Za-z0-9._-]|%[0-9A-Fa-f]{2})+$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct Did(::std::string::String);
impl ::std::ops::Deref for Did {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<Did> for ::std::string::String {
fn from(value: Did) -> Self {
value.0
}
}
impl ::std::str::FromStr for Did {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 2048usize {
return Err("longer than 2048 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(
|| {
::regress::Regex::new(
"^did:[a-z0-9]+:(?:(?:[A-Za-z0-9._-]|%[0-9A-Fa-f]{2})*:)*(?:[A-Za-z0-9._-]|%[0-9A-Fa-f]{2})+$",
)
.unwrap()
},
);
if PATTERN.find(value).is_none() {
return Err(
"doesn't match pattern \"^did:[a-z0-9]+:(?:(?:[A-Za-z0-9._-]|%[0-9A-Fa-f]{2})*:)*(?:[A-Za-z0-9._-]|%[0-9A-Fa-f]{2})+$\""
.into(),
);
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for Did {
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 Did {
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 Did {
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 Did {
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())
})
}
}
///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())
})
}
}
///An identifier the forge itself assigns — a repository id, a user or organisation id — carried as a string so a forge whose ids are not numbers needs no new version. GitHub and Forgejo ids are decimal integers written as strings (`"812736451"`). Unlike a name, it survives renames and transfers, which is why rights and bindings are keyed by it.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ForgeId",
/// "description": "An identifier the forge itself assigns — a repository id, a user or organisation id — carried as a string so a forge whose ids are not numbers needs no new version. GitHub and Forgejo ids are decimal integers written as strings (`\"812736451\"`). Unlike a name, it survives renames and transfers, which is why rights and bindings are keyed by it.",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ForgeId(::std::string::String);
impl ::std::ops::Deref for ForgeId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ForgeId> for ::std::string::String {
fn from(value: ForgeId) -> Self {
value.0
}
}
impl ::std::str::FromStr for ForgeId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 64usize {
return Err("longer than 64 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ForgeId {
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 ForgeId {
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 ForgeId {
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 ForgeId {
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 last verify-trust check run the bridge saw on the repository.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "LastCheck",
/// "description": "The last verify-trust check run the bridge saw on the repository.",
/// "type": "object",
/// "required": [
/// "at",
/// "conclusion"
/// ],
/// "properties": {
/// "at": {
/// "description": "When the check concluded.",
/// "type": "string",
/// "format": "date-time"
/// },
/// "conclusion": {
/// "description": "The check's conclusion, in the forge's words (`success`, `failure`).",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1
/// },
/// "sha": {
/// "description": "The commit it ran on.",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct LastCheck {
///When the check concluded.
pub at: ::chrono::DateTime<::chrono::offset::Utc>,
///The check's conclusion, in the forge's words (`success`, `failure`).
pub conclusion: LastCheckConclusion,
///The commit it ran on.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub sha: ::std::option::Option<LastCheckSha>,
}
impl LastCheck {
pub fn builder() -> builder::LastCheck {
Default::default()
}
}
///The check's conclusion, in the forge's words (`success`, `failure`).
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The check's conclusion, in the forge's words (`success`, `failure`).",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct LastCheckConclusion(::std::string::String);
impl ::std::ops::Deref for LastCheckConclusion {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<LastCheckConclusion> for ::std::string::String {
fn from(value: LastCheckConclusion) -> Self {
value.0
}
}
impl ::std::str::FromStr for LastCheckConclusion {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 64usize {
return Err("longer than 64 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for LastCheckConclusion {
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 LastCheckConclusion {
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 LastCheckConclusion {
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 LastCheckConclusion {
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 commit it ran on.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The commit it ran on.",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct LastCheckSha(::std::string::String);
impl ::std::ops::Deref for LastCheckSha {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<LastCheckSha> for ::std::string::String {
fn from(value: LastCheckSha) -> Self {
value.0
}
}
impl ::std::str::FromStr for LastCheckSha {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 64usize {
return Err("longer than 64 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for LastCheckSha {
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 LastCheckSha {
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 LastCheckSha {
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 LastCheckSha {
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 level of the bridge's forge-neutral role ladder, lowest first: the vocabulary role drift's `observed` and `expected` are reported in. `none` is no direct role on the repository.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "MappedRole",
/// "description": "A level of the bridge's forge-neutral role ladder, lowest first: the vocabulary role drift's `observed` and `expected` are reported in. `none` is no direct role on the repository.",
/// "type": "string",
/// "enum": [
/// "none",
/// "read",
/// "triage",
/// "write",
/// "maintain",
/// "admin"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum MappedRole {
#[serde(rename = "none")]
None,
#[serde(rename = "read")]
Read,
#[serde(rename = "triage")]
Triage,
#[serde(rename = "write")]
Write,
#[serde(rename = "maintain")]
Maintain,
#[serde(rename = "admin")]
Admin,
}
impl ::std::fmt::Display for MappedRole {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::None => f.write_str("none"),
Self::Read => f.write_str("read"),
Self::Triage => f.write_str("triage"),
Self::Write => f.write_str("write"),
Self::Maintain => f.write_str("maintain"),
Self::Admin => f.write_str("admin"),
}
}
}
impl ::std::str::FromStr for MappedRole {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"none" => Ok(Self::None),
"read" => Ok(Self::Read),
"triage" => Ok(Self::Triage),
"write" => Ok(Self::Write),
"maintain" => Ok(Self::Maintain),
"admin" => Ok(Self::Admin),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for MappedRole {
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 MappedRole {
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 MappedRole {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///The VTC's opaque identifier for a namespace, assigned when it is bound. Stable for the life of the binding; never reused for another binding.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "NamespaceId",
/// "description": "The VTC's opaque identifier for a namespace, assigned when it is bound. Stable for the life of the binding; never reused for another binding.",
/// "type": "string",
/// "maxLength": 128,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct NamespaceId(::std::string::String);
impl ::std::ops::Deref for NamespaceId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<NamespaceId> for ::std::string::String {
fn from(value: NamespaceId) -> Self {
value.0
}
}
impl ::std::str::FromStr for NamespaceId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 128usize {
return Err("longer than 128 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for NamespaceId {
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 NamespaceId {
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 NamespaceId {
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 NamespaceId {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///An administrator lists the repositories recorded in the namespaces they administer — every one, for a holder of the community-administrator capability — with owners, right counts, bootstrap, sync and forge status.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/git-ns/repo/list/0.1",
/// "title": "Payload",
/// "description": "An administrator lists the repositories recorded in the namespaces they administer — every one, for a holder of the community-administrator capability — with owners, right counts, bootstrap, sync and forge status.",
/// "type": "object",
/// "properties": {
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "namespace": {
/// "description": "Only the repositories in this namespace. It must be one the caller administers; a namespace they do not administer, or one this VTC does not have, is refused with `notAdministrator` alike.",
/// "$ref": "#/definitions/NamespaceId"
/// }
/// },
/// "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>,
///Only the repositories in this namespace. It must be one the caller administers; a namespace they do not administer, or one this VTC does not have, is refused with `notAdministrator` alike.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub namespace: ::std::option::Option<NamespaceId>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
ext: Default::default(),
namespace: Default::default(),
}
}
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///A forge-qualified resource naming exactly one repository: `<forge-host>/<owner>/<repo>`, lowercase.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "RepoResource",
/// "description": "A forge-qualified resource naming exactly one repository: `<forge-host>/<owner>/<repo>`, lowercase.",
/// "type": "string",
/// "maxLength": 455,
/// "pattern": "^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+/[a-z0-9_-][a-z0-9._-]{0,99}/[a-z0-9_-][a-z0-9._-]{0,99}$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct RepoResource(::std::string::String);
impl ::std::ops::Deref for RepoResource {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<RepoResource> for ::std::string::String {
fn from(value: RepoResource) -> Self {
value.0
}
}
impl ::std::str::FromStr for RepoResource {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 455usize {
return Err("longer than 455 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(
|| {
::regress::Regex::new(
"^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+/[a-z0-9_-][a-z0-9._-]{0,99}/[a-z0-9_-][a-z0-9._-]{0,99}$",
)
.unwrap()
},
);
if PATTERN.find(value).is_none() {
return Err(
"doesn't match pattern \"^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+/[a-z0-9_-][a-z0-9._-]{0,99}/[a-z0-9_-][a-z0-9._-]{0,99}$\""
.into(),
);
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for RepoResource {
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 RepoResource {
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 RepoResource {
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 RepoResource {
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())
})
}
}
///One repository as its administrators govern it: who owns it, how many hold rights on it, how far commit trust is set up, and how its forge compares with the VTC's projection.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "RepoStatus",
/// "description": "One repository as its administrators govern it: who owns it, how many hold rights on it, how far commit trust is set up, and how its forge compares with the VTC's projection.",
/// "type": "object",
/// "required": [
/// "bootstrap",
/// "committers",
/// "createdAt",
/// "driftCount",
/// "id",
/// "maintainers",
/// "namespace",
/// "owners",
/// "resource",
/// "roleMapStale",
/// "state",
/// "steps",
/// "syncState",
/// "visibility"
/// ],
/// "properties": {
/// "bootstrap": {
/// "$ref": "#/definitions/Bootstrap"
/// },
/// "checkedAt": {
/// "description": "When the forge was last compared. Absent if never.",
/// "type": "string",
/// "format": "date-time"
/// },
/// "committers": {
/// "description": "How many live records of `git.commit.sign` it has. Implied rights are not counted.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "createdAt": {
/// "description": "When the VTC first recorded it.",
/// "type": "string",
/// "format": "date-time"
/// },
/// "createdBy": {
/// "description": "Who created it through the VTC. Absent for an adopted or unmanaged repository.",
/// "$ref": "#/definitions/Did"
/// },
/// "driftCount": {
/// "description": "How many drift items are outstanding. The items themselves are in `git-ns/view`.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "failedStep": {
/// "description": "The step that failed on the last create or bootstrap.",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1
/// },
/// "forgeId": {
/// "description": "The forge's repository id, once confirmed.",
/// "$ref": "#/definitions/ForgeId"
/// },
/// "guard": {
/// "description": "The guard in force against a pull request satisfying its own check, as the bridge last reported it: `requiredWorkflow`, `codeOwnerReview`, `bridgePostedCheck`, `protectedFiles` or `none`. A client treats any other value as `none`.",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1
/// },
/// "id": {
/// "description": "The VTC's identifier for the repository record.",
/// "type": "string",
/// "maxLength": 128,
/// "minLength": 1
/// },
/// "lastCheck": {
/// "$ref": "#/definitions/LastCheck"
/// },
/// "lastError": {
/// "description": "What the bridge said when that step failed.",
/// "type": "string",
/// "maxLength": 4096,
/// "minLength": 1
/// },
/// "maintainers": {
/// "description": "How many live records of `git.repo.maintain` it has. Implied rights are not counted.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "namespace": {
/// "description": "The namespace it was recorded in. For a `detached` repository, possibly one no longer bound.",
/// "$ref": "#/definitions/NamespaceId"
/// },
/// "owners": {
/// "description": "The DIDs holding a live, explicitly recorded `git.repo.own` on it.",
/// "type": "array",
/// "items": {
/// "$ref": "#/definitions/Did"
/// },
/// "uniqueItems": true
/// },
/// "resource": {
/// "$ref": "#/definitions/RepoResource"
/// },
/// "roleMap": {
/// "description": "The forge role each right projects to on this repository under the serving bridge's reported map. Absent while the namespace's map is unknown.",
/// "$ref": "#/definitions/RoleMap"
/// },
/// "roleMapStale": {
/// "description": "The bridge last projected this repository's roles under an earlier role map, and the re-projection queued for it has not yet succeeded.",
/// "type": "boolean"
/// },
/// "state": {
/// "description": "As `RepoSummary.state` in the shared schema.",
/// "type": "string",
/// "enum": [
/// "pendingCreate",
/// "active",
/// "archived",
/// "detached",
/// "orphaned",
/// "unmanaged"
/// ]
/// },
/// "steps": {
/// "description": "Per-step outcomes of the last create, bootstrap or inspect job. Empty until one has been reported.",
/// "type": "array",
/// "items": {
/// "$ref": "#/definitions/StepOutcome"
/// },
/// "maxItems": 64
/// },
/// "syncState": {
/// "description": "As `Sync.state` in the shared schema.",
/// "type": "string",
/// "enum": [
/// "inSync",
/// "drift",
/// "pending",
/// "unchecked"
/// ]
/// },
/// "visibility": {
/// "$ref": "#/definitions/RepoVisibility"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct RepoStatus {
pub bootstrap: Bootstrap,
///When the forge was last compared. Absent if never.
#[serde(
rename = "checkedAt",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub checked_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
///How many live records of `git.commit.sign` it has. Implied rights are not counted.
pub committers: u64,
///When the VTC first recorded it.
#[serde(rename = "createdAt")]
pub created_at: ::chrono::DateTime<::chrono::offset::Utc>,
///Who created it through the VTC. Absent for an adopted or unmanaged repository.
#[serde(
rename = "createdBy",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub created_by: ::std::option::Option<Did>,
///How many drift items are outstanding. The items themselves are in `git-ns/view`.
#[serde(rename = "driftCount")]
pub drift_count: u64,
///The step that failed on the last create or bootstrap.
#[serde(
rename = "failedStep",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub failed_step: ::std::option::Option<RepoStatusFailedStep>,
///The forge's repository id, once confirmed.
#[serde(
rename = "forgeId",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub forge_id: ::std::option::Option<ForgeId>,
///The guard in force against a pull request satisfying its own check, as the bridge last reported it: `requiredWorkflow`, `codeOwnerReview`, `bridgePostedCheck`, `protectedFiles` or `none`. A client treats any other value as `none`.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub guard: ::std::option::Option<RepoStatusGuard>,
///The VTC's identifier for the repository record.
pub id: RepoStatusId,
#[serde(
rename = "lastCheck",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub last_check: ::std::option::Option<LastCheck>,
///What the bridge said when that step failed.
#[serde(
rename = "lastError",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub last_error: ::std::option::Option<RepoStatusLastError>,
///How many live records of `git.repo.maintain` it has. Implied rights are not counted.
pub maintainers: u64,
///The namespace it was recorded in. For a `detached` repository, possibly one no longer bound.
pub namespace: NamespaceId,
///The DIDs holding a live, explicitly recorded `git.repo.own` on it.
pub owners: Vec<Did>,
pub resource: RepoResource,
///The forge role each right projects to on this repository under the serving bridge's reported map. Absent while the namespace's map is unknown.
#[serde(
rename = "roleMap",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub role_map: ::std::option::Option<RoleMap>,
///The bridge last projected this repository's roles under an earlier role map, and the re-projection queued for it has not yet succeeded.
#[serde(rename = "roleMapStale")]
pub role_map_stale: bool,
///As `RepoSummary.state` in the shared schema.
pub state: RepoStatusState,
///Per-step outcomes of the last create, bootstrap or inspect job. Empty until one has been reported.
pub steps: ::std::vec::Vec<StepOutcome>,
///As `Sync.state` in the shared schema.
#[serde(rename = "syncState")]
pub sync_state: RepoStatusSyncState,
pub visibility: RepoVisibility,
}
impl RepoStatus {
pub fn builder() -> builder::RepoStatus {
Default::default()
}
}
///The step that failed on the last create or bootstrap.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The step that failed on the last create or bootstrap.",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct RepoStatusFailedStep(::std::string::String);
impl ::std::ops::Deref for RepoStatusFailedStep {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<RepoStatusFailedStep> for ::std::string::String {
fn from(value: RepoStatusFailedStep) -> Self {
value.0
}
}
impl ::std::str::FromStr for RepoStatusFailedStep {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 64usize {
return Err("longer than 64 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for RepoStatusFailedStep {
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 RepoStatusFailedStep {
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 RepoStatusFailedStep {
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 RepoStatusFailedStep {
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 guard in force against a pull request satisfying its own check, as the bridge last reported it: `requiredWorkflow`, `codeOwnerReview`, `bridgePostedCheck`, `protectedFiles` or `none`. A client treats any other value as `none`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The guard in force against a pull request satisfying its own check, as the bridge last reported it: `requiredWorkflow`, `codeOwnerReview`, `bridgePostedCheck`, `protectedFiles` or `none`. A client treats any other value as `none`.",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct RepoStatusGuard(::std::string::String);
impl ::std::ops::Deref for RepoStatusGuard {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<RepoStatusGuard> for ::std::string::String {
fn from(value: RepoStatusGuard) -> Self {
value.0
}
}
impl ::std::str::FromStr for RepoStatusGuard {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 64usize {
return Err("longer than 64 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for RepoStatusGuard {
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 RepoStatusGuard {
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 RepoStatusGuard {
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 RepoStatusGuard {
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 VTC's identifier for the repository record.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The VTC's identifier for the repository record.",
/// "type": "string",
/// "maxLength": 128,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct RepoStatusId(::std::string::String);
impl ::std::ops::Deref for RepoStatusId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<RepoStatusId> for ::std::string::String {
fn from(value: RepoStatusId) -> Self {
value.0
}
}
impl ::std::str::FromStr for RepoStatusId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 128usize {
return Err("longer than 128 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for RepoStatusId {
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 RepoStatusId {
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 RepoStatusId {
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 RepoStatusId {
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())
})
}
}
///What the bridge said when that step failed.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "What the bridge said when that step failed.",
/// "type": "string",
/// "maxLength": 4096,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct RepoStatusLastError(::std::string::String);
impl ::std::ops::Deref for RepoStatusLastError {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<RepoStatusLastError> for ::std::string::String {
fn from(value: RepoStatusLastError) -> Self {
value.0
}
}
impl ::std::str::FromStr for RepoStatusLastError {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 4096usize {
return Err("longer than 4096 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for RepoStatusLastError {
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 RepoStatusLastError {
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 RepoStatusLastError {
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 RepoStatusLastError {
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())
})
}
}
///As `RepoSummary.state` in the shared schema.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "As `RepoSummary.state` in the shared schema.",
/// "type": "string",
/// "enum": [
/// "pendingCreate",
/// "active",
/// "archived",
/// "detached",
/// "orphaned",
/// "unmanaged"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum RepoStatusState {
#[serde(rename = "pendingCreate")]
PendingCreate,
#[serde(rename = "active")]
Active,
#[serde(rename = "archived")]
Archived,
#[serde(rename = "detached")]
Detached,
#[serde(rename = "orphaned")]
Orphaned,
#[serde(rename = "unmanaged")]
Unmanaged,
}
impl ::std::fmt::Display for RepoStatusState {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::PendingCreate => f.write_str("pendingCreate"),
Self::Active => f.write_str("active"),
Self::Archived => f.write_str("archived"),
Self::Detached => f.write_str("detached"),
Self::Orphaned => f.write_str("orphaned"),
Self::Unmanaged => f.write_str("unmanaged"),
}
}
}
impl ::std::str::FromStr for RepoStatusState {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"pendingCreate" => Ok(Self::PendingCreate),
"active" => Ok(Self::Active),
"archived" => Ok(Self::Archived),
"detached" => Ok(Self::Detached),
"orphaned" => Ok(Self::Orphaned),
"unmanaged" => Ok(Self::Unmanaged),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for RepoStatusState {
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 RepoStatusState {
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 RepoStatusState {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///As `Sync.state` in the shared schema.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "As `Sync.state` in the shared schema.",
/// "type": "string",
/// "enum": [
/// "inSync",
/// "drift",
/// "pending",
/// "unchecked"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum RepoStatusSyncState {
#[serde(rename = "inSync")]
InSync,
#[serde(rename = "drift")]
Drift,
#[serde(rename = "pending")]
Pending,
#[serde(rename = "unchecked")]
Unchecked,
}
impl ::std::fmt::Display for RepoStatusSyncState {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::InSync => f.write_str("inSync"),
Self::Drift => f.write_str("drift"),
Self::Pending => f.write_str("pending"),
Self::Unchecked => f.write_str("unchecked"),
}
}
}
impl ::std::str::FromStr for RepoStatusSyncState {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"inSync" => Ok(Self::InSync),
"drift" => Ok(Self::Drift),
"pending" => Ok(Self::Pending),
"unchecked" => Ok(Self::Unchecked),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for RepoStatusSyncState {
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 RepoStatusSyncState {
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 RepoStatusSyncState {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///Repository visibility on the forge.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "RepoVisibility",
/// "description": "Repository visibility on the forge.",
/// "type": "string",
/// "enum": [
/// "public",
/// "private"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum RepoVisibility {
#[serde(rename = "public")]
Public,
#[serde(rename = "private")]
Private,
}
impl ::std::fmt::Display for RepoVisibility {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Public => f.write_str("public"),
Self::Private => f.write_str("private"),
}
}
}
impl ::std::str::FromStr for RepoVisibility {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"public" => Ok(Self::Public),
"private" => Ok(Self::Private),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for RepoVisibility {
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 RepoVisibility {
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 RepoVisibility {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///The repositories in the namespaces the caller administers, or in the one asked for.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "description": "The repositories in the namespaces the caller administers, or in the one asked for.",
/// "type": "object",
/// "required": [
/// "repos"
/// ],
/// "properties": {
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "repos": {
/// "description": "Every repository recorded in an administered namespace, in any state, ordered by `resource`; for a holder of the community-administrator capability without `namespace`, also every repository whose namespace is no longer bound.",
/// "type": "array",
/// "items": {
/// "$ref": "#/definitions/RepoStatus"
/// }
/// }
/// },
/// "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>,
///Every repository recorded in an administered namespace, in any state, ordered by `resource`; for a holder of the community-administrator capability without `namespace`, also every repository whose namespace is no longer bound.
pub repos: ::std::vec::Vec<RepoStatus>,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///The forge role each repository right is given, as the forge applies it: after the forge's own ladder has rounded it down. `own` is the role `git.repo.own` projects to, `maintain` that of `git.repo.maintain`, `commit` that of `git.commit.sign` (`none` is fork-based contribution). There is no member for `git.ns.admin` or `git.repo.create`, which project to no forge role whatever a bridge is configured with. Ordered: `own` is at least `maintain`, which is at least `commit`, and `commit` is at most `write`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "RoleMap",
/// "description": "The forge role each repository right is given, as the forge applies it: after the forge's own ladder has rounded it down. `own` is the role `git.repo.own` projects to, `maintain` that of `git.repo.maintain`, `commit` that of `git.commit.sign` (`none` is fork-based contribution). There is no member for `git.ns.admin` or `git.repo.create`, which project to no forge role whatever a bridge is configured with. Ordered: `own` is at least `maintain`, which is at least `commit`, and `commit` is at most `write`.",
/// "type": "object",
/// "required": [
/// "commit",
/// "maintain",
/// "own"
/// ],
/// "properties": {
/// "commit": {
/// "$ref": "#/definitions/MappedRole"
/// },
/// "maintain": {
/// "$ref": "#/definitions/MappedRole"
/// },
/// "own": {
/// "$ref": "#/definitions/MappedRole"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct RoleMap {
pub commit: MappedRole,
pub maintain: MappedRole,
pub own: MappedRole,
}
impl RoleMap {
pub fn builder() -> builder::RoleMap {
Default::default()
}
}
///One step of the last create, bootstrap or inspect job on the repository, as the bridge reported it.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "StepOutcome",
/// "description": "One step of the last create, bootstrap or inspect job on the repository, as the bridge reported it.",
/// "type": "object",
/// "required": [
/// "outcome",
/// "step"
/// ],
/// "properties": {
/// "detail": {
/// "description": "What the bridge said about it — an error, or why it was skipped.",
/// "type": "string",
/// "maxLength": 4096,
/// "minLength": 1
/// },
/// "outcome": {
/// "description": "`applied`, `unchanged`, `failed` or `skipped`. A client shows any other value as reported.",
/// "type": "string",
/// "maxLength": 32,
/// "minLength": 1
/// },
/// "step": {
/// "description": "The step, in the bridge's words (`workflow`, `keyring`, `variables`, `requiredCheck`).",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct StepOutcome {
///What the bridge said about it — an error, or why it was skipped.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub detail: ::std::option::Option<StepOutcomeDetail>,
///`applied`, `unchanged`, `failed` or `skipped`. A client shows any other value as reported.
pub outcome: StepOutcomeOutcome,
///The step, in the bridge's words (`workflow`, `keyring`, `variables`, `requiredCheck`).
pub step: StepOutcomeStep,
}
impl StepOutcome {
pub fn builder() -> builder::StepOutcome {
Default::default()
}
}
///What the bridge said about it — an error, or why it was skipped.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "What the bridge said about it — an error, or why it was skipped.",
/// "type": "string",
/// "maxLength": 4096,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct StepOutcomeDetail(::std::string::String);
impl ::std::ops::Deref for StepOutcomeDetail {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<StepOutcomeDetail> for ::std::string::String {
fn from(value: StepOutcomeDetail) -> Self {
value.0
}
}
impl ::std::str::FromStr for StepOutcomeDetail {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 4096usize {
return Err("longer than 4096 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for StepOutcomeDetail {
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 StepOutcomeDetail {
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 StepOutcomeDetail {
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 StepOutcomeDetail {
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())
})
}
}
///`applied`, `unchanged`, `failed` or `skipped`. A client shows any other value as reported.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "`applied`, `unchanged`, `failed` or `skipped`. A client shows any other value as reported.",
/// "type": "string",
/// "maxLength": 32,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct StepOutcomeOutcome(::std::string::String);
impl ::std::ops::Deref for StepOutcomeOutcome {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<StepOutcomeOutcome> for ::std::string::String {
fn from(value: StepOutcomeOutcome) -> Self {
value.0
}
}
impl ::std::str::FromStr for StepOutcomeOutcome {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 32usize {
return Err("longer than 32 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for StepOutcomeOutcome {
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 StepOutcomeOutcome {
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 StepOutcomeOutcome {
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 StepOutcomeOutcome {
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 step, in the bridge's words (`workflow`, `keyring`, `variables`, `requiredCheck`).
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The step, in the bridge's words (`workflow`, `keyring`, `variables`, `requiredCheck`).",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct StepOutcomeStep(::std::string::String);
impl ::std::ops::Deref for StepOutcomeStep {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<StepOutcomeStep> for ::std::string::String {
fn from(value: StepOutcomeStep) -> Self {
value.0
}
}
impl ::std::str::FromStr for StepOutcomeStep {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 64usize {
return Err("longer than 64 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for StepOutcomeStep {
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 StepOutcomeStep {
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 StepOutcomeStep {
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 StepOutcomeStep {
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 Bootstrap {
keyring: ::std::result::Result<bool, ::std::string::String>,
required_check: ::std::result::Result<bool, ::std::string::String>,
variables: ::std::result::Result<bool, ::std::string::String>,
workflow: ::std::result::Result<bool, ::std::string::String>,
}
impl ::std::default::Default for Bootstrap {
fn default() -> Self {
Self {
keyring: Err("no value supplied for keyring".to_string()),
required_check: Err("no value supplied for required_check".to_string()),
variables: Err("no value supplied for variables".to_string()),
workflow: Err("no value supplied for workflow".to_string()),
}
}
}
impl Bootstrap {
pub fn keyring<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.keyring = value
.try_into()
.map_err(|e| format!("error converting supplied value for keyring: {e}"));
self
}
pub fn required_check<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.required_check = value
.try_into()
.map_err(|e| format!("error converting supplied value for required_check: {e}"));
self
}
pub fn variables<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.variables = value
.try_into()
.map_err(|e| format!("error converting supplied value for variables: {e}"));
self
}
pub fn workflow<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.workflow = value
.try_into()
.map_err(|e| format!("error converting supplied value for workflow: {e}"));
self
}
}
impl ::std::convert::TryFrom<Bootstrap> for super::Bootstrap {
type Error = super::error::ConversionError;
fn try_from(
value: Bootstrap,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
keyring: value.keyring?,
required_check: value.required_check?,
variables: value.variables?,
workflow: value.workflow?,
})
}
}
impl ::std::convert::From<super::Bootstrap> for Bootstrap {
fn from(value: super::Bootstrap) -> Self {
Self {
keyring: Ok(value.keyring),
required_check: Ok(value.required_check),
variables: Ok(value.variables),
workflow: Ok(value.workflow),
}
}
}
#[derive(Clone, Debug)]
pub struct LastCheck {
at: ::std::result::Result<::chrono::DateTime<::chrono::offset::Utc>, ::std::string::String>,
conclusion: ::std::result::Result<super::LastCheckConclusion, ::std::string::String>,
sha: ::std::result::Result<
::std::option::Option<super::LastCheckSha>,
::std::string::String,
>,
}
impl ::std::default::Default for LastCheck {
fn default() -> Self {
Self {
at: Err("no value supplied for at".to_string()),
conclusion: Err("no value supplied for conclusion".to_string()),
sha: Ok(Default::default()),
}
}
}
impl LastCheck {
pub fn at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
T::Error: ::std::fmt::Display,
{
self.at = value
.try_into()
.map_err(|e| format!("error converting supplied value for at: {e}"));
self
}
pub fn conclusion<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::LastCheckConclusion>,
T::Error: ::std::fmt::Display,
{
self.conclusion = value
.try_into()
.map_err(|e| format!("error converting supplied value for conclusion: {e}"));
self
}
pub fn sha<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::LastCheckSha>>,
T::Error: ::std::fmt::Display,
{
self.sha = value
.try_into()
.map_err(|e| format!("error converting supplied value for sha: {e}"));
self
}
}
impl ::std::convert::TryFrom<LastCheck> for super::LastCheck {
type Error = super::error::ConversionError;
fn try_from(
value: LastCheck,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
at: value.at?,
conclusion: value.conclusion?,
sha: value.sha?,
})
}
}
impl ::std::convert::From<super::LastCheck> for LastCheck {
fn from(value: super::LastCheck) -> Self {
Self {
at: Ok(value.at),
conclusion: Ok(value.conclusion),
sha: Ok(value.sha),
}
}
}
#[derive(Clone, Debug)]
pub struct Payload {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
namespace:
::std::result::Result<::std::option::Option<super::NamespaceId>, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
namespace: Ok(Default::default()),
}
}
}
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 namespace<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::NamespaceId>>,
T::Error: ::std::fmt::Display,
{
self.namespace = value
.try_into()
.map_err(|e| format!("error converting supplied value for namespace: {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?,
namespace: value.namespace?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
ext: Ok(value.ext),
namespace: Ok(value.namespace),
}
}
}
#[derive(Clone, Debug)]
pub struct RepoStatus {
bootstrap: ::std::result::Result<super::Bootstrap, ::std::string::String>,
checked_at: ::std::result::Result<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
::std::string::String,
>,
committers: ::std::result::Result<u64, ::std::string::String>,
created_at:
::std::result::Result<::chrono::DateTime<::chrono::offset::Utc>, ::std::string::String>,
created_by: ::std::result::Result<::std::option::Option<super::Did>, ::std::string::String>,
drift_count: ::std::result::Result<u64, ::std::string::String>,
failed_step: ::std::result::Result<
::std::option::Option<super::RepoStatusFailedStep>,
::std::string::String,
>,
forge_id:
::std::result::Result<::std::option::Option<super::ForgeId>, ::std::string::String>,
guard: ::std::result::Result<
::std::option::Option<super::RepoStatusGuard>,
::std::string::String,
>,
id: ::std::result::Result<super::RepoStatusId, ::std::string::String>,
last_check:
::std::result::Result<::std::option::Option<super::LastCheck>, ::std::string::String>,
last_error: ::std::result::Result<
::std::option::Option<super::RepoStatusLastError>,
::std::string::String,
>,
maintainers: ::std::result::Result<u64, ::std::string::String>,
namespace: ::std::result::Result<super::NamespaceId, ::std::string::String>,
owners: ::std::result::Result<Vec<super::Did>, ::std::string::String>,
resource: ::std::result::Result<super::RepoResource, ::std::string::String>,
role_map:
::std::result::Result<::std::option::Option<super::RoleMap>, ::std::string::String>,
role_map_stale: ::std::result::Result<bool, ::std::string::String>,
state: ::std::result::Result<super::RepoStatusState, ::std::string::String>,
steps: ::std::result::Result<::std::vec::Vec<super::StepOutcome>, ::std::string::String>,
sync_state: ::std::result::Result<super::RepoStatusSyncState, ::std::string::String>,
visibility: ::std::result::Result<super::RepoVisibility, ::std::string::String>,
}
impl ::std::default::Default for RepoStatus {
fn default() -> Self {
Self {
bootstrap: Err("no value supplied for bootstrap".to_string()),
checked_at: Ok(Default::default()),
committers: Err("no value supplied for committers".to_string()),
created_at: Err("no value supplied for created_at".to_string()),
created_by: Ok(Default::default()),
drift_count: Err("no value supplied for drift_count".to_string()),
failed_step: Ok(Default::default()),
forge_id: Ok(Default::default()),
guard: Ok(Default::default()),
id: Err("no value supplied for id".to_string()),
last_check: Ok(Default::default()),
last_error: Ok(Default::default()),
maintainers: Err("no value supplied for maintainers".to_string()),
namespace: Err("no value supplied for namespace".to_string()),
owners: Err("no value supplied for owners".to_string()),
resource: Err("no value supplied for resource".to_string()),
role_map: Ok(Default::default()),
role_map_stale: Err("no value supplied for role_map_stale".to_string()),
state: Err("no value supplied for state".to_string()),
steps: Err("no value supplied for steps".to_string()),
sync_state: Err("no value supplied for sync_state".to_string()),
visibility: Err("no value supplied for visibility".to_string()),
}
}
}
impl RepoStatus {
pub fn bootstrap<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Bootstrap>,
T::Error: ::std::fmt::Display,
{
self.bootstrap = value
.try_into()
.map_err(|e| format!("error converting supplied value for bootstrap: {e}"));
self
}
pub fn checked_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
>,
T::Error: ::std::fmt::Display,
{
self.checked_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for checked_at: {e}"));
self
}
pub fn committers<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.committers = value
.try_into()
.map_err(|e| format!("error converting supplied value for committers: {e}"));
self
}
pub fn created_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
T::Error: ::std::fmt::Display,
{
self.created_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for created_at: {e}"));
self
}
pub fn created_by<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Did>>,
T::Error: ::std::fmt::Display,
{
self.created_by = value
.try_into()
.map_err(|e| format!("error converting supplied value for created_by: {e}"));
self
}
pub fn drift_count<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.drift_count = value
.try_into()
.map_err(|e| format!("error converting supplied value for drift_count: {e}"));
self
}
pub fn failed_step<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::RepoStatusFailedStep>>,
T::Error: ::std::fmt::Display,
{
self.failed_step = value
.try_into()
.map_err(|e| format!("error converting supplied value for failed_step: {e}"));
self
}
pub fn forge_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ForgeId>>,
T::Error: ::std::fmt::Display,
{
self.forge_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for forge_id: {e}"));
self
}
pub fn guard<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::RepoStatusGuard>>,
T::Error: ::std::fmt::Display,
{
self.guard = value
.try_into()
.map_err(|e| format!("error converting supplied value for guard: {e}"));
self
}
pub fn id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::RepoStatusId>,
T::Error: ::std::fmt::Display,
{
self.id = value
.try_into()
.map_err(|e| format!("error converting supplied value for id: {e}"));
self
}
pub fn last_check<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::LastCheck>>,
T::Error: ::std::fmt::Display,
{
self.last_check = value
.try_into()
.map_err(|e| format!("error converting supplied value for last_check: {e}"));
self
}
pub fn last_error<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::RepoStatusLastError>>,
T::Error: ::std::fmt::Display,
{
self.last_error = value
.try_into()
.map_err(|e| format!("error converting supplied value for last_error: {e}"));
self
}
pub fn maintainers<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.maintainers = value
.try_into()
.map_err(|e| format!("error converting supplied value for maintainers: {e}"));
self
}
pub fn namespace<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::NamespaceId>,
T::Error: ::std::fmt::Display,
{
self.namespace = value
.try_into()
.map_err(|e| format!("error converting supplied value for namespace: {e}"));
self
}
pub fn owners<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<Vec<super::Did>>,
T::Error: ::std::fmt::Display,
{
self.owners = value
.try_into()
.map_err(|e| format!("error converting supplied value for owners: {e}"));
self
}
pub fn resource<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::RepoResource>,
T::Error: ::std::fmt::Display,
{
self.resource = value
.try_into()
.map_err(|e| format!("error converting supplied value for resource: {e}"));
self
}
pub fn role_map<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::RoleMap>>,
T::Error: ::std::fmt::Display,
{
self.role_map = value
.try_into()
.map_err(|e| format!("error converting supplied value for role_map: {e}"));
self
}
pub fn role_map_stale<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.role_map_stale = value
.try_into()
.map_err(|e| format!("error converting supplied value for role_map_stale: {e}"));
self
}
pub fn state<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::RepoStatusState>,
T::Error: ::std::fmt::Display,
{
self.state = value
.try_into()
.map_err(|e| format!("error converting supplied value for state: {e}"));
self
}
pub fn steps<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::StepOutcome>>,
T::Error: ::std::fmt::Display,
{
self.steps = value
.try_into()
.map_err(|e| format!("error converting supplied value for steps: {e}"));
self
}
pub fn sync_state<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::RepoStatusSyncState>,
T::Error: ::std::fmt::Display,
{
self.sync_state = value
.try_into()
.map_err(|e| format!("error converting supplied value for sync_state: {e}"));
self
}
pub fn visibility<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::RepoVisibility>,
T::Error: ::std::fmt::Display,
{
self.visibility = value
.try_into()
.map_err(|e| format!("error converting supplied value for visibility: {e}"));
self
}
}
impl ::std::convert::TryFrom<RepoStatus> for super::RepoStatus {
type Error = super::error::ConversionError;
fn try_from(
value: RepoStatus,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
bootstrap: value.bootstrap?,
checked_at: value.checked_at?,
committers: value.committers?,
created_at: value.created_at?,
created_by: value.created_by?,
drift_count: value.drift_count?,
failed_step: value.failed_step?,
forge_id: value.forge_id?,
guard: value.guard?,
id: value.id?,
last_check: value.last_check?,
last_error: value.last_error?,
maintainers: value.maintainers?,
namespace: value.namespace?,
owners: value.owners?,
resource: value.resource?,
role_map: value.role_map?,
role_map_stale: value.role_map_stale?,
state: value.state?,
steps: value.steps?,
sync_state: value.sync_state?,
visibility: value.visibility?,
})
}
}
impl ::std::convert::From<super::RepoStatus> for RepoStatus {
fn from(value: super::RepoStatus) -> Self {
Self {
bootstrap: Ok(value.bootstrap),
checked_at: Ok(value.checked_at),
committers: Ok(value.committers),
created_at: Ok(value.created_at),
created_by: Ok(value.created_by),
drift_count: Ok(value.drift_count),
failed_step: Ok(value.failed_step),
forge_id: Ok(value.forge_id),
guard: Ok(value.guard),
id: Ok(value.id),
last_check: Ok(value.last_check),
last_error: Ok(value.last_error),
maintainers: Ok(value.maintainers),
namespace: Ok(value.namespace),
owners: Ok(value.owners),
resource: Ok(value.resource),
role_map: Ok(value.role_map),
role_map_stale: Ok(value.role_map_stale),
state: Ok(value.state),
steps: Ok(value.steps),
sync_state: Ok(value.sync_state),
visibility: Ok(value.visibility),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
repos: ::std::result::Result<::std::vec::Vec<super::RepoStatus>, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
repos: Err("no value supplied for repos".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 repos<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::RepoStatus>>,
T::Error: ::std::fmt::Display,
{
self.repos = value
.try_into()
.map_err(|e| format!("error converting supplied value for repos: {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?,
repos: value.repos?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
ext: Ok(value.ext),
repos: Ok(value.repos),
}
}
}
#[derive(Clone, Debug)]
pub struct RoleMap {
commit: ::std::result::Result<super::MappedRole, ::std::string::String>,
maintain: ::std::result::Result<super::MappedRole, ::std::string::String>,
own: ::std::result::Result<super::MappedRole, ::std::string::String>,
}
impl ::std::default::Default for RoleMap {
fn default() -> Self {
Self {
commit: Err("no value supplied for commit".to_string()),
maintain: Err("no value supplied for maintain".to_string()),
own: Err("no value supplied for own".to_string()),
}
}
}
impl RoleMap {
pub fn commit<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::MappedRole>,
T::Error: ::std::fmt::Display,
{
self.commit = value
.try_into()
.map_err(|e| format!("error converting supplied value for commit: {e}"));
self
}
pub fn maintain<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::MappedRole>,
T::Error: ::std::fmt::Display,
{
self.maintain = value
.try_into()
.map_err(|e| format!("error converting supplied value for maintain: {e}"));
self
}
pub fn own<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::MappedRole>,
T::Error: ::std::fmt::Display,
{
self.own = value
.try_into()
.map_err(|e| format!("error converting supplied value for own: {e}"));
self
}
}
impl ::std::convert::TryFrom<RoleMap> for super::RoleMap {
type Error = super::error::ConversionError;
fn try_from(value: RoleMap) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
commit: value.commit?,
maintain: value.maintain?,
own: value.own?,
})
}
}
impl ::std::convert::From<super::RoleMap> for RoleMap {
fn from(value: super::RoleMap) -> Self {
Self {
commit: Ok(value.commit),
maintain: Ok(value.maintain),
own: Ok(value.own),
}
}
}
#[derive(Clone, Debug)]
pub struct StepOutcome {
detail: ::std::result::Result<
::std::option::Option<super::StepOutcomeDetail>,
::std::string::String,
>,
outcome: ::std::result::Result<super::StepOutcomeOutcome, ::std::string::String>,
step: ::std::result::Result<super::StepOutcomeStep, ::std::string::String>,
}
impl ::std::default::Default for StepOutcome {
fn default() -> Self {
Self {
detail: Ok(Default::default()),
outcome: Err("no value supplied for outcome".to_string()),
step: Err("no value supplied for step".to_string()),
}
}
}
impl StepOutcome {
pub fn detail<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::StepOutcomeDetail>>,
T::Error: ::std::fmt::Display,
{
self.detail = value
.try_into()
.map_err(|e| format!("error converting supplied value for detail: {e}"));
self
}
pub fn outcome<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::StepOutcomeOutcome>,
T::Error: ::std::fmt::Display,
{
self.outcome = value
.try_into()
.map_err(|e| format!("error converting supplied value for outcome: {e}"));
self
}
pub fn step<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::StepOutcomeStep>,
T::Error: ::std::fmt::Display,
{
self.step = value
.try_into()
.map_err(|e| format!("error converting supplied value for step: {e}"));
self
}
}
impl ::std::convert::TryFrom<StepOutcome> for super::StepOutcome {
type Error = super::error::ConversionError;
fn try_from(
value: StepOutcome,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
detail: value.detail?,
outcome: value.outcome?,
step: value.step?,
})
}
}
impl ::std::convert::From<super::StepOutcome> for StepOutcome {
fn from(value: super::StepOutcome) -> Self {
Self {
detail: Ok(value.detail),
outcome: Ok(value.outcome),
step: Ok(value.step),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/git-ns/repo/list/0.1";
const IS_PROOF_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\n \"$defs\": {\n \"Bootstrap\": {\n \"additionalProperties\": false,\n \"description\": \"Whether each step that turns commit trust on for a repository is in place, as last reported. A step that this forge's plan does not need reads `true`.\",\n \"properties\": {\n \"keyring\": {\n \"description\": \"The exempt platform keyring for forge-signed merge commits is committed, or the forge's plan does not need one.\",\n \"type\": \"boolean\"\n },\n \"requiredCheck\": {\n \"description\": \"The forge refuses to merge into the default branch unless the verify-trust check passes, with no bypass, and a pull request cannot change what that check runs: an organisation-required workflow, code-owner review of workflow files, or protected workflow paths, as the forge allows.\",\n \"type\": \"boolean\"\n },\n \"variables\": {\n \"description\": \"The repository names the Trust Registry and this VTC as its trust anchors.\",\n \"type\": \"boolean\"\n },\n \"workflow\": {\n \"description\": \"The verify-trust check runs on the repository's pull requests — from a workflow committed to it, or, where the forge supports it, required on it from the namespace's own bridge-managed workflow repository at a pinned commit.\",\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"workflow\",\n \"keyring\",\n \"variables\",\n \"requiredCheck\"\n ],\n \"title\": \"Bootstrap\",\n \"type\": \"object\"\n },\n \"Did\": {\n \"description\": \"A bare DID in the W3C DID Core syntax (§3.1): `did:`, a method name of lowercase letters and digits, `:`, and a method-specific id of colon-separated segments drawn from `A-Z a-z 0-9 . - _` and percent-encoded octets, the last segment non-empty. A DID URL is not a DID: no path, query or fragment (`/`, `?`, `#`), so a verification-method id such as `did:key:z6Mk…#z6Mk…` is refused. Compared by exact string equality — no case folding or percent-decoding. A consumer MUST still treat the value as data: the pattern keeps shell metacharacters, whitespace and quotes out of the wire form, but it does not make a DID safe to splice into a command or markup.\",\n \"maxLength\": 2048,\n \"pattern\": \"^did:[a-z0-9]+:(?:(?:[A-Za-z0-9._-]|%[0-9A-Fa-f]{2})*:)*(?:[A-Za-z0-9._-]|%[0-9A-Fa-f]{2})+$\",\n \"title\": \"Did\",\n \"type\": \"string\"\n },\n \"Ext\": {\n \"additionalProperties\": true,\n \"description\": \"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"ForgeId\": {\n \"description\": \"An identifier the forge itself assigns — a repository id, a user or organisation id — carried as a string so a forge whose ids are not numbers needs no new version. GitHub and Forgejo ids are decimal integers written as strings (`\\\"812736451\\\"`). Unlike a name, it survives renames and transfers, which is why rights and bindings are keyed by it.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"title\": \"ForgeId\",\n \"type\": \"string\"\n },\n \"LastCheck\": {\n \"additionalProperties\": false,\n \"description\": \"The last verify-trust check run the bridge saw on the repository.\",\n \"properties\": {\n \"at\": {\n \"description\": \"When the check concluded.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"conclusion\": {\n \"description\": \"The check's conclusion, in the forge's words (`success`, `failure`).\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"sha\": {\n \"description\": \"The commit it ran on.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"conclusion\",\n \"at\"\n ],\n \"title\": \"LastCheck\",\n \"type\": \"object\"\n },\n \"MappedRole\": {\n \"description\": \"A level of the bridge's forge-neutral role ladder, lowest first: the vocabulary role drift's `observed` and `expected` are reported in. `none` is no direct role on the repository.\",\n \"enum\": [\n \"none\",\n \"read\",\n \"triage\",\n \"write\",\n \"maintain\",\n \"admin\"\n ],\n \"title\": \"MappedRole\",\n \"type\": \"string\"\n },\n \"NamespaceId\": {\n \"description\": \"The VTC's opaque identifier for a namespace, assigned when it is bound. Stable for the life of the binding; never reused for another binding.\",\n \"maxLength\": 128,\n \"minLength\": 1,\n \"title\": \"NamespaceId\",\n \"type\": \"string\"\n },\n \"RepoResource\": {\n \"description\": \"A forge-qualified resource naming exactly one repository: `<forge-host>/<owner>/<repo>`, lowercase.\",\n \"maxLength\": 455,\n \"pattern\": \"^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+/[a-z0-9_-][a-z0-9._-]{0,99}/[a-z0-9_-][a-z0-9._-]{0,99}$\",\n \"title\": \"RepoResource\",\n \"type\": \"string\"\n },\n \"RepoStatus\": {\n \"additionalProperties\": false,\n \"description\": \"One repository as its administrators govern it: who owns it, how many hold rights on it, how far commit trust is set up, and how its forge compares with the VTC's projection.\",\n \"properties\": {\n \"bootstrap\": {\n \"$ref\": \"#/$defs/Bootstrap\"\n },\n \"checkedAt\": {\n \"description\": \"When the forge was last compared. Absent if never.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"committers\": {\n \"description\": \"How many live records of `git.commit.sign` it has. Implied rights are not counted.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"createdAt\": {\n \"description\": \"When the VTC first recorded it.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"createdBy\": {\n \"$ref\": \"#/$defs/Did\",\n \"description\": \"Who created it through the VTC. Absent for an adopted or unmanaged repository.\"\n },\n \"driftCount\": {\n \"description\": \"How many drift items are outstanding. The items themselves are in `git-ns/view`.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"failedStep\": {\n \"description\": \"The step that failed on the last create or bootstrap.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"forgeId\": {\n \"$ref\": \"#/$defs/ForgeId\",\n \"description\": \"The forge's repository id, once confirmed.\"\n },\n \"guard\": {\n \"description\": \"The guard in force against a pull request satisfying its own check, as the bridge last reported it: `requiredWorkflow`, `codeOwnerReview`, `bridgePostedCheck`, `protectedFiles` or `none`. A client treats any other value as `none`.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"id\": {\n \"description\": \"The VTC's identifier for the repository record.\",\n \"maxLength\": 128,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"lastCheck\": {\n \"$ref\": \"#/$defs/LastCheck\"\n },\n \"lastError\": {\n \"description\": \"What the bridge said when that step failed.\",\n \"maxLength\": 4096,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"maintainers\": {\n \"description\": \"How many live records of `git.repo.maintain` it has. Implied rights are not counted.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"namespace\": {\n \"$ref\": \"#/$defs/NamespaceId\",\n \"description\": \"The namespace it was recorded in. For a `detached` repository, possibly one no longer bound.\"\n },\n \"owners\": {\n \"description\": \"The DIDs holding a live, explicitly recorded `git.repo.own` on it.\",\n \"items\": {\n \"$ref\": \"#/$defs/Did\"\n },\n \"type\": \"array\",\n \"uniqueItems\": true\n },\n \"resource\": {\n \"$ref\": \"#/$defs/RepoResource\"\n },\n \"roleMap\": {\n \"$ref\": \"#/$defs/RoleMap\",\n \"description\": \"The forge role each right projects to on this repository under the serving bridge's reported map. Absent while the namespace's map is unknown.\"\n },\n \"roleMapStale\": {\n \"description\": \"The bridge last projected this repository's roles under an earlier role map, and the re-projection queued for it has not yet succeeded.\",\n \"type\": \"boolean\"\n },\n \"state\": {\n \"description\": \"As `RepoSummary.state` in the shared schema.\",\n \"enum\": [\n \"pendingCreate\",\n \"active\",\n \"archived\",\n \"detached\",\n \"orphaned\",\n \"unmanaged\"\n ],\n \"type\": \"string\"\n },\n \"steps\": {\n \"description\": \"Per-step outcomes of the last create, bootstrap or inspect job. Empty until one has been reported.\",\n \"items\": {\n \"$ref\": \"#/$defs/StepOutcome\"\n },\n \"maxItems\": 64,\n \"type\": \"array\"\n },\n \"syncState\": {\n \"description\": \"As `Sync.state` in the shared schema.\",\n \"enum\": [\n \"inSync\",\n \"drift\",\n \"pending\",\n \"unchecked\"\n ],\n \"type\": \"string\"\n },\n \"visibility\": {\n \"$ref\": \"#/$defs/RepoVisibility\"\n }\n },\n \"required\": [\n \"id\",\n \"namespace\",\n \"resource\",\n \"visibility\",\n \"state\",\n \"owners\",\n \"maintainers\",\n \"committers\",\n \"bootstrap\",\n \"syncState\",\n \"driftCount\",\n \"createdAt\",\n \"steps\",\n \"roleMapStale\"\n ],\n \"title\": \"RepoStatus\",\n \"type\": \"object\"\n },\n \"RepoVisibility\": {\n \"description\": \"Repository visibility on the forge.\",\n \"enum\": [\n \"public\",\n \"private\"\n ],\n \"title\": \"RepoVisibility\",\n \"type\": \"string\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"The repositories in the namespaces the caller administers, or in the one asked for.\",\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"repos\": {\n \"description\": \"Every repository recorded in an administered namespace, in any state, ordered by `resource`; for a holder of the community-administrator capability without `namespace`, also every repository whose namespace is no longer bound.\",\n \"items\": {\n \"$ref\": \"#/$defs/RepoStatus\"\n },\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"repos\"\n ],\n \"title\": \"Git Namespaces — List Repositories — response payload\",\n \"type\": \"object\"\n },\n \"RoleMap\": {\n \"additionalProperties\": false,\n \"description\": \"The forge role each repository right is given, as the forge applies it: after the forge's own ladder has rounded it down. `own` is the role `git.repo.own` projects to, `maintain` that of `git.repo.maintain`, `commit` that of `git.commit.sign` (`none` is fork-based contribution). There is no member for `git.ns.admin` or `git.repo.create`, which project to no forge role whatever a bridge is configured with. Ordered: `own` is at least `maintain`, which is at least `commit`, and `commit` is at most `write`.\",\n \"properties\": {\n \"commit\": {\n \"$ref\": \"#/$defs/MappedRole\"\n },\n \"maintain\": {\n \"$ref\": \"#/$defs/MappedRole\"\n },\n \"own\": {\n \"$ref\": \"#/$defs/MappedRole\"\n }\n },\n \"required\": [\n \"own\",\n \"maintain\",\n \"commit\"\n ],\n \"title\": \"RoleMap\",\n \"type\": \"object\"\n },\n \"StepOutcome\": {\n \"additionalProperties\": false,\n \"description\": \"One step of the last create, bootstrap or inspect job on the repository, as the bridge reported it.\",\n \"properties\": {\n \"detail\": {\n \"description\": \"What the bridge said about it — an error, or why it was skipped.\",\n \"maxLength\": 4096,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"outcome\": {\n \"description\": \"`applied`, `unchanged`, `failed` or `skipped`. A client shows any other value as reported.\",\n \"maxLength\": 32,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"step\": {\n \"description\": \"The step, in the bridge's words (`workflow`, `keyring`, `variables`, `requiredCheck`).\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"step\",\n \"outcome\"\n ],\n \"title\": \"StepOutcome\",\n \"type\": \"object\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/git-ns/repo/list/0.1\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"description\": \"An administrator lists the repositories recorded in the namespaces they administer — every one, for a holder of the community-administrator capability — with owners, right counts, bootstrap, sync and forge status.\",\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"namespace\": {\n \"$ref\": \"#/$defs/NamespaceId\",\n \"description\": \"Only the repositories in this namespace. It must be one the caller administers; a namespace they do not administer, or one this VTC does not have, is refused with `notAdministrator` alike.\"\n }\n },\n \"required\": [],\n \"title\": \"Git Namespaces — List Repositories — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/git-ns/repo/list/0.1#response";
const IS_PROOF_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\n \"$defs\": {\n \"Bootstrap\": {\n \"additionalProperties\": false,\n \"description\": \"Whether each step that turns commit trust on for a repository is in place, as last reported. A step that this forge's plan does not need reads `true`.\",\n \"properties\": {\n \"keyring\": {\n \"description\": \"The exempt platform keyring for forge-signed merge commits is committed, or the forge's plan does not need one.\",\n \"type\": \"boolean\"\n },\n \"requiredCheck\": {\n \"description\": \"The forge refuses to merge into the default branch unless the verify-trust check passes, with no bypass, and a pull request cannot change what that check runs: an organisation-required workflow, code-owner review of workflow files, or protected workflow paths, as the forge allows.\",\n \"type\": \"boolean\"\n },\n \"variables\": {\n \"description\": \"The repository names the Trust Registry and this VTC as its trust anchors.\",\n \"type\": \"boolean\"\n },\n \"workflow\": {\n \"description\": \"The verify-trust check runs on the repository's pull requests — from a workflow committed to it, or, where the forge supports it, required on it from the namespace's own bridge-managed workflow repository at a pinned commit.\",\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"workflow\",\n \"keyring\",\n \"variables\",\n \"requiredCheck\"\n ],\n \"title\": \"Bootstrap\",\n \"type\": \"object\"\n },\n \"Did\": {\n \"description\": \"A bare DID in the W3C DID Core syntax (§3.1): `did:`, a method name of lowercase letters and digits, `:`, and a method-specific id of colon-separated segments drawn from `A-Z a-z 0-9 . - _` and percent-encoded octets, the last segment non-empty. A DID URL is not a DID: no path, query or fragment (`/`, `?`, `#`), so a verification-method id such as `did:key:z6Mk…#z6Mk…` is refused. Compared by exact string equality — no case folding or percent-decoding. A consumer MUST still treat the value as data: the pattern keeps shell metacharacters, whitespace and quotes out of the wire form, but it does not make a DID safe to splice into a command or markup.\",\n \"maxLength\": 2048,\n \"pattern\": \"^did:[a-z0-9]+:(?:(?:[A-Za-z0-9._-]|%[0-9A-Fa-f]{2})*:)*(?:[A-Za-z0-9._-]|%[0-9A-Fa-f]{2})+$\",\n \"title\": \"Did\",\n \"type\": \"string\"\n },\n \"Ext\": {\n \"additionalProperties\": true,\n \"description\": \"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"ForgeId\": {\n \"description\": \"An identifier the forge itself assigns — a repository id, a user or organisation id — carried as a string so a forge whose ids are not numbers needs no new version. GitHub and Forgejo ids are decimal integers written as strings (`\\\"812736451\\\"`). Unlike a name, it survives renames and transfers, which is why rights and bindings are keyed by it.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"title\": \"ForgeId\",\n \"type\": \"string\"\n },\n \"LastCheck\": {\n \"additionalProperties\": false,\n \"description\": \"The last verify-trust check run the bridge saw on the repository.\",\n \"properties\": {\n \"at\": {\n \"description\": \"When the check concluded.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"conclusion\": {\n \"description\": \"The check's conclusion, in the forge's words (`success`, `failure`).\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"sha\": {\n \"description\": \"The commit it ran on.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"conclusion\",\n \"at\"\n ],\n \"title\": \"LastCheck\",\n \"type\": \"object\"\n },\n \"MappedRole\": {\n \"description\": \"A level of the bridge's forge-neutral role ladder, lowest first: the vocabulary role drift's `observed` and `expected` are reported in. `none` is no direct role on the repository.\",\n \"enum\": [\n \"none\",\n \"read\",\n \"triage\",\n \"write\",\n \"maintain\",\n \"admin\"\n ],\n \"title\": \"MappedRole\",\n \"type\": \"string\"\n },\n \"NamespaceId\": {\n \"description\": \"The VTC's opaque identifier for a namespace, assigned when it is bound. Stable for the life of the binding; never reused for another binding.\",\n \"maxLength\": 128,\n \"minLength\": 1,\n \"title\": \"NamespaceId\",\n \"type\": \"string\"\n },\n \"RepoResource\": {\n \"description\": \"A forge-qualified resource naming exactly one repository: `<forge-host>/<owner>/<repo>`, lowercase.\",\n \"maxLength\": 455,\n \"pattern\": \"^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+/[a-z0-9_-][a-z0-9._-]{0,99}/[a-z0-9_-][a-z0-9._-]{0,99}$\",\n \"title\": \"RepoResource\",\n \"type\": \"string\"\n },\n \"RepoStatus\": {\n \"additionalProperties\": false,\n \"description\": \"One repository as its administrators govern it: who owns it, how many hold rights on it, how far commit trust is set up, and how its forge compares with the VTC's projection.\",\n \"properties\": {\n \"bootstrap\": {\n \"$ref\": \"#/$defs/Bootstrap\"\n },\n \"checkedAt\": {\n \"description\": \"When the forge was last compared. Absent if never.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"committers\": {\n \"description\": \"How many live records of `git.commit.sign` it has. Implied rights are not counted.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"createdAt\": {\n \"description\": \"When the VTC first recorded it.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"createdBy\": {\n \"$ref\": \"#/$defs/Did\",\n \"description\": \"Who created it through the VTC. Absent for an adopted or unmanaged repository.\"\n },\n \"driftCount\": {\n \"description\": \"How many drift items are outstanding. The items themselves are in `git-ns/view`.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"failedStep\": {\n \"description\": \"The step that failed on the last create or bootstrap.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"forgeId\": {\n \"$ref\": \"#/$defs/ForgeId\",\n \"description\": \"The forge's repository id, once confirmed.\"\n },\n \"guard\": {\n \"description\": \"The guard in force against a pull request satisfying its own check, as the bridge last reported it: `requiredWorkflow`, `codeOwnerReview`, `bridgePostedCheck`, `protectedFiles` or `none`. A client treats any other value as `none`.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"id\": {\n \"description\": \"The VTC's identifier for the repository record.\",\n \"maxLength\": 128,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"lastCheck\": {\n \"$ref\": \"#/$defs/LastCheck\"\n },\n \"lastError\": {\n \"description\": \"What the bridge said when that step failed.\",\n \"maxLength\": 4096,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"maintainers\": {\n \"description\": \"How many live records of `git.repo.maintain` it has. Implied rights are not counted.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"namespace\": {\n \"$ref\": \"#/$defs/NamespaceId\",\n \"description\": \"The namespace it was recorded in. For a `detached` repository, possibly one no longer bound.\"\n },\n \"owners\": {\n \"description\": \"The DIDs holding a live, explicitly recorded `git.repo.own` on it.\",\n \"items\": {\n \"$ref\": \"#/$defs/Did\"\n },\n \"type\": \"array\",\n \"uniqueItems\": true\n },\n \"resource\": {\n \"$ref\": \"#/$defs/RepoResource\"\n },\n \"roleMap\": {\n \"$ref\": \"#/$defs/RoleMap\",\n \"description\": \"The forge role each right projects to on this repository under the serving bridge's reported map. Absent while the namespace's map is unknown.\"\n },\n \"roleMapStale\": {\n \"description\": \"The bridge last projected this repository's roles under an earlier role map, and the re-projection queued for it has not yet succeeded.\",\n \"type\": \"boolean\"\n },\n \"state\": {\n \"description\": \"As `RepoSummary.state` in the shared schema.\",\n \"enum\": [\n \"pendingCreate\",\n \"active\",\n \"archived\",\n \"detached\",\n \"orphaned\",\n \"unmanaged\"\n ],\n \"type\": \"string\"\n },\n \"steps\": {\n \"description\": \"Per-step outcomes of the last create, bootstrap or inspect job. Empty until one has been reported.\",\n \"items\": {\n \"$ref\": \"#/$defs/StepOutcome\"\n },\n \"maxItems\": 64,\n \"type\": \"array\"\n },\n \"syncState\": {\n \"description\": \"As `Sync.state` in the shared schema.\",\n \"enum\": [\n \"inSync\",\n \"drift\",\n \"pending\",\n \"unchecked\"\n ],\n \"type\": \"string\"\n },\n \"visibility\": {\n \"$ref\": \"#/$defs/RepoVisibility\"\n }\n },\n \"required\": [\n \"id\",\n \"namespace\",\n \"resource\",\n \"visibility\",\n \"state\",\n \"owners\",\n \"maintainers\",\n \"committers\",\n \"bootstrap\",\n \"syncState\",\n \"driftCount\",\n \"createdAt\",\n \"steps\",\n \"roleMapStale\"\n ],\n \"title\": \"RepoStatus\",\n \"type\": \"object\"\n },\n \"RepoVisibility\": {\n \"description\": \"Repository visibility on the forge.\",\n \"enum\": [\n \"public\",\n \"private\"\n ],\n \"title\": \"RepoVisibility\",\n \"type\": \"string\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"The repositories in the namespaces the caller administers, or in the one asked for.\",\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"repos\": {\n \"description\": \"Every repository recorded in an administered namespace, in any state, ordered by `resource`; for a holder of the community-administrator capability without `namespace`, also every repository whose namespace is no longer bound.\",\n \"items\": {\n \"$ref\": \"#/$defs/RepoStatus\"\n },\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"repos\"\n ],\n \"title\": \"Git Namespaces — List Repositories — response payload\",\n \"type\": \"object\"\n },\n \"RoleMap\": {\n \"additionalProperties\": false,\n \"description\": \"The forge role each repository right is given, as the forge applies it: after the forge's own ladder has rounded it down. `own` is the role `git.repo.own` projects to, `maintain` that of `git.repo.maintain`, `commit` that of `git.commit.sign` (`none` is fork-based contribution). There is no member for `git.ns.admin` or `git.repo.create`, which project to no forge role whatever a bridge is configured with. Ordered: `own` is at least `maintain`, which is at least `commit`, and `commit` is at most `write`.\",\n \"properties\": {\n \"commit\": {\n \"$ref\": \"#/$defs/MappedRole\"\n },\n \"maintain\": {\n \"$ref\": \"#/$defs/MappedRole\"\n },\n \"own\": {\n \"$ref\": \"#/$defs/MappedRole\"\n }\n },\n \"required\": [\n \"own\",\n \"maintain\",\n \"commit\"\n ],\n \"title\": \"RoleMap\",\n \"type\": \"object\"\n },\n \"StepOutcome\": {\n \"additionalProperties\": false,\n \"description\": \"One step of the last create, bootstrap or inspect job on the repository, as the bridge reported it.\",\n \"properties\": {\n \"detail\": {\n \"description\": \"What the bridge said about it — an error, or why it was skipped.\",\n \"maxLength\": 4096,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"outcome\": {\n \"description\": \"`applied`, `unchanged`, `failed` or `skipped`. A client shows any other value as reported.\",\n \"maxLength\": 32,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"step\": {\n \"description\": \"The step, in the bridge's words (`workflow`, `keyring`, `variables`, `requiredCheck`).\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"step\",\n \"outcome\"\n ],\n \"title\": \"StepOutcome\",\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_ADMINISTRATOR];
/// 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 {
/// `git-ns/repo/list:notAdministrator`
///
/// The caller administers no namespace — they hold neither the community-administrator capability nor a live, explicitly recorded `git.ns.admin` — or `namespace` names one they do not administer or one this VTC does not have. The three are answered alike, so the code cannot be used to learn which namespaces exist.
///
/// Declared `retryable: false`.
pub const NOT_ADMINISTRATOR: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "git-ns/repo/list:notAdministrator",
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:7a2e4c10-3b5d-4f6e-9a1b-2c3d4e5f6a11\",\n \"type\": \"https://trusttasks.org/spec/git-ns/repo/list/0.1\",\n \"threadId\": \"urn:uuid:7a2e4c10-3b5d-4f6e-9a1b-2c3d4e5f6a11\",\n \"issuer\": \"did:webvh:QmCarolScid3:acme-vtc.example:carol\",\n \"recipient\": \"did:webvh:QmVtcScid7:acme-vtc.example\",\n \"issuedAt\": \"2026-09-26T09:05:00Z\",\n \"payload\": {\n \"namespace\": \"ns_01J8Z6Q4M2\"\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:7a2e4c10-3b5d-4f6e-9a1b-2c3d4e5f6a12\",\n \"type\": \"https://trusttasks.org/spec/git-ns/repo/list/0.1#response\",\n \"threadId\": \"urn:uuid:7a2e4c10-3b5d-4f6e-9a1b-2c3d4e5f6a11\",\n \"issuer\": \"did:webvh:QmVtcScid7:acme-vtc.example\",\n \"recipient\": \"did:webvh:QmCarolScid3:acme-vtc.example:carol\",\n \"issuedAt\": \"2026-09-26T09:05:01Z\",\n \"payload\": {\n \"repos\": [\n {\n \"id\": \"repo_01J8Z7A1B2\",\n \"namespace\": \"ns_01J8Z6Q4M2\",\n \"resource\": \"github.com/acme/gadgets\",\n \"forgeId\": \"812736990\",\n \"visibility\": \"public\",\n \"state\": \"active\",\n \"owners\": [\"did:webvh:QmBobScid2:acme-vtc.example:bob\"],\n \"maintainers\": 0,\n \"committers\": 1,\n \"bootstrap\": {\n \"workflow\": true,\n \"keyring\": true,\n \"variables\": true,\n \"requiredCheck\": true\n },\n \"syncState\": \"inSync\",\n \"checkedAt\": \"2026-09-26T08:58:00Z\",\n \"driftCount\": 0,\n \"createdBy\": \"did:webvh:QmBobScid2:acme-vtc.example:bob\",\n \"createdAt\": \"2026-09-23T10:05:00Z\",\n \"guard\": \"requiredWorkflow\",\n \"steps\": [\n { \"step\": \"workflow\", \"outcome\": \"unchanged\" },\n { \"step\": \"requiredCheck\", \"outcome\": \"applied\" }\n ],\n \"lastCheck\": {\n \"conclusion\": \"success\",\n \"at\": \"2026-09-26T08:40:12Z\",\n \"sha\": \"9f2c4e1ab37d\"\n },\n \"roleMap\": {\n \"own\": \"admin\",\n \"maintain\": \"maintain\",\n \"commit\": \"write\"\n },\n \"roleMapStale\": false\n },\n {\n \"id\": \"repo_01J8Z7A1B1\",\n \"namespace\": \"ns_01J8Z6Q4M2\",\n \"resource\": \"github.com/acme/widgets\",\n \"forgeId\": \"812736451\",\n \"visibility\": \"public\",\n \"state\": \"active\",\n \"owners\": [\n \"did:webvh:QmAliceScid1:acme-vtc.example:alice\",\n \"did:webvh:QmCarolScid3:acme-vtc.example:carol\"\n ],\n \"maintainers\": 1,\n \"committers\": 4,\n \"bootstrap\": {\n \"workflow\": true,\n \"keyring\": true,\n \"variables\": true,\n \"requiredCheck\": false\n },\n \"syncState\": \"drift\",\n \"checkedAt\": \"2026-09-26T08:58:00Z\",\n \"driftCount\": 1,\n \"failedStep\": \"requiredCheck\",\n \"lastError\": \"the installation lacks administration:write\",\n \"createdAt\": \"2026-09-23T09:50:00Z\",\n \"guard\": \"none\",\n \"steps\": [\n { \"step\": \"requiredCheck\", \"outcome\": \"failed\", \"detail\": \"the installation lacks administration:write\" }\n ],\n \"roleMap\": {\n \"own\": \"admin\",\n \"maintain\": \"maintain\",\n \"commit\": \"write\"\n },\n \"roleMapStale\": false\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)] = &[
(
"There is no subject: the answer is the caller's own administered namespaces, never someone else's.",
"{\n \"subject\": \"did:webvh:QmBobScid2:acme-vtc.example:bob\"\n}",
),
(
"`namespace` is the VTC's identifier; it cannot be empty.",
"{\n \"namespace\": \"\"\n}",
),
(
"A resource filter belongs to `git-ns/view`; this listing narrows by namespace only.",
"{\n \"resource\": \"github.com/acme\"\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
);
}
}
}