oxidecomputer / oxidecomputer/typify

handling of `not` is incorrect in the general case

Open
#489 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
898
Forks
114
Avg merge
4h 18m
Merged PRs (30d)
14

Description

Currently we don't properly handle the general case of not. We do (pretty much) properly address cases such as this:

{
  "allOf": [
    { "$ref": "#/$defs/foo" },
    {
      "not": {
        "required": [ "bar" ]
      }
    }
  ]
}

However, we don't handle

{
  "allOf": [
    { "$ref": "#/$defs/foo" },
    {
      "not": {
        "required": [ "bar", "baz" ]
      }
    }
  ]
}

We also don't handle properties in the not schema.

We can think of the various components of a not schema as independent constraints. So if a not schema contains independent constraints X, Y, and Z, we could rewrite that as not: allOf: [X, Y Z]. Then we can transform that into anyOf: [ not: X, not: Y, not: Z]. While we don't currently properly handle anyOf (see #414), once we do, that will turn into a oneOf power set of those.

Contributor guide

No contributing guide indexed for this repository

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

No files or tests are named. Start by reviewing the existing handling of not and the related anyOf work in issue #414. Done means supporting multi-constraint and property-containing not schemas, with behavior matching the transformations described in this issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.