Skip to content

Commit

Permalink
updated generator
Browse files Browse the repository at this point in the history
  • Loading branch information
revenz committed Feb 16, 2024
1 parent d42985e commit 16e3581
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions Generators/RepoGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private static List<RepositoryObject> GetTemplates(string path, bool community =
var isSubFlow = path.Contains("SubFlow") && path.Contains("Templates") == false;

string content = File.ReadAllText(file.FullName);
var template = JsonSerializer.Deserialize<RepositoryObjectWithProperties>(content, options);
var template = JsonSerializer.Deserialize<SubFlowRepositoryObject>(content, options);
if (template == null)
continue;

Expand All @@ -128,7 +128,8 @@ private static List<RepositoryObject> GetTemplates(string path, bool community =
Revision = template.Revision,
Uid = template.Uid,
MinimumVersion = template.MinimumVersion,
Author = template.Author?.EmptyAsNull() ?? template?.Properties?.Author ?? string.Empty
Author = template.Author?.EmptyAsNull() ?? template?.Properties?.Author ?? string.Empty,
SubFlows = template.SubFlows?.Any() != true ? null : template.SubFlows
};

if(isSubFlow)
Expand Down Expand Up @@ -233,16 +234,36 @@ public class RepositoryObject
/// Gets or sets the author
/// </summary>
public string Author { get; set; }

Check warning on line 236 in Generators/RepoGenerator.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Author' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

/// <summary>
/// Gets or sets a list of sub flows this object depends on
/// </summary>
public List<Guid> SubFlows { get; set; }

Check warning on line 241 in Generators/RepoGenerator.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'SubFlows' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}


public class RepositoryObjectWithProperties : RepositoryObject
/// <summary>
/// Sub Flow repository object
/// </summary>
public class SubFlowRepositoryObject : RepositoryObject
{
/// <summary>
/// Gets or sets the properties for this sub flow
/// </summary>
public RepositoryObjectProperties Properties { get; set; }

Check warning on line 253 in Generators/RepoGenerator.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Properties' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}

/// <summary>
/// Properties of a repository object
/// </summary>
public class RepositoryObjectProperties
{
/// <summary>
/// Gets or sets the description of this object
/// </summary>
public string Description { get; set; }

Check warning on line 264 in Generators/RepoGenerator.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Description' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
/// <summary>
/// Gets or sets the author of this object
/// </summary>
public string Author { get; set; }

Check warning on line 268 in Generators/RepoGenerator.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Author' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}

0 comments on commit 16e3581

Please sign in to comment.