Skip to content

check prototype when checking object.json  #1337

Closed

Description

@adamhl8
  • ArkType version: 2.1.2
  • TypeScript version (5.1+): 5.8.2

The object.json keyword allows values I would expect it to reject. For example:

const jsonSchema = type("object.json")
const shouldBeArkErrors = jsonSchema(new Map())
if (shouldBeArkErrors instanceof type.errors) console.log(shouldBeArkErrors.summary)
// doesn't log

I think anything that can't be assigned to the internal Json type should be rejected by object.json. Never mind, that doesn't make sense for object.json since values like 1 are obviously valid JSON values.

Activity

  1. changed the title [-]`json.object` allows unexpected values[/-] [+]`object.json` allows unexpected values[/+] on Mar 4, 2025
  2. moved this from To do to Planned in arktypeioon Mar 4, 2025
  3. changed the title [-]`object.json` allows unexpected values[/-] [+]check prototype when checking object.json [/+] on Mar 5, 2025
  4. added
    enhancementNew feature or request
    confirmedThe maintainers of the repo would like to address this
    and removed
    bugSomething isn't working
    on Mar 5, 2025
  5. moved this from Planned to Backlog in arktypeioon Apr 7, 2025
  6. ssalbdivad commented on Nov 18, 2026

    @ssalbdivad
    Member

    Fixed in 3.0.0-beta.0 (#1728). Try it with npm i arktype@next.

  7. moved this from Backlog to Done (merged or closed) in arktypeioon Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

confirmedThe maintainers of the repo would like to address thisenhancementNew feature or request

Type

No type

Projects

  • Status
    Done (merged or closed)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions