Skip to content
This repository was archived by the owner on Dec 28, 2025. It is now read-only.
This repository was archived by the owner on Dec 28, 2025. It is now read-only.

Nitpick: "integer" is not a type that can restrict evaluation #81

@handrews

Description

@handrews

The "primitive types" in §7.6.1 "Assertions and Instance Primitive Types" refers to the types listed in [§4.2.1 "Instance Data Model"]. As noted in the last paragraph of that section, that does not include "integer", which is an invention of the "type" keyword.

Therefore these parts of Keyword can be simplified:

    instance_types: Tuple[str, ...] = "null", "boolean", "integer", "number", "string", "array", "object",

    def can_evaluate(self, instance: JSON) -> bool: 
        if instance.type in self.instance_types:
            return True

        if instance.type == "number" and "integer" in self.instance_types:
            return instance.data == int(instance.data)

        return False 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions