Skip to content

Commit

Permalink
another 10% covered
Browse files Browse the repository at this point in the history
  • Loading branch information
kilork committed Mar 29, 2024
1 parent a31f09e commit 1968bd3
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 39 deletions.
60 changes: 36 additions & 24 deletions examples/openapi.patch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,42 @@ rust_type = "TypeVec<ClientScopeRepresentation>"
[path."/admin/realms/{realm}/client-templates:get:"]
from_type = "Value"
rust_type = "TypeVec<ClientInitialAccessPresentation>"
# [path."/admin/realms/{realm}/clients:get:"]
# from_type = "Value"
# [path."/admin/realms/{realm}/clients/{id}/default-client-scopes:get:"]
# from_type = "Value"
# [path."/admin/realms/{realm}/clients/{id}/evaluate-scopes/protocol-mappers:get:"]
# from_type = "Value"
# [path."/admin/realms/{realm}/clients/{id}/evaluate-scopes/scope-mappings/{roleContainerId}/granted:get:"]
# from_type = "Value"
# [path."/admin/realms/{realm}/clients/{id}/evaluate-scopes/scope-mappings/{roleContainerId}/not-granted:get:"]
# from_type = "Value"
# [path."/admin/realms/{realm}/clients/{id}/offline-sessions:get:"]
# from_type = "Value"
# [path."/admin/realms/{realm}/clients/{id}/optional-client-scopes:get:"]
# from_type = "Value"
# [path."/admin/realms/{realm}/clients/{id}/user-sessions:get:"]
# from_type = "Value"
# [path."/admin/realms/{realm}/components:get:"]
# from_type = "Value"
# [path."/admin/realms/{realm}/components/{id}/sub-component-types:get:"]
# from_type = "Value"
# [path."/admin/realms/{realm}/groups:get:"]
# from_type = "Value"
# [path."/admin/realms/{realm}/groups/{id}/members:get:"]
# from_type = "Value"
[path."/admin/realms/{realm}/clients:get:"]
from_type = "Value"
rust_type = "TypeVec<ClientRepresentation>"
[path."/admin/realms/{realm}/clients/{id}/default-client-scopes:get:"]
from_type = "Value"
rust_type = "TypeVec<ClientScopeRepresentation>"
[path."/admin/realms/{realm}/clients/{id}/evaluate-scopes/protocol-mappers:get:"]
from_type = "Value"
rust_type = "TypeVec<ProtocolMapperRepresentation>"
[path."/admin/realms/{realm}/clients/{id}/evaluate-scopes/scope-mappings/{roleContainerId}/granted:get:"]
from_type = "Value"
rust_type = "TypeVec<RoleRepresentation>"
[path."/admin/realms/{realm}/clients/{id}/evaluate-scopes/scope-mappings/{roleContainerId}/not-granted:get:"]
from_type = "Value"
rust_type = "TypeVec<RoleRepresentation>"
[path."/admin/realms/{realm}/clients/{id}/offline-sessions:get:"]
from_type = "Value"
rust_type = "TypeVec<TypeMap<String, Value>>"
[path."/admin/realms/{realm}/clients/{id}/optional-client-scopes:get:"]
from_type = "Value"
rust_type = "TypeVec<ClientScopeRepresentation>"
[path."/admin/realms/{realm}/clients/{id}/user-sessions:get:"]
from_type = "Value"
rust_type = "TypeVec<TypeMap<String, Value>>"
[path."/admin/realms/{realm}/components:get:"]
from_type = "Value"
rust_type = "TypeVec<ComponentRepresentation>"
[path."/admin/realms/{realm}/components/{id}/sub-component-types:get:"]
from_type = "Value"
rust_type = "TypeVec<ComponentRepresentation>"
[path."/admin/realms/{realm}/groups:get:"]
from_type = "Value"
rust_type = "TypeVec<GroupRepresentation>"
[path."/admin/realms/{realm}/groups/{id}/members:get:"]
from_type = "Value"
rust_type = "TypeVec<UserRepresentation>"
# [path."/admin/realms/{realm}/identity-provider/instances:get:"]
# from_type = "Value"
# [path."/admin/realms/{realm}/identity-provider/instances/{alias}/mappers:get:"]
Expand Down
8 changes: 5 additions & 3 deletions examples/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ mod openapi {
if let Some(desc) = desc.as_ref() {
let from_type = desc.from_type.as_str();
if &from_type != body_type_value {
eprintln!("warn: body type info changed in [{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}"#);
}
ReturnType {
value: desc.rust_type.clone().into(),
Expand Down Expand Up @@ -364,7 +364,9 @@ mod openapi {
if let Some(desc) = desc.as_ref() {
let from_type = desc.from_type.as_str();
if from_type != result_type_value {
eprintln!("warn: type info changed in [{path}:{method_string_lc}] : was {from_type} now {result_type_value}");
eprintln!(
r#"warn: type info changed in [path."{path}:{method_string_lc}:"] : was {from_type} now {result_type_value}"#
);
}
result_type_value = desc.rust_type.as_str();
result_type = Some(ReturnType {
Expand All @@ -373,7 +375,7 @@ mod openapi {
convert: desc.convert.as_deref().map(From::from),
});
} else if result_type_value == "Value" {
eprintln!("warn: Value as result in [{path}:{method_string_lc}]");
eprintln!(r#"warn: Value as result in [path."{path}:{method_string_lc}:"]"#);
}

output.push(format!(
Expand Down
24 changes: 12 additions & 12 deletions src/rest/generated_rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2151,7 +2151,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
q: Option<String>,
search: Option<bool>,
viewable_only: Option<bool>,
) -> Result<Value, KeycloakError> {
) -> Result<TypeVec<ClientRepresentation>, KeycloakError> {
let mut builder = self
.client
.get(&format!("{}/admin/realms/{realm}/clients", self.url))
Expand Down Expand Up @@ -2423,7 +2423,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
&self,
realm: &str,
id: &str,
) -> Result<Value, KeycloakError> {
) -> Result<TypeVec<ClientScopeRepresentation>, KeycloakError> {
let builder = self
.client
.get(&format!(
Expand Down Expand Up @@ -2636,7 +2636,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
realm: &str,
id: &str,
scope: Option<String>,
) -> Result<Value, KeycloakError> {
) -> Result<TypeVec<ProtocolMapperRepresentation>, KeycloakError> {
let mut builder = self
.client
.get(&format!(
Expand Down Expand Up @@ -2674,7 +2674,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
id: &str,
role_container_id: &str,
scope: Option<String>,
) -> Result<Value, KeycloakError> {
) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
let mut builder = self
.client
.get(&format!(
Expand Down Expand Up @@ -2712,7 +2712,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
id: &str,
role_container_id: &str,
scope: Option<String>,
) -> Result<Value, KeycloakError> {
) -> Result<TypeVec<RoleRepresentation>, KeycloakError> {
let mut builder = self
.client
.get(&format!(
Expand Down Expand Up @@ -2935,7 +2935,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
id: &str,
first: Option<i32>,
max: Option<i32>,
) -> Result<Value, KeycloakError> {
) -> Result<TypeVec<TypeMap<String, Value>>, KeycloakError> {
let mut builder = self
.client
.get(&format!(
Expand Down Expand Up @@ -2970,7 +2970,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
&self,
realm: &str,
id: &str,
) -> Result<Value, KeycloakError> {
) -> Result<TypeVec<ClientScopeRepresentation>, KeycloakError> {
let builder = self
.client
.get(&format!(
Expand Down Expand Up @@ -3213,7 +3213,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
id: &str,
first: Option<i32>,
max: Option<i32>,
) -> Result<Value, KeycloakError> {
) -> Result<TypeVec<TypeMap<String, Value>>, KeycloakError> {
let mut builder = self
.client
.get(&format!(
Expand Down Expand Up @@ -3252,7 +3252,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
name: Option<String>,
parent: Option<String>,
type_: Option<String>,
) -> Result<Value, KeycloakError> {
) -> Result<TypeVec<ComponentRepresentation>, KeycloakError> {
let mut builder = self
.client
.get(&format!("{}/admin/realms/{realm}/components", self.url))
Expand Down Expand Up @@ -3401,7 +3401,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
realm: &str,
id: &str,
type_: Option<String>,
) -> Result<Value, KeycloakError> {
) -> Result<TypeVec<ComponentRepresentation>, KeycloakError> {
let mut builder = self
.client
.get(&format!(
Expand Down Expand Up @@ -3448,7 +3448,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
populate_hierarchy: Option<bool>,
q: Option<String>,
search: Option<String>,
) -> Result<Value, KeycloakError> {
) -> Result<TypeVec<GroupRepresentation>, KeycloakError> {
let mut builder = self
.client
.get(&format!("{}/admin/realms/{realm}/groups", self.url))
Expand Down Expand Up @@ -3736,7 +3736,7 @@ impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {
brief_representation: Option<bool>,
first: Option<i32>,
max: Option<i32>,
) -> Result<Value, KeycloakError> {
) -> Result<TypeVec<UserRepresentation>, KeycloakError> {
let mut builder = self
.client
.get(&format!(
Expand Down

0 comments on commit 1968bd3

Please sign in to comment.