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

Merging compatible Integers and Numbers #42

Open
GlennButera opened this issue Jun 19, 2023 · 0 comments
Open

Merging compatible Integers and Numbers #42

GlennButera opened this issue Jun 19, 2023 · 0 comments

Comments

@GlennButera
Copy link

Integer and Number JSON Schemas are immediately marked as incompatible without inspecting the other keywords in the schema. If a JSON Schema is of "type": "number" and has a "multipleOf" keyword value that is an integer, then it can be merged with a JSON Schema of "type": "integer" and should maintain the "multipleOf" keyword. For example:

{
  "type": "object",
  "properties": {
    "num": {
      "allOf": [
        {
          "type": "integer",
          "minimum": 1,
          "maximum": 12
        },
        {
          "type": "number",
          "minimum": 2,
          "maximum": 42,
          "multipleOf": 2
        }
      ]
    }
  }
};

can be merged into:

{
  "type": "object",
  "properties": {
    "num": {
      "type": "integer",
      "minimum": 2,
      "maximum": 12,
      "multipleOf": 2
    }
  }
};
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