Skip to content

multipleOf less than 1 doesn't validate with json_matches_schema #67

@johncmacy

Description

@johncmacy

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Number schemas with a multipleOf less than 1 don't validate. For example, 17.2 should be valid against the schema {"type": "number","multipleOf": 0.1}, but json_matches_schema returns false.

I have verified the expected behavior using jsonschemavalidator.net.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

Run the following in a Postgres database with the extension installed:

SELECT json_matches_schema(
  '{"type": "number","multipleOf": 0.1}',
  '17.2'
);

The above statement returns false.

Expected behavior

The above statement should return true.

Screenshots

N/A

System information

  • PostgreSQL: v16 (Neon)

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions