json-schema-org / json-schema-org/website

prefixItems should not allow arrays of variable length

Open
#193 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

💬 Question 📝 Documentation Status: Do not close
Dominant language
HTML
Stars
169
Forks
484
Avg merge
2d 2h
Merged PRs (30d)
6

Description

The documentation states that the keyword prefixItems is used for tuple validation.
In the realm of programming and mathematics a tuple is something that has specific length.
Quoting Wikipedia:

In computer science, tuples come in many forms. Most typed functional programming languages implement tuples directly as product types,[1] tightly associated with algebraic data types, pattern matching, and destructuring assignment.[2] Many programming languages offer an alternative to tuples, known as record types, featuring unordered elements accessed by label.[3] A few programming languages combine ordered tuple product types and unordered record types into a single construct, as in C structs and Haskell records. Relational databases may formally identify their rows (records) as tuples.

The json schema specification should follow common conventions or choose a better description for this validation.

In my opinion referring to arrays with variable as length as tuples is something that goes against the definition of the tuple and creates unnecessary confusion.

I would suggest that prefixItems stays as it is and it requires that all sub schemas validate the array elements in order. No more elements or should be allowed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the current documentation and specification language for prefixItems, then consider the issue's proposed fixed-length interpretation against the existing tuple-validation terminology. Done means the project reaches and records a maintainer-approved decision about the behavior and its documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.