@@ -31,12 +31,12 @@ impl TryInto<TokenStream> for IsRequired {
3131/// Document's metadata fields definition
3232#[ derive( serde:: Deserialize ) ]
3333#[ allow( clippy:: missing_docs_in_private_items) ]
34- pub ( crate ) struct Metadata {
34+ pub ( crate ) struct Headers {
3535 #[ serde( rename = "content type" ) ]
36- pub ( crate ) content_type : ContentType ,
36+ pub ( crate ) content_type : ContentType ,
3737}
3838
39- /// `signed_doc.json` "ref " field JSON object
39+ /// `signed_doc.json` "content type " field JSON object
4040#[ derive( serde:: Deserialize ) ]
4141#[ allow( clippy:: missing_docs_in_private_items) ]
4242pub ( crate ) struct ContentType {
@@ -50,30 +50,30 @@ impl TryInto<TokenStream> for ContentType {
5050
5151 fn try_into ( self ) -> Result < TokenStream , Self :: Error > {
5252 let exp = match self . value . as_str ( ) {
53- "application/cbor" => quote ! { ContentType :: Cbor } ,
54- "application/cddl" => quote ! { ContentType :: Cddl } ,
55- "application/json" => quote ! { ContentType :: Json } ,
56- "application/json+schema" => quote ! { ContentType :: JsonSchema } ,
57- "text/css; charset=utf-8" => quote ! { ContentType :: Css } ,
58- "text/css; charset=utf-8; template=handlebars" => quote ! { ContentType :: CssHandlebars } ,
59- "text/html; charset=utf-8" => quote ! { ContentType :: Html } ,
53+ "application/cbor" => quote ! { ContentTypeRule :: Cbor } ,
54+ "application/cddl" => quote ! { ContentTypeRule :: Cddl } ,
55+ "application/json" => quote ! { ContentTypeRule :: Json } ,
56+ "application/json+schema" => quote ! { ContentTypeRule :: JsonSchema } ,
57+ "text/css; charset=utf-8" => quote ! { ContentTypeRule :: Css } ,
58+ "text/css; charset=utf-8; template=handlebars" => quote ! { ContentTypeRule :: CssHandlebars } ,
59+ "text/html; charset=utf-8" => quote ! { ContentTypeRule :: Html } ,
6060 "text/html; charset=utf-8; template=handlebars" => {
61- quote ! { ContentType :: HtmlHandlebars }
61+ quote ! { ContentTypeRule :: HtmlHandlebars }
6262 } ,
63- "text/markdown; charset=utf-8" => quote ! { ContentType :: Markdown } ,
63+ "text/markdown; charset=utf-8" => quote ! { ContentTypeRule :: Markdown } ,
6464 "text/markdown; charset=utf-8; template=handlebars" => {
65- quote ! { ContentType :: MarkdownHandlebars }
65+ quote ! { ContentTypeRule :: MarkdownHandlebars }
6666 } ,
67- "text/plain; charset=utf-8" => quote ! { ContentType :: Plain } ,
67+ "text/plain; charset=utf-8" => quote ! { ContentTypeRule :: Plain } ,
6868 "text/plain; charset=utf-8; template=handlebars" => {
69- quote ! { ContentType :: PlainHandlebars }
69+ quote ! { ContentTypeRule :: PlainHandlebars }
7070 } ,
7171 _ => return Err ( anyhow:: anyhow!( "Unsupported Content Type: {}" , self . value) ) ,
7272 } ;
7373
7474 Ok ( quote ! {
7575 crate :: validator:: rules:: ContentTypeRule {
76- exp: #exp,
76+ exp: crate :: validator :: rules :: #exp,
7777 }
7878 } )
7979 }
0 commit comments