Comments (15)
Looks correct to me, can you post exception details?
from njsonschema.
It says "ArrayItemNotValid"
Does this screenshot help or do you need more info?
from njsonschema.
You have a validation error in the filters
property not in the values
property... Can you post its data and schema as well?
from njsonschema.
Clarification: JSON Schema does not know dictionaries. The schema describes an object which can have any properties (i.e. the dictionary keys) of type object (i.e. the dictionary values)... Because the property is nullable, its JSON Schema type can be null
or object
(as described).
from njsonschema.
Post the wrong screenshot. I know I do have an error there, I've got that fixed. maybe this screenshot will help better?
from njsonschema.
Ok, I see the problem. Probably the .NET string
is not recognized as JSON Schema object
...
from njsonschema.
The reason it can be null or object is that I didn't make it required. If it is Null, I get no errors, I only get errors when I populate it with key:value pairs as an object.
from njsonschema.
I have to implement a Unit Test... I'll report back...
from njsonschema.
Ok. Thanks!
from njsonschema.
According to http://jsonschemalint.com/draft4/ the JSON Schema validation is correct for the given data:
So we have to change the JSON Schema generator...
from njsonschema.
I've added the following unit test:
public class DictTest
{
public Dictionary<string, object> values { get; set; }
}
[TestMethod]
public void When_dictionary_value_is_null_then_string_values_are_allowed()
{
//// Arrange
var schema = JsonSchema4.FromType<DictTest>();
var schemaData = schema.ToJson();
var data = @"{
""values"": {
""key"": ""value"",
}
}";
//// Act
var errors = schema.Validate(data);
//// Assert
Assert.AreEqual(0, errors.Count);
}
Is this correct?
from njsonschema.
Commit: 6406618
from njsonschema.
v2.11 now available via NuGet, please try with this version and report if it works...
from njsonschema.
Sorry it took a while to get back with you on this. Yes, this fixed the issue and now dictionary works correctly.
from njsonschema.
Nice. Thx for reporting the issue and using the library...
from njsonschema.
Related Issues (20)
- Infinite loop in RenamePropertyWithSameNameAsClass
- C#11 required member support when generating a schema from a type
- Could not find the JSON path of a referenced schema: Manually referenced schemas must be added to the 'Definitions' of a parent schema
- Repository in nuget package is point not to repository HOT 1
- System.TypeLoadException: Could not load type 'NJsonSchema.Annotations.JsonSchemaFlattenAttribute' from assembly 'NJsonSchema, Version=11.0.0.0
- Question: Retrieve JSON Schema definition for a Json Element/Node?
- System.MissingMethodException: Method not found: 'Void NJsonSchema.JsonSchema.set_Type(NJsonSchema.JsonObjectType) HOT 1
- Bug: Public Fields not showing up when using System.Text.Json
- Values set in custom Schema Processor are overwritten during schema generation
- CSharpClientGenerator and CSharpGenerator not working together
- Using the generic type 'JsonInheritanceConverter<TBase>' requires 1 type argument HOT 2
- NJsonSchema generated code throwing The JSON value could not be converted HOT 1
- Improve base package readme
- AllowAdditionalProperties - not working
- Format "guid" vs "uuid"
- Validation Failures On All JSON Schema Draft Versions
- Private expression-bodied read-only properties should be ignored HOT 1
- Unable to generate document when XmlElement[] is a property of the class
- JsonProperty not working on version 11.0.0 (working on 10.9.0) HOT 1
- Referenced schema could not be loaded when defined in external schema file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from njsonschema.