Hi, I am working with a quite complex schema and I am having trouble with having all classes convert from JSON schema to C#.
The schema looks like the following snippet:
"Material": {
"patternProperties": {
"^.*\\S.*$": {
"type": "object",
"properties": {
"roughness": {
"type": "string",
"enum": [
"MediumRough",
"MediumSmooth",
"Rough",
"Smooth",
"VeryRough",
"VerySmooth"
]
},
"thickness": {
"type": "number",
"units": "m",
"minimum": 0.0,
"exclusiveMinimum": true,
"ip-units": "in"
},
"conductivity": {
"type": "number",
"units": "W/m-K",
"minimum": 0.0,
"exclusiveMinimum": true
},
"density": {
"type": "number",
"units": "kg/m3",
"minimum": 0.0,
"exclusiveMinimum": true
},
"specific_heat": {
"type": "number",
"units": "J/kg-K",
"minimum": 100.0
},
"thermal_absorptance": {
"type": "number",
"minimum": 0.0,
"exclusiveMinimum": true,
"default": 0.9,
"maximum": 0.99999
},
"solar_absorptance": {
"type": "number",
"default": 0.7,
"minimum": 0.0,
"maximum": 1.0
},
"visible_absorptance": {
"type": "number",
"minimum": 0.0,
"default": 0.7,
"maximum": 1.0
}
},
"required": [
"roughness",
"thickness",
"conductivity",
"density",
"specific_heat"
]
}
},
"name": {
"type": "string",
"is_required": true,
"reference": [
"MaterialName"
]
}
}
and the output from quicktype looks like:
[JsonProperty("Material", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
public Material Material { get; set; }
I was expecting something closer to:
public partial class Material
{
[JsonProperty("conductivity")]
public double Conductivity { get; set; }
[JsonProperty("density")]
public double Density { get; set; }
[JsonProperty("roughness")]
public RoughnessOfCollectorEnum Roughness { get; set; }
[JsonProperty("solar_absorptance", NullValueHandling = NullValueHandling.Ignore)]
public double? SolarAbsorptance { get; set; }
[JsonProperty("specific_heat")]
public double SpecificHeat { get; set; }
[JsonProperty("thermal_absorptance", NullValueHandling = NullValueHandling.Ignore)]
public double? ThermalAbsorptance { get; set; }
[JsonProperty("thickness")]
public double Thickness { get; set; }
[JsonProperty("visible_absorptance", NullValueHandling = NullValueHandling.Ignore)]
public double? VisibleAbsorptance { get; set; }
}
I would appreciate any pointers that could help me with this conversion.
I am attaching the full schema here:
Energy+.schema.zip
An older version of the schema converted nicely with quicktype. I am also adding that here.
Energy+.schema_old.zip
Hi, I am working with a quite complex schema and I am having trouble with having all classes convert from JSON schema to C#.
The schema looks like the following snippet:
and the output from quicktype looks like:
I was expecting something closer to:
I would appreciate any pointers that could help me with this conversion.
I am attaching the full schema here:
Energy+.schema.zip
An older version of the schema converted nicely with quicktype. I am also adding that here.
Energy+.schema_old.zip