OpenAPI schema fixes (#2590)

* OpenAPI schema fixes
* Adding OpenAPI schema checks to the release script
This commit is contained in:
James Hodgkinson 2024-03-01 16:57:36 +10:00 committed by GitHub
parent e35f5093a0
commit dbf59474bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 225 additions and 93 deletions

View file

@ -24,7 +24,7 @@ pub use self::error::*;
pub use self::raw::*; pub use self::raw::*;
pub use self::token::*; pub use self::token::*;
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone, ToSchema)]
/// This is a description of a linked or connected application for a user. This is /// This is a description of a linked or connected application for a user. This is
/// used in the UI to render applications on the dashboard for a user to access. /// used in the UI to render applications on the dashboard for a user to access.
pub enum AppLink { pub enum AppLink {
@ -37,7 +37,9 @@ pub enum AppLink {
}, },
} }
#[derive(Debug, Serialize, Deserialize, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] #[derive(
Debug, Serialize, Deserialize, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, ToSchema,
)]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
#[derive(TryFromPrimitive)] #[derive(TryFromPrimitive)]
#[repr(u16)] #[repr(u16)]
@ -81,7 +83,7 @@ pub enum IdentifyUserRequest {
DisplayCode, DisplayCode,
} }
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, ToSchema)]
pub enum IdentifyUserResponse { pub enum IdentifyUserResponse {
IdentityVerificationUnavailable, IdentityVerificationUnavailable,
IdentityVerificationAvailable, IdentityVerificationAvailable,

View file

@ -27,15 +27,21 @@ if [ ! -s "${WORKDIR}/openapi.json" ]; then
exit 1 exit 1
fi fi
echo "Running pythonopenapi/openapi-spec-validator"
docker run \ docker run \
--mount "type=bind,src=${WORKDIR}/openapi.json,target=/openapi.json" \ --mount "type=bind,src=${WORKDIR}/openapi.json,target=/openapi.json" \
--rm pythonopenapi/openapi-spec-validator /openapi.json && \ --rm pythonopenapi/openapi-spec-validator /openapi.json && \
echo "openapi-spec-validator passed" echo "openapi-spec-validator passed"
docker run --rm -it \ echo "Running openapitools/openapi-generator-cli"
docker run --rm \
--mount "type=bind,src=${WORKDIR},target=/spec" \ --mount "type=bind,src=${WORKDIR},target=/spec" \
openapitools/openapi-generator-cli generate \ openapitools/openapi-generator-cli validate \
-i /spec/openapi.json -g rust -i /spec/openapi.json
cleanup "${WORKDIR}" cleanup "${WORKDIR}"
echo "It looks to have passed OK!"

View file

@ -66,12 +66,16 @@ done
../../scripts/setup_dev_environment.sh ../../scripts/setup_dev_environment.sh
if [ -n "$CURRENT_DIR" ]; then
cd "$CURRENT_DIR" || exit 1
fi
echo "Running the OpenAPI schema checks"
bash -c ./scripts/openapi_tests/check_openapi_spec.sh || exit 1
echo "Waiting ${WAIT_TIMER} seconds and terminating Kanidmd" echo "Waiting ${WAIT_TIMER} seconds and terminating Kanidmd"
sleep "${WAIT_TIMER}" sleep "${WAIT_TIMER}"
if [ "$(pgrep kanidmd | wc -l)" -gt 0 ]; then if [ "$(pgrep kanidmd | wc -l)" -gt 0 ]; then
kill $(pgrep kanidmd) kill $(pgrep kanidmd)
fi fi
if [ -n "$CURRENT_DIR" ]; then
cd "$CURRENT_DIR" || exit 1
fi

View file

@ -34,6 +34,16 @@ impl Modify for SecurityAddon {
// docs for the derive macro are here: <https://docs.rs/utoipa-gen/3.5.0/utoipa_gen/derive.OpenApi.html#info-attribute-syntax> // docs for the derive macro are here: <https://docs.rs/utoipa-gen/3.5.0/utoipa_gen/derive.OpenApi.html#info-attribute-syntax>
#[derive(OpenApi)] #[derive(OpenApi)]
#[openapi( #[openapi(
servers(
(url="https://{host}:{port}",
variables(
("host" = (default="localhost", description="Server's hostname")),
("port" = (default="8443", description="Server HTTPS port")),
)
)
),
external_docs(url = "https://kanidm.com/docs", description = "Kanidm documentation page"),
paths( paths(
super::generic::status, super::generic::status,
super::generic::robots_txt, super::generic::robots_txt,
@ -188,55 +198,60 @@ impl Modify for SecurityAddon {
scim_v1::ScimSyncRetentionMode, scim_v1::ScimSyncRetentionMode,
// TODO: can't add Entry/ProtoEntry to schema as this was only recently supported utoipa v3.5.0 doesn't support it - ref <https://github.com/juhaku/utoipa/pull/756/files> // TODO: can't add Entry/ProtoEntry to schema as this was only recently supported utoipa v3.5.0 doesn't support it - ref <https://github.com/juhaku/utoipa/pull/756/files>
// v1::Entry, // v1::Entry,
v1::AccountUnixExtend,
internal::ApiToken, internal::ApiToken,
v1::ApiTokenGenerate, internal::ApiTokenPurpose,
v1::AuthRequest,
v1::AuthResponse,
v1::AuthState,
internal::BackupCodesView, internal::BackupCodesView,
internal::CreateRequest, internal::CreateRequest,
internal::CredentialDetail, internal::CredentialDetail,
internal::CredentialDetailType,
internal::CredentialStatus, internal::CredentialStatus,
internal::CUExtPortal,
internal::CUIntentToken, internal::CUIntentToken,
internal::CURegState,
internal::CUSessionToken, internal::CUSessionToken,
internal::CUStatus, internal::CUStatus,
internal::DeleteRequest, internal::DeleteRequest,
internal::Filter,
internal::Group, internal::Group,
v1::GroupUnixExtend, internal::Modify,
internal::ModifyList, internal::ModifyList,
internal::ModifyRequest, internal::ModifyRequest,
internal::OperationError,
internal::PasskeyDetail, internal::PasskeyDetail,
internal::PasswordFeedback,
internal::PluginError,
internal::RadiusAuthToken, internal::RadiusAuthToken,
internal::SchemaError,
internal::SearchRequest, internal::SearchRequest,
internal::SearchResponse, internal::SearchResponse,
v1::SingleStringRequest,
internal::TotpSecret,
internal::TotpAlgo, internal::TotpAlgo,
v1::UatStatus, internal::TotpSecret,
v1::UnixGroupToken, internal::UatPurpose,
v1::UnixUserToken,
internal::UserAuthToken, internal::UserAuthToken,
v1::WhoamiResponse, v1::AccountUnixExtend,
internal::ApiTokenPurpose, v1::ApiTokenGenerate,
v1::AuthStep, v1::AuthAllowed,
v1::AuthCredential,
v1::AuthIssueSession, v1::AuthIssueSession,
v1::AuthMech, v1::AuthMech,
v1::AuthCredential, v1::AuthRequest,
v1::AuthAllowed, v1::AuthResponse,
internal::CUExtPortal, v1::AuthState,
internal::CURegState, v1::AuthStep,
internal::CredentialDetailType,
v1::Entry, v1::Entry,
internal::Filter, v1::GroupUnixExtend,
internal::Modify, v1::SingleStringRequest,
v1::UatStatusState, internal::UiHint,
v1::UatPurposeStatus, v1::UatPurposeStatus,
internal::UatPurpose, v1::UatStatus,
internal::OperationError, v1::UatStatusState,
internal::SchemaError, v1::UnixGroupToken,
internal::PluginError, v1::UnixUserToken,
internal::PasswordFeedback, v1::WhoamiResponse,
internal::CUCredState,
internal::CURegWarning,
internal::IdentifyUserResponse,
internal::AppLink,
internal::IdentifyUserRequest, internal::IdentifyUserRequest,
// terrible workaround for other things // terrible workaround for other things
@ -266,9 +281,9 @@ impl Modify for SecurityAddon {
), ),
info( info(
title = "Kanidm", title = "Kanidm",
description = "API for interacting with the Kanidm system. This is a work in progress", description = "API for interacting with the Kanidm system. This is a work in progress.",
contact( // <https://docs.rs/utoipa-gen/3.5.0/utoipa_gen/derive.OpenApi.html#info-attribute-syntax> contact( // <https://docs.rs/utoipa-gen/3.5.0/utoipa_gen/derive.OpenApi.html#info-attribute-syntax>
name="Kanidm", name="Kanidm Github",
url="https://github.com/kanidm/kanidm", url="https://github.com/kanidm/kanidm",
) )
) )

View file

@ -38,6 +38,7 @@ pub async fn status(
(status = 200, description = "Ok"), (status = 200, description = "Ok"),
), ),
tag = "ui", tag = "ui",
operation_id = "robots_txt",
)] )]
pub async fn robots_txt() -> impl IntoResponse { pub async fn robots_txt() -> impl IntoResponse {

View file

@ -82,6 +82,7 @@ pub(crate) fn oauth2_id(rs_name: &str) -> Filter<FilterInvalid> {
#[utoipa::path( #[utoipa::path(
get, get,
path = "/ui/images/oauth2/{rs_name}", path = "/ui/images/oauth2/{rs_name}",
operation_id = "oauth2_image_get",
responses( responses(
(status = 200, description = "Ok", body=&[u8]), (status = 200, description = "Ok", body=&[u8]),
(status = 403, description = "Authorization refused"), (status = 403, description = "Authorization refused"),

View file

@ -49,6 +49,7 @@ pub(crate) struct SessionId {
request_body=CreateRequest, request_body=CreateRequest,
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/raw", tag = "v1/raw",
operation_id="raw_create"
)] )]
/// Raw request to the system, be warned this can be dangerous! /// Raw request to the system, be warned this can be dangerous!
pub async fn raw_create( pub async fn raw_create(
@ -74,6 +75,7 @@ pub async fn raw_create(
request_body=ModifyRequest, request_body=ModifyRequest,
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/raw", tag = "v1/raw",
operation_id="raw_modify"
)] )]
/// Raw request to the system, be warned this can be dangerous! /// Raw request to the system, be warned this can be dangerous!
pub async fn raw_modify( pub async fn raw_modify(
@ -99,6 +101,7 @@ pub async fn raw_modify(
request_body=DeleteRequest, request_body=DeleteRequest,
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/raw", tag = "v1/raw",
operation_id = "raw_delete"
)] )]
/// Raw request to the system, be warned this can be dangerous! /// Raw request to the system, be warned this can be dangerous!
pub async fn raw_delete( pub async fn raw_delete(
@ -119,12 +122,13 @@ pub async fn raw_delete(
post, post,
path = "/v1/raw/search", path = "/v1/raw/search",
responses( responses(
(status = 200), // TODO: response content (status = 200, body=SearchResponse, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
request_body=SearchRequest, request_body=SearchRequest,
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/raw", tag = "v1/raw",
operation_id="raw_search"
)] )]
/// Raw request to the system, be warned this can be dangerous! /// Raw request to the system, be warned this can be dangerous!
pub async fn raw_search( pub async fn raw_search(
@ -145,11 +149,12 @@ pub async fn raw_search(
get, get,
path = "/v1/self", path = "/v1/self",
responses( responses(
(status = 200), // TODO: response content (status = 200, body=WhoamiResponse, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/self", tag = "v1/self",
operation_id="whoami"
)] )]
// Whoami? // Whoami?
pub async fn whoami( pub async fn whoami(
@ -170,11 +175,12 @@ pub async fn whoami(
get, get,
path = "/v1/self/_uat", path = "/v1/self/_uat",
responses( responses(
(status = 200, description = "Ok"), (status = 200, description = "Ok", body=UserAuthToken, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/self", tag = "v1/self",
operation_id="whoami_uat"
)] )]
pub async fn whoami_uat( pub async fn whoami_uat(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -197,6 +203,7 @@ pub async fn whoami_uat(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/auth", tag = "v1/auth",
operation_id="logout"
)] )]
pub async fn logout( pub async fn logout(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -441,11 +448,12 @@ pub async fn json_rest_event_delete_attr(
get, get,
path = "/v1/schema", path = "/v1/schema",
responses( responses(
(status=200), // TODO: define response (status=200, content_type="application/json", body=Vec<ProtoEntry>),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/schema", tag = "v1/schema",
operation_id = "schema_get",
)] )]
// Whoami? // Whoami?
pub async fn schema_get( pub async fn schema_get(
@ -468,11 +476,12 @@ pub async fn schema_get(
get, get,
path = "/v1/schema/attributetype", path = "/v1/schema/attributetype",
responses( responses(
(status=200), // TODO: define response (status=200, content_type="application/json", body=Vec<ProtoEntry>),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/schema", tag = "v1/schema",
operation_id = "schema_attributetype_get",
)] )]
pub async fn schema_attributetype_get( pub async fn schema_attributetype_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -487,11 +496,12 @@ pub async fn schema_attributetype_get(
get, get,
path = "/v1/schema/attributetype/{id}", path = "/v1/schema/attributetype/{id}",
responses( responses(
(status=200), // TODO: define response (status=200, body=Option<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/schema", tag = "v1/schema",
operation_id = "schema_attributetype_get_id",
)] )]
pub async fn schema_attributetype_get_id( pub async fn schema_attributetype_get_id(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -521,11 +531,12 @@ pub async fn schema_attributetype_get_id(
get, get,
path = "/v1/schema/classtype", path = "/v1/schema/classtype",
responses( responses(
(status=200), // TODO: define response (status=200, body=Vec<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/schema", tag = "v1/schema",
operation_id="schema_classtype_get",
)] )]
pub async fn schema_classtype_get( pub async fn schema_classtype_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -540,11 +551,12 @@ pub async fn schema_classtype_get(
get, get,
path = "/v1/schema/classtype/{id}", path = "/v1/schema/classtype/{id}",
responses( responses(
(status=200), // TODO: define response (status=200, body=Option<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/schema", tag = "v1/schema",
operation_id="schema_classtype_get_id",
)] )]
pub async fn schema_classtype_get_id( pub async fn schema_classtype_get_id(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -570,11 +582,12 @@ pub async fn schema_classtype_get_id(
get, get,
path = "/v1/person", path = "/v1/person",
responses( responses(
(status=200), // TODO: define response (status=200, body=Vec<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person", tag = "v1/person",
operation_id = "person_get",
)] )]
pub async fn person_get( pub async fn person_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -591,9 +604,10 @@ pub async fn person_get(
responses( responses(
DefaultApiResponse, DefaultApiResponse,
), ),
// request_body=ProtoEntry, // TODO: ProtoEntry can't be serialized, so we need to do this manually request_body=ProtoEntry,
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person", tag = "v1/person",
operation_id = "person_post",
)] )]
/// Expects the following fields in the attrs field of the req: [name, displayname] /// Expects the following fields in the attrs field of the req: [name, displayname]
pub async fn person_post( pub async fn person_post(
@ -614,11 +628,12 @@ pub async fn person_post(
get, get,
path = "/v1/person/{id}", path = "/v1/person/{id}",
responses( responses(
(status=200), // TODO: define response (status=200, body=Option<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person", tag = "v1/person",
operation_id = "person_id_get",
)] )]
pub async fn person_id_get( pub async fn person_id_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -638,6 +653,7 @@ pub async fn person_id_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person", tag = "v1/person",
operation_id = "person_id_delete",
)] )]
pub async fn person_id_delete( pub async fn person_id_delete(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -655,11 +671,12 @@ pub async fn person_id_delete(
get, get,
path = "/v1/service_account", path = "/v1/service_account",
responses( responses(
(status=200), // TODO: define response (status=200, body=Vec<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_get",
)] )]
pub async fn service_account_get( pub async fn service_account_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -673,12 +690,13 @@ pub async fn service_account_get(
#[utoipa::path( #[utoipa::path(
post, post,
path = "/v1/service_account", path = "/v1/service_account",
// request_body=Json, // TODO ProtoEntry can't be serialized, so we need to do this manually request_body=ProtoEntry,
responses( responses(
DefaultApiResponse, DefaultApiResponse,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_post",
)] )]
pub async fn service_account_post( pub async fn service_account_post(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -700,9 +718,10 @@ pub async fn service_account_post(
responses( responses(
DefaultApiResponse, DefaultApiResponse,
), ),
// request_body=ProtoEntry, // TODO: can't deal with a HashMap in the attr request_body=ProtoEntry,
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_id_patch",
)] )]
pub async fn service_account_id_patch( pub async fn service_account_id_patch(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -726,11 +745,12 @@ pub async fn service_account_id_patch(
get, get,
path = "/v1/service_account/{id}", path = "/v1/service_account/{id}",
responses( responses(
(status=200), // TODO: define response (status=200, body=Option<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_id_get",
)] )]
pub async fn service_account_id_get( pub async fn service_account_id_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -818,11 +838,12 @@ pub async fn service_account_into_person(
get, get,
path = "/v1/service_account/{id}/_spi_token", path = "/v1/service_account/{id}/_spi_token",
responses( responses(
(status=200), // TODO: define response (status=200, body=Vec<ApiToken>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_api_token_get",
)] )]
pub async fn service_account_api_token_get( pub async fn service_account_api_token_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -843,11 +864,12 @@ pub async fn service_account_api_token_get(
path = "/v1/service_account/{id}/_spi_token", path = "/v1/service_account/{id}/_spi_token",
request_body = ApiTokenGenerate, request_body = ApiTokenGenerate,
responses( responses(
(status=200), // TODO: define response (status=200, body=String, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_api_token_post",
)] )]
pub async fn service_account_api_token_post( pub async fn service_account_api_token_post(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -879,6 +901,7 @@ pub async fn service_account_api_token_post(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_api_token_delete",
)] )]
pub async fn service_account_api_token_delete( pub async fn service_account_api_token_delete(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -898,12 +921,13 @@ pub async fn service_account_api_token_delete(
get, get,
path = "/v1/person/{id}/_attr/{attr}", path = "/v1/person/{id}/_attr/{attr}",
responses( responses(
(status=200), // TODO: define response (status=200, body=Option<Vec<String>>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
(status = 403, description = "Authorzation refused"), (status = 403, description = "Authorzation refused"),
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person/attr", tag = "v1/person/attr",
operation_id = "person_id_get_attr",
)] )]
pub async fn person_id_get_attr( pub async fn person_id_get_attr(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -919,11 +943,12 @@ pub async fn person_id_get_attr(
get, get,
path = "/v1/service_account/{id}/_attr/{attr}", path = "/v1/service_account/{id}/_attr/{attr}",
responses( responses(
(status=200), // TODO: define response (status=200, body=Option<Vec<String>>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_id_get_attr",
)] )]
pub async fn service_account_id_get_attr( pub async fn service_account_id_get_attr(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -944,6 +969,7 @@ pub async fn service_account_id_get_attr(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person/attr", tag = "v1/person/attr",
operation_id = "person_id_post_attr",
)] )]
pub async fn person_id_post_attr( pub async fn person_id_post_attr(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -965,6 +991,7 @@ pub async fn person_id_post_attr(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_id_post_attr",
)] )]
pub async fn service_account_id_post_attr( pub async fn service_account_id_post_attr(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -985,6 +1012,7 @@ pub async fn service_account_id_post_attr(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person/attr", tag = "v1/person/attr",
operation_id = "person_id_delete_attr",
)] )]
pub async fn person_id_delete_attr( pub async fn person_id_delete_attr(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1004,6 +1032,7 @@ pub async fn person_id_delete_attr(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_id_delete_attr",
)] )]
pub async fn service_account_id_delete_attr( pub async fn service_account_id_delete_attr(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1023,6 +1052,7 @@ pub async fn service_account_id_delete_attr(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person/attr", tag = "v1/person/attr",
operation_id = "person_id_put_attr",
)] )]
pub async fn person_id_put_attr( pub async fn person_id_put_attr(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1044,6 +1074,7 @@ pub async fn person_id_put_attr(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_id_put_attr",
)] )]
pub async fn service_account_id_put_attr( pub async fn service_account_id_put_attr(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1062,9 +1093,10 @@ pub async fn service_account_id_put_attr(
responses( responses(
DefaultApiResponse, DefaultApiResponse,
), ),
// request_body=ProtoEntry, // TODO: can't deal with a HashMap in the attr request_body=ProtoEntry,
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person", tag = "v1/person",
operation_id = "person_id_patch",
)] )]
pub async fn person_id_patch( pub async fn person_id_patch(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1426,6 +1458,7 @@ pub async fn person_get_id_credential_status(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person/ssh_pubkeys", tag = "v1/person/ssh_pubkeys",
operation_id = "person_id_ssh_pubkeys_get",
)] )]
pub async fn person_id_ssh_pubkeys_get( pub async fn person_id_ssh_pubkeys_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1450,6 +1483,7 @@ pub async fn person_id_ssh_pubkeys_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/account", tag = "v1/account",
operation_id = "account_id_ssh_pubkeys_get",
)] )]
#[deprecated] #[deprecated]
pub async fn account_id_ssh_pubkeys_get( pub async fn account_id_ssh_pubkeys_get(
@ -1475,6 +1509,7 @@ pub async fn account_id_ssh_pubkeys_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_id_ssh_pubkeys_get",
)] )]
pub async fn service_account_id_ssh_pubkeys_get( pub async fn service_account_id_ssh_pubkeys_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1498,6 +1533,7 @@ pub async fn service_account_id_ssh_pubkeys_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person/ssh_pubkeys", tag = "v1/person/ssh_pubkeys",
operation_id = "person_id_ssh_pubkeys_post",
)] )]
pub async fn person_id_ssh_pubkeys_post( pub async fn person_id_ssh_pubkeys_post(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1525,6 +1561,7 @@ pub async fn person_id_ssh_pubkeys_post(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_id_ssh_pubkeys_post",
)] )]
pub async fn service_account_id_ssh_pubkeys_post( pub async fn service_account_id_ssh_pubkeys_post(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1552,6 +1589,7 @@ pub async fn service_account_id_ssh_pubkeys_post(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person/ssh_pubkeys/tag", tag = "v1/person/ssh_pubkeys/tag",
operation_id = "person_id_ssh_pubkeys_tag_get",
)] )]
pub async fn person_id_ssh_pubkeys_tag_get( pub async fn person_id_ssh_pubkeys_tag_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1575,6 +1613,7 @@ pub async fn person_id_ssh_pubkeys_tag_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/account", tag = "v1/account",
operation_id = "account_id_ssh_pubkeys_tag_get",
)] )]
pub async fn account_id_ssh_pubkeys_tag_get( pub async fn account_id_ssh_pubkeys_tag_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1599,6 +1638,7 @@ pub async fn account_id_ssh_pubkeys_tag_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/service_account", tag = "v1/service_account",
operation_id = "service_account_id_ssh_pubkeys_tag_get",
)] )]
pub async fn service_account_id_ssh_pubkeys_tag_get( pub async fn service_account_id_ssh_pubkeys_tag_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1625,6 +1665,7 @@ pub async fn service_account_id_ssh_pubkeys_tag_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person/ssh_pubkeys/tag", tag = "v1/person/ssh_pubkeys/tag",
operation_id = "person_id_ssh_pubkeys_tag_delete",
)] )]
pub async fn person_id_ssh_pubkeys_tag_delete( pub async fn person_id_ssh_pubkeys_tag_delete(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1660,6 +1701,7 @@ pub async fn person_id_ssh_pubkeys_tag_delete(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person", tag = "v1/person",
operation_id = "service_account_id_ssh_pubkeys_tag_delete",
)] )]
pub async fn service_account_id_ssh_pubkeys_tag_delete( pub async fn service_account_id_ssh_pubkeys_tag_delete(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1693,6 +1735,7 @@ pub async fn service_account_id_ssh_pubkeys_tag_delete(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person/radius", tag = "v1/person/radius",
operation_id = "person_id_radius_get"
)] )]
/// Get and return a single str /// Get and return a single str
pub async fn person_id_radius_get( pub async fn person_id_radius_get(
@ -1719,8 +1762,8 @@ pub async fn person_id_radius_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person/radius", tag = "v1/person/radius",
operation_id = "person_id_radius_post"
)] )]
// TODO: what body do we take here?
pub async fn person_id_radius_post( pub async fn person_id_radius_post(
State(state): State<ServerState>, State(state): State<ServerState>,
Extension(kopid): Extension<KOpId>, Extension(kopid): Extension<KOpId>,
@ -1744,6 +1787,7 @@ pub async fn person_id_radius_post(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person", tag = "v1/person",
operation_id = "person_id_radius_delete"
)] )]
pub async fn person_id_radius_delete( pub async fn person_id_radius_delete(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1756,16 +1800,16 @@ pub async fn person_id_radius_delete(
json_rest_event_delete_id_attr(state, id, attr, filter, None, kopid, client_auth_info).await json_rest_event_delete_id_attr(state, id, attr, filter, None, kopid, client_auth_info).await
} }
// /v1/person/:id/_radius/_token
#[utoipa::path( #[utoipa::path(
get, get,
path = "/v1/person/{id}/_radius/_token", path = "/v1/person/{id}/_radius/_token",
responses( responses(
(status=200), // TODO: define response (status=200, body=RadiusAuthToken, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person/radius", tag = "v1/person/radius",
operation_id = "person_id_radius_token_get"
)] )]
pub async fn person_id_radius_token_get( pub async fn person_id_radius_token_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1781,11 +1825,12 @@ pub async fn person_id_radius_token_get(
get, get,
path = "/v1/account/{id}/_radius/_token", path = "/v1/account/{id}/_radius/_token",
responses( responses(
(status=200), // TODO: define response (status=200, body=RadiusAuthToken, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/account", tag = "v1/account",
operation_id = "account_id_radius_token_get"
)] )]
pub async fn account_id_radius_token_get( pub async fn account_id_radius_token_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1800,12 +1845,13 @@ pub async fn account_id_radius_token_get(
post, post,
path = "/v1/account/{id}/_radius/_token", path = "/v1/account/{id}/_radius/_token",
responses( responses(
(status=200), // TODO: define response (status=200, body=RadiusAuthToken, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person", tag = "v1/person",
)] // TODO: what body do we expect here? operation_id = "account_id_radius_token_post"
)]
pub async fn account_id_radius_token_post( pub async fn account_id_radius_token_post(
State(state): State<ServerState>, State(state): State<ServerState>,
Path(id): Path<String>, Path(id): Path<String>,
@ -1912,12 +1958,13 @@ pub async fn account_id_unix_post(
get,post, get,post,
path = "/v1/account/{id}/_unix/_token", path = "/v1/account/{id}/_unix/_token",
responses( responses(
(status=200), // TODO: define response (status=200, body=UnixUserToken, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/account", tag = "v1/account",
)] // TODO: what body do we expect here? operation_id = "account_id_unix_token"
)]
#[instrument(level = "INFO", skip_all)] #[instrument(level = "INFO", skip_all)]
pub async fn account_id_unix_token( pub async fn account_id_unix_token(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -1953,12 +2000,13 @@ pub async fn account_id_unix_token(
post, post,
path = "/v1/account/{id}/_unix/_auth", path = "/v1/account/{id}/_unix/_auth",
responses( responses(
(status=200), // TODO: define response (status=200, body=Option<UnixUserToken>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/account", tag = "v1/account",
)] // TODO: what body do we expect here? operation_id = "account_id_unix_auth_post"
)]
pub async fn account_id_unix_auth_post( pub async fn account_id_unix_auth_post(
State(state): State<ServerState>, State(state): State<ServerState>,
Extension(kopid): Extension<KOpId>, Extension(kopid): Extension<KOpId>,
@ -1983,7 +2031,8 @@ pub async fn account_id_unix_auth_post(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person/unix", tag = "v1/person/unix",
)] // TODO: what body do we expect here? operation_id = "person_id_unix_credential_put"
)]
pub async fn person_id_unix_credential_put( pub async fn person_id_unix_credential_put(
State(state): State<ServerState>, State(state): State<ServerState>,
Extension(kopid): Extension<KOpId>, Extension(kopid): Extension<KOpId>,
@ -2007,6 +2056,7 @@ pub async fn person_id_unix_credential_put(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person/unix", tag = "v1/person/unix",
operation_id = "person_id_unix_credential_delete"
)] )]
pub async fn person_id_unix_credential_delete( pub async fn person_id_unix_credential_delete(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2033,12 +2083,13 @@ pub async fn person_id_unix_credential_delete(
post, post,
path = "/v1/person/{id}/_identify/_user", path = "/v1/person/{id}/_identify/_user",
responses( responses(
(status=200), // TODO: define response (status=200, body=IdentifyUserResponse, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/person", tag = "v1/person",
)] // TODO: what body do we expect here? operation_id = "person_identify_user_post"
)]
pub async fn person_identify_user_post( pub async fn person_identify_user_post(
State(state): State<ServerState>, State(state): State<ServerState>,
Extension(kopid): Extension<KOpId>, Extension(kopid): Extension<KOpId>,
@ -2058,11 +2109,12 @@ pub async fn person_identify_user_post(
get, get,
path = "/v1/group", path = "/v1/group",
responses( responses(
(status=200), // TODO: define response (status=200,body=Vec<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/group", tag = "v1/group",
operation_id = "group_get",
)] )]
/// Returns all groups visible to the user /// Returns all groups visible to the user
pub async fn group_get( pub async fn group_get(
@ -2085,7 +2137,8 @@ pub async fn group_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/group", tag = "v1/group",
)] // TODO: post body operation_id = "group_post",
)]
pub async fn group_post( pub async fn group_post(
State(state): State<ServerState>, State(state): State<ServerState>,
Extension(kopid): Extension<KOpId>, Extension(kopid): Extension<KOpId>,
@ -2100,11 +2153,12 @@ pub async fn group_post(
get, get,
path = "/v1/group/{id}", path = "/v1/group/{id}",
responses( responses(
(status=200), // TODO: define response (status=200, body=Option<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/group", tag = "v1/group",
operation_id = "group_id_get",
)] )]
pub async fn group_id_get( pub async fn group_id_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2124,6 +2178,7 @@ pub async fn group_id_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/group", tag = "v1/group",
operation_id = "group_id_delete",
)] )]
pub async fn group_id_delete( pub async fn group_id_delete(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2139,11 +2194,12 @@ pub async fn group_id_delete(
get, get,
path = "/v1/group/{id}/_attr/{attr}", path = "/v1/group/{id}/_attr/{attr}",
responses( responses(
(status=200), // TODO: define response (status=200, body=Vec<String>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/group/attr", tag = "v1/group/attr",
operation_id = "group_id_attr_get",
)] )]
pub async fn group_id_attr_get( pub async fn group_id_attr_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2164,6 +2220,7 @@ pub async fn group_id_attr_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/group/attr", tag = "v1/group/attr",
operation_id = "group_id_attr_post",
)] )]
pub async fn group_id_attr_post( pub async fn group_id_attr_post(
Path((id, attr)): Path<(String, String)>, Path((id, attr)): Path<(String, String)>,
@ -2185,6 +2242,7 @@ pub async fn group_id_attr_post(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/group/attr", tag = "v1/group/attr",
operation_id = "group_id_attr_delete",
)] )]
pub async fn group_id_attr_delete( pub async fn group_id_attr_delete(
Path((id, attr)): Path<(String, String)>, Path((id, attr)): Path<(String, String)>,
@ -2207,6 +2265,7 @@ pub async fn group_id_attr_delete(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/group/attr", tag = "v1/group/attr",
operation_id = "group_id_attr_put",
)] )]
pub async fn group_id_attr_put( pub async fn group_id_attr_put(
Path((id, attr)): Path<(String, String)>, Path((id, attr)): Path<(String, String)>,
@ -2228,6 +2287,7 @@ pub async fn group_id_attr_put(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/group/unix", tag = "v1/group/unix",
operation_id = "group_id_unix_put",
)] )]
pub async fn group_id_unix_post( pub async fn group_id_unix_post(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2248,11 +2308,12 @@ pub async fn group_id_unix_post(
get, get,
path = "/v1/group/{id}/_unix/_token", path = "/v1/group/{id}/_unix/_token",
responses( responses(
(status=200), // TODO: define response (status=200, body=UnixGroupToken, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/group/unix", tag = "v1/group/unix",
operation_id = "group_id_unix_token_get",
)] )]
pub async fn group_id_unix_token_get( pub async fn group_id_unix_token_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2272,11 +2333,12 @@ pub async fn group_id_unix_token_get(
get, get,
path = "/v1/domain", path = "/v1/domain",
responses( responses(
(status=200), // TODO: define response (status=200, body=Vec<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/domain", tag = "v1/domain",
operation_id = "domain_get",
)] )]
pub async fn domain_get( pub async fn domain_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2291,11 +2353,12 @@ pub async fn domain_get(
get, get,
path = "/v1/domain/_attr/{attr}", path = "/v1/domain/_attr/{attr}",
responses( responses(
(status=200), // TODO: define response (status=200, body=Option<Vec<String>>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/domain", tag = "v1/domain",
operation_id = "domain_attr_get",
)] )]
pub async fn domain_attr_get( pub async fn domain_attr_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2324,6 +2387,7 @@ pub async fn domain_attr_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/domain", tag = "v1/domain",
operation_id = "domain_attr_put",
)] )]
pub async fn domain_attr_put( pub async fn domain_attr_put(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2354,6 +2418,7 @@ pub async fn domain_attr_put(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/domain", tag = "v1/domain",
operation_id = "domain_attr_delete",
)] )]
pub async fn domain_attr_delete( pub async fn domain_attr_delete(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2379,11 +2444,12 @@ pub async fn domain_attr_delete(
get, get,
path = "/v1/system", path = "/v1/system",
responses( responses(
(status=200), // TODO: define response (status=200,body=Vec<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/system", tag = "v1/system",
operation_id = "system_get",
)] )]
pub async fn system_get( pub async fn system_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2401,11 +2467,12 @@ pub async fn system_get(
get, get,
path = "/v1/system/_attr/{attr}", path = "/v1/system/_attr/{attr}",
responses( responses(
(status=200), // TODO: define response (status=200, body=Option<Vec<String>>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/system", tag = "v1/system",
operation_id = "system_attr_get",
)] )]
pub async fn system_attr_get( pub async fn system_attr_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2434,6 +2501,7 @@ pub async fn system_attr_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/system", tag = "v1/system",
operation_id = "system_attr_post",
)] )]
pub async fn system_attr_post( pub async fn system_attr_post(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2464,6 +2532,7 @@ pub async fn system_attr_post(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/system", tag = "v1/system",
operation_id = "system_attr_delete",
)] )]
pub async fn system_attr_delete( pub async fn system_attr_delete(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2494,6 +2563,7 @@ pub async fn system_attr_delete(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/system", tag = "v1/system",
operation_id = "system_attr_put",
)] )]
pub async fn system_attr_put( pub async fn system_attr_put(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2519,11 +2589,12 @@ pub async fn system_attr_put(
post, post,
path = "/v1/recycle_bin", path = "/v1/recycle_bin",
responses( responses(
(status=200), // TODO: define response (status=200,body=Vec<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/recycle_bin", tag = "v1/recycle_bin",
operation_id="recycle_bin_get",
)] )]
pub async fn recycle_bin_get( pub async fn recycle_bin_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2544,11 +2615,12 @@ pub async fn recycle_bin_get(
get, get,
path = "/v1/recycle_bin/{id}", path = "/v1/recycle_bin/{id}",
responses( responses(
(status=200), // TODO: define response (status=200, body=Option<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/recycle_bin", tag = "v1/recycle_bin",
operation_id = "recycle_bin_id_get",
)] )]
pub async fn recycle_bin_id_get( pub async fn recycle_bin_id_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2576,6 +2648,7 @@ pub async fn recycle_bin_id_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/recycle_bin", tag = "v1/recycle_bin",
operation_id = "recycle_bin_revive_id_post",
)] )]
pub async fn recycle_bin_revive_id_post( pub async fn recycle_bin_revive_id_post(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2596,11 +2669,12 @@ pub async fn recycle_bin_revive_id_post(
get, get,
path = "/v1/self/_applinks", path = "/v1/self/_applinks",
responses( responses(
(status=200), // TODO: define response (status=200, body=Vec<AppLink>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/self", tag = "v1/self",
operation_id = "self_applinks_get",
)] )]
/// Returns your OAuth2 app links for the Web UI /// Returns your OAuth2 app links for the Web UI
pub async fn applinks_get( pub async fn applinks_get(
@ -2620,12 +2694,13 @@ pub async fn applinks_get(
post, post,
path = "/v1/reauth", path = "/v1/reauth",
responses( responses(
(status=200), // TODO: define response (status=200, content_type="application/json"), // TODO: define response
ApiResponseWithout200, ApiResponseWithout200,
), ),
request_body = AuthIssueSession, request_body = AuthIssueSession,
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/auth", tag = "v1/auth",
operation_id = "reauth_post",
)] // TODO: post body stuff )] // TODO: post body stuff
pub async fn reauth( pub async fn reauth(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2646,12 +2721,13 @@ pub async fn reauth(
post, post,
path = "/v1/auth", path = "/v1/auth",
responses( responses(
(status=200), // TODO: define response (status=200, content_type="application/json"), // TODO: define response
ApiResponseWithout200, ApiResponseWithout200,
), ),
request_body = AuthRequest, request_body = AuthRequest,
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/auth", tag = "v1/auth",
operation_id = "auth_post",
)] )]
pub async fn auth( pub async fn auth(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2775,6 +2851,7 @@ fn auth_session_state_management(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/auth", tag = "v1/auth",
operation_id = "auth_valid",
)] )]
pub async fn auth_valid( pub async fn auth_valid(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -2793,10 +2870,11 @@ pub async fn auth_valid(
get, get,
path = "/v1/debug/ipinfo", path = "/v1/debug/ipinfo",
responses( responses(
(status = 200, description = "Ok"), (status = 200, description = "Ok", body=Vec<String>, content_type="application/json"),
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/debug", tag = "v1/debug",
operation_id = "debug_ipinfo",
)] )]
pub async fn debug_ipinfo( pub async fn debug_ipinfo(
State(_state): State<ServerState>, State(_state): State<ServerState>,

View file

@ -23,6 +23,7 @@ use sketching::admin_error;
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_get"
)] )]
/// Lists all the OAuth2 Resource Servers /// Lists all the OAuth2 Resource Servers
pub(crate) async fn oauth2_get( pub(crate) async fn oauth2_get(
@ -46,6 +47,7 @@ pub(crate) async fn oauth2_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_basic_post"
)] )]
// TODO: what does this actually do? :D // TODO: what does this actually do? :D
pub(crate) async fn oauth2_basic_post( pub(crate) async fn oauth2_basic_post(
@ -72,6 +74,7 @@ pub(crate) async fn oauth2_basic_post(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_public_post"
)] )]
// TODO: what does this actually do? :D // TODO: what does this actually do? :D
pub(crate) async fn oauth2_public_post( pub(crate) async fn oauth2_public_post(
@ -93,11 +96,12 @@ pub(crate) async fn oauth2_public_post(
get, get,
path = "/v1/oauth2/{rs_name}", path = "/v1/oauth2/{rs_name}",
responses( responses(
(status = 200, /* TODO response=Option<ProtoEntry>*/), (status = 200, body=Option<ProtoEntry>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_id_get"
)] )]
/// Get the details of a given OAuth2 Resource Server. /// Get the details of a given OAuth2 Resource Server.
pub(crate) async fn oauth2_id_get( pub(crate) async fn oauth2_id_get(
@ -125,6 +129,7 @@ pub(crate) async fn oauth2_id_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_id_get_basic_secret"
)] )]
/// Get the basic secret for a given OAuth2 Resource Server. This is used for authentication. /// Get the basic secret for a given OAuth2 Resource Server. This is used for authentication.
#[instrument(level = "info", skip(state))] #[instrument(level = "info", skip(state))]
@ -152,6 +157,7 @@ pub(crate) async fn oauth2_id_get_basic_secret(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_id_patch"
)] )]
/// Modify an OAuth2 Resource Server /// Modify an OAuth2 Resource Server
pub(crate) async fn oauth2_id_patch( pub(crate) async fn oauth2_id_patch(
@ -180,6 +186,7 @@ pub(crate) async fn oauth2_id_patch(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_id_scopemap_post"
)] )]
/// Modify the scope map for a given OAuth2 Resource Server /// Modify the scope map for a given OAuth2 Resource Server
pub(crate) async fn oauth2_id_scopemap_post( pub(crate) async fn oauth2_id_scopemap_post(
@ -206,6 +213,7 @@ pub(crate) async fn oauth2_id_scopemap_post(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_id_scopemap_delete"
)] )]
// Delete a scope map for a given OAuth2 Resource Server // Delete a scope map for a given OAuth2 Resource Server
pub(crate) async fn oauth2_id_scopemap_delete( pub(crate) async fn oauth2_id_scopemap_delete(
@ -232,6 +240,7 @@ pub(crate) async fn oauth2_id_scopemap_delete(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_id_claimmap_post"
)] )]
/// Modify the claim map for a given OAuth2 Resource Server /// Modify the claim map for a given OAuth2 Resource Server
pub(crate) async fn oauth2_id_claimmap_post( pub(crate) async fn oauth2_id_claimmap_post(
@ -266,6 +275,7 @@ pub(crate) async fn oauth2_id_claimmap_post(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_id_claimmap_join_post"
)] )]
/// Modify the claim map join strategy for a given OAuth2 Resource Server /// Modify the claim map join strategy for a given OAuth2 Resource Server
pub(crate) async fn oauth2_id_claimmap_join_post( pub(crate) async fn oauth2_id_claimmap_join_post(
@ -298,6 +308,7 @@ pub(crate) async fn oauth2_id_claimmap_join_post(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_id_claimmap_delete"
)] )]
// Delete a claim map for a given OAuth2 Resource Server // Delete a claim map for a given OAuth2 Resource Server
pub(crate) async fn oauth2_id_claimmap_delete( pub(crate) async fn oauth2_id_claimmap_delete(
@ -323,6 +334,7 @@ pub(crate) async fn oauth2_id_claimmap_delete(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_id_sup_scopemap_post"
)] )]
/// Create a supplemental scope map for a given OAuth2 Resource Server /// Create a supplemental scope map for a given OAuth2 Resource Server
pub(crate) async fn oauth2_id_sup_scopemap_post( pub(crate) async fn oauth2_id_sup_scopemap_post(
@ -349,6 +361,7 @@ pub(crate) async fn oauth2_id_sup_scopemap_post(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_id_sup_scopemap_delete"
)] )]
// Delete a supplemental scope map configuration. // Delete a supplemental scope map configuration.
pub(crate) async fn oauth2_id_sup_scopemap_delete( pub(crate) async fn oauth2_id_sup_scopemap_delete(
@ -375,6 +388,7 @@ pub(crate) async fn oauth2_id_sup_scopemap_delete(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_id_delete"
)] )]
/// Delete an OAuth2 Resource Server /// Delete an OAuth2 Resource Server
pub(crate) async fn oauth2_id_delete( pub(crate) async fn oauth2_id_delete(
@ -400,6 +414,7 @@ pub(crate) async fn oauth2_id_delete(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_id_image_delete"
)] )]
// API endpoint for deleting the image associated with an OAuth2 Resource Server. // API endpoint for deleting the image associated with an OAuth2 Resource Server.
pub(crate) async fn oauth2_id_image_delete( pub(crate) async fn oauth2_id_image_delete(
@ -423,6 +438,7 @@ pub(crate) async fn oauth2_id_image_delete(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/oauth2", tag = "v1/oauth2",
operation_id = "oauth2_id_image_post"
)] )]
/// API endpoint for creating/replacing the image associated with an OAuth2 Resource Server. /// API endpoint for creating/replacing the image associated with an OAuth2 Resource Server.
/// ///

