question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[json] improve property suggestions with oneOf

See original GitHub issue
  • VSCode Version: Version 1.20.0-insider
  • OS Version: 10.13.3

Steps to Reproduce:

  1. Use this JSON schema
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "oneOf": [
        {
            "title": "Wrapper",
            "type": "object",
            "required": [
                "asset"
            ],
            "properties": {
                "asset": {
                    "type": "object"
                }
            }
        },
        {
            "title": "No Wrapper",
            "type": "object",
            "properties": {
                "id": {
                    "type": "string"
                }
            }
        }
    ]
}
  1. Start writing JSON using this schema and type:
{
    ""
}
  1. Only id is suggested as an option, I expect both asset and id to be suggestions

NOTE: if i make “id” also required I get the correct suggestions.

Does this issue occur when all extensions are disabled?: Yes/No Yes

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:9
  • Comments:15

github_iconTop GitHub Comments

6reactions
Morrizcommented, May 7, 2021

any more progress here?

6reactions
CarlosCarmonacommented, Apr 10, 2020

I have the same problem.

  • VSCode Version: Version 1.44.0
  • macOS Version: 10.15.4

Steps to Reproduce:

  1. Use this JSON schema
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "required": ["chains"],
  "properties": {
    "chains": {
      "oneOf": [
        {
          "type": "array",
          "items": {
            "$ref": "chain.json"
          }
        },
        {
          "type": "array",
          "items": {
            "properties": {
              "chain_path": {
                "type": "string"
              }
            }
          }
        }
      ]
    }
  }
}
  1. Start writing JSON using this schema and type:
{
  "$schema": "the_schema.json",
  "chains": [
    {
      ""
    }
  ]
}
  1. Only id is suggested as an option (“chain_path”), I expect both asset and id to be suggestions.

Does this issue occur when all extensions are disabled?: Yes

thnx.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to prevent additions properties when using oneOf in ...
I want to restrict the validation to not allow addition properties. In the JSON example, the properties "noAllowedInt" and "notAllowedObject" ...
Read more >
How to properly use oneOf and anyOf in Rest Schema?
1 Answer 1 · We need to set the (default/initial) type of the data.items to null instead of object . (and yes, the...
Read more >
Implementations - JSON Schema
Dashjoin JSON Schema editor - Graphical online JSON Schema editor for draft-06 (minus oneOf, anyOf, allOf, not). The generated schema can be tested...
Read more >
JSON Schema Serializer and Deserializer
Configure the JSON Schema serializer to use your oneOf for serialization, and not the event type, by configuring the following properties in your...
Read more >
JSON Schema in RDF - W3C
JSON schema defines the $id and $ref keywords to increase reusability but also to define schemas in a recursive fashion. This feature is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found