@@ -90,7 +90,7 @@ impl Lock {
9090#[ derive( Debug , Deserialize ) ]
9191pub struct EnvMetadata {
9292 pub version : String ,
93- #[ serde( rename = "project" , skip_serializing_if = "Vec::is_empty" , default ) ]
93+ #[ serde( rename = "project" , default ) ]
9494 pub projects : Vec < EnvProject > ,
9595}
9696
@@ -176,7 +176,7 @@ impl EnvMetadata {
176176
177177 pub fn add_project ( & mut self , project : EnvProject ) {
178178 if let Some ( found) = self . find_project ( & project. identifiers , & project. version ) {
179- self . projects [ found] . merge ( & project) ;
179+ self . projects [ found] . merge_identifiers ( & project) ;
180180 } else {
181181 self . projects . push ( project) ;
182182 }
@@ -249,22 +249,22 @@ pub struct EnvProject {
249249 /// identifier, and if the project is not `editable` this
250250 /// is the IRI it is installed as. The rest are considered
251251 /// as aliases. Can only be empty for `editable` projects.
252- #[ serde( skip_serializing_if = "Vec::is_empty" , default ) ]
252+ #[ serde( default ) ]
253253 pub identifiers : Vec < String > ,
254254 /// Usages of the project. Intended for tools needing to
255255 /// track the interdependence of project in the environment.
256- #[ serde( skip_serializing_if = "Vec::is_empty" , default ) ]
256+ #[ serde( default ) ]
257257 pub usages : Vec < String > ,
258258 /// Indicator of wether the project is fully installed in
259259 /// the environment or located elsewhere.
260- #[ serde( skip_serializing_if = "bool::is_false" , default ) ]
260+ #[ serde( default ) ]
261261 pub editable : bool ,
262262 /// In case of an `editable` project these are the files
263263 /// belonging to the project. Intended for tools that
264264 /// are not able to natively parse and understand the
265265 /// projects `.meta.json` file. Paths should be relative
266266 /// to the `path` of the project.
267- #[ serde( skip_serializing_if = "bool::is_false" , default ) ]
267+ #[ serde( default ) ]
268268 pub workspace : bool ,
269269}
270270
@@ -291,17 +291,20 @@ impl EnvProject {
291291 if self . editable {
292292 table. insert ( "editable" , value ( true ) ) ;
293293 }
294+ if self . workspace {
295+ table. insert ( "workspace" , value ( true ) ) ;
296+ }
294297
295298 table
296299 }
297300
298301 /// Adds identifiers from other project.
299302 /// Should only be done if the underlying projects are the same.
300303 /// In particular they must have the same version.
301- pub fn merge ( & mut self , other : & EnvProject ) {
304+ pub fn merge_identifiers ( & mut self , other : & EnvProject ) {
302305 assert_eq ! (
303306 self . version, other. version,
304- "attempting to merge projects with different versions"
307+ "attempting to merge identifiers for projects with different versions"
305308 ) ;
306309
307310 for iri in & other. identifiers {
0 commit comments