View file

@ -25,6 +25,7 @@ use kanidmd_lib::prelude::*;
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/sync_account", tag = "v1/sync_account",
operation_id = "sync_account_get"
)] )]
/// Get all? the sync accounts. /// Get all? the sync accounts.
pub async fn sync_account_get( pub async fn sync_account_get(
@ -45,6 +46,7 @@ pub async fn sync_account_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/sync_account", tag = "v1/sync_account",
operation_id = "sync_account_post"
)] )]
pub async fn sync_account_post( pub async fn sync_account_post(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -86,6 +88,7 @@ pub async fn sync_account_id_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/sync_account", tag = "v1/sync_account",
operation_id = "sync_account_id_patch"
)] )]
/// Modify a sync account in-place /// Modify a sync account in-place
pub async fn sync_account_id_patch( pub async fn sync_account_id_patch(
@ -114,8 +117,8 @@ pub async fn sync_account_id_patch(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/sync_account", tag = "v1/sync_account",
operation_id = "sync_account_id_finalise_get"
)] )]
// TODO: why is this a get and not a post?
pub async fn sync_account_id_finalise_get( pub async fn sync_account_id_finalise_get(
State(state): State<ServerState>, State(state): State<ServerState>,
Path(id): Path<String>, Path(id): Path<String>,
@ -138,8 +141,8 @@ pub async fn sync_account_id_finalise_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/sync_account", tag = "v1/sync_account",
operation_id = "sync_account_id_terminate_get"
)] )]
// TODO: why is this a get if it's a terminate?
pub async fn sync_account_id_terminate_get( pub async fn sync_account_id_terminate_get(
State(state): State<ServerState>, State(state): State<ServerState>,
Path(id): Path<String>, Path(id): Path<String>,
@ -158,11 +161,12 @@ pub async fn sync_account_id_terminate_get(
post, post,
path = "/v1/sync_account/{id}/_sync_token", path = "/v1/sync_account/{id}/_sync_token",
responses( responses(
(status = 200), // TODO: response content (status = 200, body=String, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/sync_account", tag = "v1/sync_account",
operation_id = "sync_account_token_post"
)] )]
pub async fn sync_account_token_post( pub async fn sync_account_token_post(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -187,6 +191,7 @@ pub async fn sync_account_token_post(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/sync_account", tag = "v1/sync_account",
operation_id = "sync_account_token_delete"
)] )]
pub async fn sync_account_token_delete( pub async fn sync_account_token_delete(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -211,6 +216,7 @@ pub async fn sync_account_token_delete(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "scim", tag = "scim",
operation_id = "scim_sync_post"
)] )]
async fn scim_sync_post( async fn scim_sync_post(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -230,11 +236,12 @@ async fn scim_sync_post(
get, get,
path = "/scim/v1/Sync", path = "/scim/v1/Sync",
responses( responses(
(status = 200), // TODO: response content (status = 200, content_type="application/json", body=ScimSyncState), // TODO: response content
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "scim", tag = "scim",
operation_id = "scim_sync_get"
)] )]
async fn scim_sync_get( async fn scim_sync_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -255,11 +262,12 @@ async fn scim_sync_get(
get, get,
path = "/v1/sync_account/{id}/_attr/{attr}", path = "/v1/sync_account/{id}/_attr/{attr}",
responses( responses(
(status = 200), // TODO: response content (status = 200, body=Option<Vec<String>>, content_type="application/json"),
ApiResponseWithout200, ApiResponseWithout200,
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/sync_account", tag = "v1/sync_account",
operation_id = "sync_account_id_attr_get"
)] )]
pub async fn sync_account_id_attr_get( pub async fn sync_account_id_attr_get(
State(state): State<ServerState>, State(state): State<ServerState>,
@ -280,6 +288,7 @@ pub async fn sync_account_id_attr_get(
), ),
security(("token_jwt" = [])), security(("token_jwt" = [])),
tag = "v1/sync_account", tag = "v1/sync_account",
operation_id = "sync_account_id_attr_put"
)] )]
pub async fn sync_account_id_attr_put( pub async fn sync_account_id_attr_put(
State(state): State<ServerState>, State(state): State<ServerState>,