Skip to content

Commit

Permalink
Keycloak Admin REST API v22.0.501 (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
kilork authored Mar 29, 2024
1 parent 498f07f commit fce311f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "keycloak"
version = "22.0.500"
version = "22.0.501"
authors = ["Alexander Korolev <[email protected]>"]
edition = "2021"
categories = ["api-bindings", "asynchronous"]
Expand Down
10 changes: 5 additions & 5 deletions examples/openapi.patch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from_type = "String"
rust_type = "RealmRepresentation"
[path."/admin/realms:get:"]
from_type = "Value"
rust_type = "RealmRepresentation"
rust_type = "TypeVec<RealmRepresentation>"
[path."/admin/realms/{realm}/users:get:"]
from_type = "Value"
rust_type = "TypeVec<UserRepresentation>"
Expand All @@ -15,7 +15,7 @@ from_type = "Value"
rust_type = "TypeVec<TypeMap<String, Value>>"
[path."/admin/realms/{realm}/authentication/flows:get:"]
from_type = "Value"
rust_type = "AuthenticationFlowRepresentation"
rust_type = "TypeVec<AuthenticationFlowRepresentation>"
[path."/admin/realms/{realm}/authentication/form-action-providers:get:"]
from_type = "Value"
rust_type = "TypeVec<TypeMap<String, Value>>"
Expand Down Expand Up @@ -60,7 +60,7 @@ from_type = "Value"
rust_type = "TypeVec<ClientScopeRepresentation>"
[path."/admin/realms/{realm}/client-templates:get:"]
from_type = "Value"
rust_type = "TypeVec<ClientInitialAccessPresentation>"
rust_type = "TypeVec<ClientScopeRepresentation>"
[path."/admin/realms/{realm}/clients:get:"]
from_type = "Value"
rust_type = "TypeVec<ClientRepresentation>"
Expand Down Expand Up @@ -129,7 +129,7 @@ from_type = "Value"
rust_type = "TypeVec<TypeMap<String, Value>>"
[path."/admin/realms/{realm}/credential-registrators:get:"]
from_type = "Value"
rust_type = "TypeVec<TypeString>"
rust_type = "TypeVec<String>"
[path."/admin/realms/{realm}/default-default-client-scopes:get:"]
from_type = "Value"
rust_type = "TypeVec<ClientScopeRepresentation>"
Expand All @@ -144,7 +144,7 @@ from_type = "Value"
rust_type = "TypeVec<TypeMap<String, Value>>"
[path."/admin/realms/{realm}/localization:get:"]
from_type = "Value"
rust_type = "TypeVec<TypeMap<String, String>>"
rust_type = "TypeVec<String>"
[path."/admin/realms/{realm}/groups/{id}/role-mappings/realm:get:"]
from_type = "Value"
rust_type = "TypeVec<RoleRepresentation>"
Expand Down
18 changes: 15 additions & 3 deletions examples/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,14 @@ mod openapi {
if let Some(desc) = desc.as_ref() {
let from_type = desc.from_type.as_str();
if &from_type != body_type_value {
eprintln!(r#"warn: body type info changed in [path."{path}:{method_string_lc}:{body_parameter_name}"] : was {from_type} now {body_type_value}"#);
eprintln!(
r#"warn: body type info changed in [path."{path}:{method_string_lc}:{body_parameter_name}"] : was {from_type} now {body_type_value} (mapped {})"#,
if body_type_value == &desc.rust_type {
"redundant"
} else {
&desc.rust_type
}
);
}
ReturnType {
value: desc.rust_type.clone().into(),
Expand Down Expand Up @@ -365,7 +372,12 @@ mod openapi {
let from_type = desc.from_type.as_str();
if from_type != result_type_value {
eprintln!(
r#"warn: type info changed in [path."{path}:{method_string_lc}:"] : was {from_type} now {result_type_value}"#
r#"warn: type info changed in [path."{path}:{method_string_lc}:"] : was {from_type} now {result_type_value} (mapped {})"#,
if result_type_value == &desc.rust_type {
"redundant"
} else {
&desc.rust_type
}
);
}
result_type_value = desc.rust_type.as_str();
Expand Down Expand Up @@ -915,7 +927,7 @@ pub enum {name} {{
.strip_prefix("#/components/schemas/")
.expect("#/components/schemas/ prefixed type name")
.into(),
Kind::DefaultValue {} => "()".into(),
Kind::DefaultValue {} => "Value".into(),
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/rest/generated_rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
pub async fn realm_authentication_flows_get(
&self,
realm: &str,
) -> Result<AuthenticationFlowRepresentation, KeycloakError> {
) -> Result<TypeVec<AuthenticationFlowRepresentation>, KeycloakError> {
let builder = self
.client
.get(&format!(
Expand Down Expand Up @@ -1986,7 +1986,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
pub async fn realm_client_templates_get(
&self,
realm: &str,
) -> Result<TypeVec<ClientInitialAccessPresentation>, KeycloakError> {
) -> Result<TypeVec<ClientScopeRepresentation>, KeycloakError> {
let builder = self
.client
.get(&format!(
Expand Down Expand Up @@ -4951,7 +4951,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
pub async fn get(
&self,
brief_representation: Option<bool>,
) -> Result<RealmRepresentation, KeycloakError> {
) -> Result<TypeVec<RealmRepresentation>, KeycloakError> {
let mut builder = self
.client
.get(&format!("{}/admin/realms", self.url))
Expand Down Expand Up @@ -5342,7 +5342,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
pub async fn realm_credential_registrators_get(
&self,
realm: &str,
) -> Result<TypeVec<TypeString>, KeycloakError> {
) -> Result<TypeVec<String>, KeycloakError> {
let builder = self
.client
.get(&format!(
Expand Down Expand Up @@ -5792,7 +5792,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
pub async fn realm_localization_get(
&self,
realm: &str,
) -> Result<TypeVec<TypeMap<String, String>>, KeycloakError> {
) -> Result<TypeVec<String>, KeycloakError> {
let builder = self
.client
.get(&format!("{}/admin/realms/{realm}/localization", self.url))
Expand Down

0 comments on commit fce311f

Please sign in to comment.