I need to get a Json Schema from a Json data string, and inside that string I have an array of another object.
I am trying to use JsonSchema.FromSampleJson, with the code
var schema = JsonSchema.FromSampleJson(Json);
var schemaJson = schema.ToJson();
return schemaJson;
where Json is this string
"{"BudgetCode":"001","BudgetIntegrationId":"0","BudgetLines":[{"Amount":0.00,"DepartamentalUnit":"10101","EndDate":"/Date(1672444800000)/","FiscalEstablishment":"2001","LineNum":1,"MainAccount":"3221","Notes":"nOTAS obs","ResponsabilityCenter":"11201","StartDate":"/Date(1640995200000)/"}],"BudgetModel":"0","BudgetPeriod":"1","Description":"1","ExternalAppID":"tst","ExternalId":"1","IntegrationId":"1","LastLine":false,"MultiLines":true,"SessionId":55,"TotalAmount":9.99,"TotalLines":2}"
This code is getting error:
System.MissingMethodException: Method not found: 'System.Collections.Generic.IEnumerable1<!!0> Namotion.Reflection.CachedType.GetInheritedAttributes()'. at NJsonSchema.Visitors.JsonReferenceVisitorBase.Visit(Object obj, String path, String typeNameHint, ISet
1 checkedObjects, Action`1 replacer)
at NJsonSchema.Visitors.JsonReferenceVisitorBase.Visit(Object obj)
at NJsonSchema.JsonSchemaReferenceUtilities.UpdateSchemaReferencePaths(Object rootObject, Boolean removeExternalReferences, IContractResolver contractResolver)
at NJsonSchema.Infrastructure.JsonSchemaSerialization.ToJson(Object obj, SchemaType schemaType, IContractResolver contractResolver, Formatting formatting)
at NJsonSchema.JsonSchema.ToJson(Formatting formatting)
I think I need to pass the type of "BudgetLines" array, but I am stucked here. I did not find any documentation for this type of use "JsonSchema.FromSampleJson"