Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Values for 'minimum' and 'maximum' should match the schema type. #305

Open
wmeijers opened this issue Nov 3, 2022 · 0 comments
Open

Values for 'minimum' and 'maximum' should match the schema type. #305

wmeijers opened this issue Nov 3, 2022 · 0 comments

Comments

@wmeijers
Copy link

wmeijers commented Nov 3, 2022

Currently, the JSchema properties 'Minimum' and 'Maximum' are defined as 'double'.
This implies that, if you create a schema like this:

JSchema schema = new JSchema()
{
  Minimum = 10,
  Maximum = 1000,
  ExclusiveMaximum = true,
  Type = JSchemaType.Integer
};

This is written as:

{
    "type": "integer",
    "minimum": 10.0,
    "exclusiveMaximum": 1000.0
}

Unfortunately, this breaks some code generators (apart from not looking 'right').
When generating these properties, the schema writer should take the schema type into account (and defaults to integer).
You could argue whether these properties must be written at all when the type is not 'integer' or 'number'.

Thanks for any support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant