@@ -17,8 +17,8 @@ pub enum MemberValue {
1717impl Display for MemberValue {
1818 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
1919 match self {
20- MemberValue :: StringType ( s) => write ! ( f, "{}" , s ) ,
21- MemberValue :: IntegerType ( i) => write ! ( f, "{}" , i ) ,
20+ MemberValue :: StringType ( s) => write ! ( f, "{s}" ) ,
21+ MemberValue :: IntegerType ( i) => write ! ( f, "{i}" ) ,
2222 }
2323 }
2424}
@@ -62,6 +62,7 @@ impl Display for ComplexType {
6262#[ derive( Debug , Deserialize , Clone ) ]
6363#[ serde( untagged) ]
6464pub enum PrimitiveType {
65+ Any ,
6566 String ,
6667 Int ,
6768 Double ,
@@ -83,6 +84,7 @@ pub enum PrimitiveType {
8384impl Display for PrimitiveType {
8485 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
8586 match self {
87+ PrimitiveType :: Any => write ! ( f, "any" ) ,
8688 PrimitiveType :: String => write ! ( f, "string" ) ,
8789 PrimitiveType :: Int => write ! ( f, "int" ) ,
8890 PrimitiveType :: Double => write ! ( f, "double" ) ,
@@ -110,6 +112,7 @@ where
110112 let s: serde_yaml:: Value = serde:: Deserialize :: deserialize ( deserializer) ?;
111113 match s {
112114 serde_yaml:: Value :: String ( s) => match s. as_str ( ) {
115+ "any" => Ok ( PrimitiveType :: Any ) ,
113116 "string" => Ok ( PrimitiveType :: String ) ,
114117 "int" => Ok ( PrimitiveType :: Int ) ,
115118 "double" => Ok ( PrimitiveType :: Double ) ,
@@ -143,8 +146,8 @@ pub enum Type {
143146impl Display for Type {
144147 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
145148 match self {
146- Type :: Simple ( s) => write ! ( f, "{}" , s ) ,
147- Type :: Complex ( c) => write ! ( f, "{}" , c ) ,
149+ Type :: Simple ( s) => write ! ( f, "{s}" ) ,
150+ Type :: Complex ( c) => write ! ( f, "{c}" ) ,
148151 }
149152 }
150153}
@@ -156,6 +159,7 @@ pub enum ValueType {
156159 Bool ( bool ) ,
157160 Integer ( i64 ) ,
158161 Float ( f64 ) ,
162+ Any ( String ) ,
159163 ArrayString ( Vec < String > ) ,
160164 ArrayBool ( Vec < bool > ) ,
161165 ArrayInteger ( Vec < i64 > ) ,
@@ -165,14 +169,15 @@ pub enum ValueType {
165169impl Display for ValueType {
166170 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
167171 match self {
168- ValueType :: String ( s) => write ! ( f, "{}" , s) ,
169- ValueType :: Bool ( b) => write ! ( f, "{}" , b) ,
170- ValueType :: Integer ( i) => write ! ( f, "{}" , i) ,
171- ValueType :: Float ( fl) => write ! ( f, "{}" , fl) ,
172- ValueType :: ArrayString ( s) => write ! ( f, "{:?}" , s) ,
173- ValueType :: ArrayBool ( b) => write ! ( f, "{:?}" , b) ,
174- ValueType :: ArrayInteger ( i) => write ! ( f, "{:?}" , i) ,
175- ValueType :: ArrayFloat ( fl) => write ! ( f, "{:?}" , fl) ,
172+ ValueType :: String ( s) => write ! ( f, "{s}" ) ,
173+ ValueType :: Bool ( b) => write ! ( f, "{b}" ) ,
174+ ValueType :: Integer ( i) => write ! ( f, "{i}" ) ,
175+ ValueType :: Float ( fl) => write ! ( f, "{fl}" ) ,
176+ ValueType :: Any ( s) => write ! ( f, "{s}" ) ,
177+ ValueType :: ArrayString ( s) => write ! ( f, "{s:?}" ) ,
178+ ValueType :: ArrayBool ( b) => write ! ( f, "{b:?}" ) ,
179+ ValueType :: ArrayInteger ( i) => write ! ( f, "{i:?}" ) ,
180+ ValueType :: ArrayFloat ( fl) => write ! ( f, "{fl:?}" ) ,
176181 }
177182 }
178183}
@@ -191,13 +196,30 @@ pub struct Attribute {
191196 pub brief : Option < String > ,
192197 pub note : Option < String > ,
193198 pub examples : Option < Examples > ,
194- pub deprecated : Option < String > ,
199+ pub deprecated : Option < Deprecated > ,
195200 pub used_by : Option < Vec < String > > ,
196201 pub registry_name : Option < String > ,
197202 pub defined_in : Option < String > ,
198203 pub template_suffixes : Option < BTreeMap < String , Vec < String > > > ,
199204}
200205
206+ #[ derive( Debug , Deserialize , Clone ) ]
207+ pub struct Deprecated {
208+ pub reason : String ,
209+ }
210+
211+ impl Display for Deprecated {
212+ fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
213+ write ! ( f, "Deprecated: {}" , self . reason)
214+ }
215+ }
216+
217+ impl AsRef < str > for Deprecated {
218+ fn as_ref ( & self ) -> & str {
219+ & self . reason
220+ }
221+ }
222+
201223impl Attribute {
202224 pub fn is_template_type ( & self ) -> bool {
203225 matches ! (
@@ -246,7 +268,10 @@ impl SemanticConventions {
246268 let entry = entry?;
247269 // print the trailing part of the path after the root_dir
248270 let defined_in = entry. strip_prefix ( root_dir) ?. to_str ( ) . unwrap_or ( "" ) ;
249-
271+ // ignore registry_manifest files
272+ if defined_in. contains ( "registry_manifest" ) {
273+ continue ;
274+ }
250275 sc. read_file ( & entry, registry_name, defined_in) ?;
251276 }
252277 }
@@ -259,7 +284,7 @@ impl SemanticConventions {
259284 registry_name : & str ,
260285 defined_in : & str ,
261286 ) -> anyhow:: Result < ( ) > {
262- // println!("reading file: {:?}", path);
287+ //println!("reading file: {:?}", path);
263288 let groups: Groups = serde_yaml:: from_reader ( & File :: open ( path) ?) ?;
264289 for group in groups. groups {
265290 if let Some ( attributes) = group. attributes {
0 commit comments