I am new to JSON, but I understand C# a bit. I have a JSON schema and I ran across a part that I'm not sure how to put it in the objects class.
"def_subscore": {
"type": "number",
"minimum": 0,
"maximum": 10
},
"def_impact": {
"type": "object",
"properties": {
"baseMetricV3": {
"type": "object",
"properties": {
"cvssV3": {"$ref": "cvss-v3.0.json"},
"exploitabilityScore": {"$ref": "#/definitions/def_subscore"},
"impactScore": {"$ref": "#/definitions/def_subscore"}
}
}
}
}
As we can see baseMetricV3
is a class object and defined with it's type and properties. exploitabilityScore
is supposed to be a "Subscore" which is defined as a number with min and max limitations.
Can I make a class that acts like a double/integer and also has to pass class-specific validations?
Is the schema just saying exploitabilityScore
and impactScore
are just double/integers that require validation in my code to make sure the value falls between 0 and 10?
Or is the schema just saying exploitabilityScore
and impactScore
are just double/integers, by the way the data should never come through with values outside of 0 and 10 (as in the validation was already done on their side and the def_subscore
was more of an informative)?