fn generate_custom_endpoint(e: &Endpoint) -> Property {
    let mut arguments = HashMap::new();
    if let Some(input) = e.input() {
        let is_required = if input.required() {
            ArgumentKind::Required
        } else {
            ArgumentKind::Optional
        };

        arguments.insert(
            "partitionKey".to_string(),
            Argument::new(
                "partitionKey".to_string(),
                ArgumentKind::Optional,
                "String".to_string(),
            ),
        );

        match input.type_def() {
            TypeDef::Scalar(s) => match s {
                GraphqlType::Boolean => arguments.insert(
                    "input".to_string(),
                    Argument::new("input".to_string(), is_required, "Boolean".to_string()),
                ),
                GraphqlType::Float => arguments.insert(
                    "input".to_string(),
                    Argument::new("input".to_string(), is_required, "Float".to_string()),
                ),
                GraphqlType::Int => arguments.insert(
                    "input".to_string(),
                    Argument::new("input".to_string(), is_required, "Int".to_string()),
                ),
                GraphqlType::String => arguments.insert(
                    "input".to_string(),
                    Argument::new("input".to_string(), is_required, "String".to_string()),
                ),
            },
            TypeDef::Existing(e) => arguments.insert(
                "input".to_string(),
                Argument::new("input".to_string(), is_required, e.clone()),
            ),
            TypeDef::Custom(c) => arguments.insert(
                "input".to_string(),
                Argument::new("input".to_string(), is_required, c.name().to_string()),
            ),
        };
    }

    Property::new(
        e.name().to_string(),
        PropertyKind::CustomResolver,
        match &e.output().type_def() {
            TypeDef::Scalar(t) => match &t {
                GraphqlType::Int => "Int".to_string(),
                GraphqlType::Float => "Float".to_string(),
                GraphqlType::String => "String".to_string(),
                GraphqlType::Boolean => "Boolean".to_string(),
            },
            TypeDef::Existing(s) => s.clone(),
            TypeDef::Custom(t) => t.name().to_string(),
        },
    )
    .with_required(e.output().required())
    .with_list(e.output().list())
    .with_arguments(arguments)
}
/// Takes a WG Endpoint and returns a NodeType representing a root endpoint
Takes a WG Endpoint and returns a NodeType representing a root endpoint
Takes a WG Endpoint and returns a NodeType representing a root endpoint
fn generate_custom_endpoint(e: &Endpoint) -> Property {
    let mut arguments = HashMap::new();
    if let Some(input) = e.input() {
        let is_required = if input.required() {
            ArgumentKind::Required
        } else {
            ArgumentKind::Optional
        };
        arguments.insert(
            "partitionKey".to_string(),
            Argument::new(
                "partitionKey".to_string(),
                ArgumentKind::Optional,
                "String".to_string(),
            ),
        );
        match input.type_def() {
            TypeDef::Scalar(s) => match s {
                GraphqlType::Boolean => arguments.insert(
                    "input".to_string(),
                    Argument::new("input".to_string(), is_required, "Boolean".to_string()),
                ),
                GraphqlType::Float => arguments.insert(
                    "input".to_string(),
                    Argument::new("input".to_string(), is_required, "Float".to_string()),
                ),
                GraphqlType::Int => arguments.insert(
                    "input".to_string(),
                    Argument::new("input".to_string(), is_required, "Int".to_string()),
                ),
                GraphqlType::String => arguments.insert(
                    "input".to_string(),
                    Argument::new("input".to_string(), is_required, "String".to_string()),
                ),
            },
            TypeDef::Existing(e) => arguments.insert(
                "input".to_string(),
                Argument::new("input".to_string(), is_required, e.clone()),
            ),
            TypeDef::Custom(c) => arguments.insert(
                "input".to_string(),
                Argument::new("input".to_string(), is_required, c.name().to_string()),
            ),
        };
    }
    Property::new(
        e.name().to_string(),
        PropertyKind::CustomResolver,
        match &e.output().type_def() {
            TypeDef::Scalar(t) => match &t {
                GraphqlType::Int => "Int".to_string(),
                GraphqlType::Float => "Float".to_string(),
                GraphqlType::String => "String".to_string(),
                GraphqlType::Boolean => "Boolean".to_string(),
            },
            TypeDef::Existing(s) => s.clone(),
            TypeDef::Custom(t) => t.name().to_string(),
        },
    )
    .with_required(e.output().required())
    .with_list(e.output().list())
    .with_arguments(arguments)
}
fn generate_custom_endpoint ( e : & Endpoint ) -> Property { let mut arguments = HashMap :: new ( ) ; if let Some ( input ) = e . input ( ) { let is_required = if input . required ( ) { ArgumentKind :: Required } else { ArgumentKind :: Optional } ; arguments . insert ( " " . to_string ( ) , Argument :: new ( " " . to_string ( ) , ArgumentKind :: Optional , " " . to_string ( ) , ) , ) ; match input . type_def ( ) { TypeDef :: Scalar ( s ) => match s { GraphqlType :: Boolean => arguments . insert ( " " . to_string ( ) , Argument :: new ( " " . to_string ( ) , is_required , " " . to_string ( ) ) , ) , GraphqlType :: Float => arguments . insert ( " " . to_string ( ) , Argument :: new ( " " . to_string ( ) , is_required , " " . to_string ( ) ) , ) , GraphqlType :: Int => arguments . insert ( " " . to_string ( ) , Argument :: new ( " " . to_string ( ) , is_required , " " . to_string ( ) ) , ) , GraphqlType :: String => arguments . insert ( " " . to_string ( ) , Argument :: new ( " " . to_string ( ) , is_required , " " . to_string ( ) ) , ) , } , TypeDef :: Existing ( e ) => arguments . insert ( " " . to_string ( ) , Argument :: new ( " " . to_string ( ) , is_required , e . clone ( ) ) , ) , TypeDef :: Custom ( c ) => arguments . insert ( " " . to_string ( ) , Argument :: new ( " " . to_string ( ) , is_required , c . name ( ) . to_string ( ) ) , ) , } ; } Property :: new ( e . name ( ) . to_string ( ) , PropertyKind :: CustomResolver , match & e . output ( ) . type_def ( ) { TypeDef :: Scalar ( t ) => match & t { GraphqlType :: Int => " " . to_string ( ) , GraphqlType :: Float => " " . to_string ( ) , GraphqlType :: String => " " . to_string ( ) , GraphqlType :: Boolean => " " . to_string ( ) , } , TypeDef :: Existing ( s ) => s . clone ( ) , TypeDef :: Custom ( t ) => t . name ( ) . to_string ( ) , } , ) . with_required ( e . output ( ) . required ( ) ) . with_list ( e . output ( ) . list ( ) ) . with_arguments ( arguments ) }
Takes a WG Endpoint and returns a NodeType representing a root endpoint
Takes a WG Endpoint and returns a NodeType representing a root endpoint
e
&Endpoint
e
&Endpoint