Skip to content

Proper way to describe variant-like structure #422

Answered by jdesrosiers
red1939 asked this question in Q&A
Discussion options

You must be logged in to vote

The good new is, I don't think $dynamicRef/$dynamicAnchor is the solution you're looking for anyway. What you need is unevaluatedProperties. The bad news is, VS Code doesn't support that either 😢.

{
  "allOf": [{ "$ref": "./common" }],
  "properties": {
    "foo_1": { "type": "number" },
    "foo_2": { "type": "number" }
  },
  "unevaluatedProperties": false
}

There are two alternatives you can use that will work in VS Code, but both require some duplication.

The first is that you can use additionalProperties, but you have to put some placeholders for the properties that are declared in the common schema.

{
  "allOf": [{ "$ref": "./common" }],
  "properties": {
    "type": true,
    "info": 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by red1939
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants