You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.Net Target (if relevant, please specify the version in the description)
.Net (5 or after)
A clear and concise description of the bug.
According to the specification and the description on the package page, the MaxItems and MinItems attributes are valid for an array (or collection of items). However, when generating a schema for a class containing a list of strings with MinItems and MaxItems attributes, these keywords are also part of the items object in the schema.
What did you expect?
I would expect the following result, i.e. that minItems and maxItems are listed only in the object describing the array type and the object in the items property no longer contains these keywords.
Nuget Package
JsonSchema.Net.Generation
Package Version
3.4.1
Operating System
Windows
.Net Target (if relevant, please specify the version in the description)
.Net (5 or after)
A clear and concise description of the bug.
According to the specification and the description on the package page, the MaxItems and MinItems attributes are valid for an array (or collection of items). However, when generating a schema for a class containing a list of strings with MinItems and MaxItems attributes, these keywords are also part of the items object in the schema.
What did you expect?
I would expect the following result, i.e. that minItems and maxItems are listed only in the object describing the array type and the object in the items property no longer contains these keywords.
Expected result of generator
Please add test code or steps to reproduce the behavior.
Model
Execution
Result of generator
Is there any other information you'd like to share regarding this bug?
During my debugging I came across the following condition inside MaxItemsAttribute (and MinItemsAttribute) in AddConstraints method:
The extension method itself has the following implementation:
However, the string type also satisfies the condition typeof(IEnumerable).IsAssignableFrom(type)
Code of Conduct
The text was updated successfully, but these errors were encountered: