use ::inflector::Inflector;
use ::quote::Tokens;
use ::syn::Ident;
use ::yaml_rust::Yaml;

use infer::datatype;
use infer::StructBoundArgImpl;

fn infer_v3_json(structs_mod: &Ident, schema: &Yaml) -> StructBoundArgImpl {
    let (inferred_type, aux_types) = datatype::infer_v3(&schema)?;
    Ok((
        quote! {
            #(#aux_types)*
            pub type RequestBody = #inferred_type;
        },
        quote!(),
        quote!(body: &#structs_mod::RequestBody),
        quote!(.json(body)),
    ))
}

pub(super) fn infer_v3(structs_mod: &Ident, schema: &Yaml) -> StructBoundArgImpl {
    match schema["content"]["application/json"]["schema"] {
        Yaml::BadValue => Err(From::from("only JSON bodies supported at this time")),
        ref schema => infer_v3_json(structs_mod, &schema),
    }
}

use ::inflector::Inflector;
use ::quote::Tokens;
use ::syn::Ident;
use ::yaml_rust::Yaml;

use infer::datatype;
use infer::StructBoundArgImpl;

fn infer_v3_json(structs_mod: &Ident, schema: &Yaml) -> StructBoundArgImpl {
    let (inferred_type, aux_types) = datatype::infer_v3(&schema)?;
    Ok((
        quote! {
            #(#aux_types)*
            type RequestBody = #inferred_type;
        },
        quote!(),
        quote!(body: &#structs_mod::RequestBody),
        quote!(.json(body)),
    ))
}

pub(super) fn infer_v3(structs_mod: &Ident, schema: &Yaml) -> StructBoundArgImpl {
    match schema["content"]["application/json"]["schema"] {
        Yaml::BadValue => Err(From::from("only JSON bodies supported at this time")),
        ref schema => infer_v3_json(structs_mod, &schema),
    }
}

--- 
+++ 
@@ -11,7 +11,7 @@
     Ok((
         quote! {
             #(#aux_types)*
-            type RequestBody = #inferred_type;
+            pub type RequestBody = #inferred_type;
         },
         quote!(),
         quote!(body: &#structs_mod::RequestBody),
Fix pub access to RequestBody
