C
C#2y ago
SWEETPONY

❔ How to create json schema by class?

I have following class:
internal class ReportGenerateParameters
{
[JsonProperty(PropertyName = "departments_ids")]
public HashSet<string> DepartmentIDs { get; set; }

[JsonProperty(PropertyName = "page_break_after_department")]
public bool PageBreakAfterDepartment { get; set; } = true;

[JsonProperty(PropertyName ="show_subjects_of_nested_departments")]
public bool ShowSubjectsOfNestedDepartments { get; set; }
}
internal class ReportGenerateParameters
{
[JsonProperty(PropertyName = "departments_ids")]
public HashSet<string> DepartmentIDs { get; set; }

[JsonProperty(PropertyName = "page_break_after_department")]
public bool PageBreakAfterDepartment { get; set; } = true;

[JsonProperty(PropertyName ="show_subjects_of_nested_departments")]
public bool ShowSubjectsOfNestedDepartments { get; set; }
}
And I can create manually json schema using this class, it will look in following way: https://gist.github.com/INTERNALINTERFERENCE/ca09a767eb4027c593416ae8ff155274 I'd like to automate generating of this json. How can I do it? Can someone give some information about this?
Gist
.json
GitHub Gist: instantly share code, notes, and snippets.
3 Replies
phaseshift
phaseshift2y ago
GitHub
GitHub - RicoSuter/NJsonSchema: JSON Schema reader, generator and v...
JSON Schema reader, generator and validator for .NET - GitHub - RicoSuter/NJsonSchema: JSON Schema reader, generator and validator for .NET
SWEETPONY
SWEETPONYOP2y ago
but I need custom schema
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server