OAI / OAI/Overlay-Specification

V2 - make update/remove/copy mutually exclusive

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

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
121
Forks
38
Avg merge
53m
Merged PRs (30d)
6

Description

not-remove-with-copy.yaml
not-update-with-copy.yaml
not-update-with-remove.yaml

The v1 specification allows update/copy/remove to be in the same action definition even though it's semantically meaningless. It also defines "an order of precedence" of each keyword, which is going to become more difficult to maintain, and understand by readers, as we introduce more keywords.

I propose that we make those mutually exclusive in the language, but also in the schema. Here is the salvaged schema update from my pull request.

  action-object:
    properties:
      target:
        type: string
        pattern: ^\$
      description:
        type: string
    oneOf:
      - properties:
          update:
            type:
              - string
              - boolean
              - object
              - array
              - number
              - "null"
        required:
          - update
      - properties:
          copy:
            type: string
        required:
          - copy
      - properties:
          remove:
            type: boolean
            default: false
        required:
          - remove
    required:
      - target
    $ref: "#/$defs/specification-extensions"
    unevaluatedProperties: false
  specification-extensions:
    patternProperties:
      ^x-: true

Originally posted by @baywet in https://github.com/OAI/Overlay-Specification/pull/150#discussion_r2448832872

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 proposed action-object schema and the three attached YAML examples for update/copy/remove combinations. Trace where the v1 language and schema are defined, then verify that each action permits only one of these keywords and that the examples are rejected appropriately.

Written by the indexing model from the issue text.

Assessment

Tech stack
yaml
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.