Skip to content

Commit

Permalink
fix(graphql): type info
Browse files Browse the repository at this point in the history
  • Loading branch information
VIAL Sébastien committed Nov 25, 2023
1 parent 188d827 commit 49d44bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ documentation = "https://docs.rs/tag_password"
homepage = "https://devs.transitions.ag/"
repository = "https://github.com/TransitionsAg/tag_password"
readme = "README.md"
version = "0.1.3-pre1"
version = "0.1.3-pre2"
edition = "2021"

[dependencies]
Expand Down
20 changes: 14 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
//!
//! This project is licensed under the [MIT License](LICENSE).

use argon2::password_hash::Value;
#[cfg(feature = "argon2")]
use argon2::{password_hash::Salt, Argon2, PasswordHash, PasswordHasher, PasswordVerifier};
#[cfg(feature = "graphql")]
use async_graphql::{registry::Registry, InputType};
use async_graphql::{registry::MetaType, registry::MetaTypeId, registry::Registry, InputType};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::{
borrow::Cow,
fmt::{Debug, Display},
marker::PhantomData,
};
Expand Down Expand Up @@ -175,12 +175,20 @@ impl<T: ?Sized> Into<String> for Password<T> {
impl<T: ?Sized + Send + Sync> InputType for Password<T> {
type RawValueType = String;

fn type_name() -> std::borrow::Cow<'static, str> {
"Password".into()
fn type_name() -> Cow<'static, str> {
Cow::Borrowed("Password")
}

fn create_type_info(_: &mut Registry) -> String {
"A password".into()
fn create_type_info(registry: &mut Registry) -> String {
registry.create_input_type(MetaTypeId::Scalar, |_| MetaType::Scalar {
name: "Password".into(),
description: "A type used internally to represent a password.".into(),
is_valid: None,
visible: None,
inaccessible: false,
tags: Default::default(),
specified_by_url: None,
})
}

fn parse(value: Option<async_graphql::Value>) -> async_graphql::InputValueResult<Self> {
Expand Down

0 comments on commit 49d44bb

Please sign in to comment.