redhat-developer / redhat-developer/yaml-language-server

openapi discriminators

Open
#937 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
352
Avg merge
2d 7h
Merged PRs (30d)
11

Description

I am 90% sure discriminators such as the below are openapi dialect, so not sure if yaml language server is supposed to support this schema definition.

"typebase": {
      "type": "object",
      "discriminator": {
        "propertyName": "discriminator",
        "mapping": {
          "type1": "#/definitions/type1",
          "type2": "#/definitions/type2"
        }
      },
      "x-abstract": true,
      "additionalProperties": false,
      "required": [
        "code",
        "discriminator"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "discriminator": {
          "type": "string"
        }
      }
    },

Will I need to replace with if-then constructs to get the properties changing based on discriminator value? This stuff is confusing for me so maybe I made some other mistake!

Edit: can work with allOf and if-then, but with support for jsonschema <=7 can't use "unevaluatedProperties": false to restrict additional properties 🤔

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

The issue names no implementation files, tests, or entry points. Start by identifying how the YAML language server handles JSON Schema and OpenAPI validation, then determine the intended discriminator behavior and compatibility constraints; done would require a decided support approach and corresponding validation behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
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.