skip to Main Content

I have the following json schema:

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "http://example.com/schemas/example",
    "type": "object",
    "title": "example service",
    "properties": {
        "dependencies": {
            "type": "array",
            "required": [
                "items"
            ],
            "minItems": 1,
            "items": {
                "anyOf": [{
                        "$ref": "#/definitions/resource1"
                    },
                    {
                        "$ref": "#/definitions/another_resource"
                    }
                ]
            }
        }
    },
    "definitions": {
        "resource1": {
            "additionalProperties": false,
            "type": "object",
            "properties": {
                "requiredProperty": {
                    "type": "string",
                    "enum": [
                        "requiredValue"
                    ]
                },
                "notRequiredProperty": {
                    "type": "string"
                },
                "required": [
                    "requiredProperty"
                ]
            }
        }
    }
}

In my code editor, when I add the below, i get a message that says i can choose to autofill all required properties, which is great. But what I am looking for is a way for a user to see all the properties available to them. Is this a code editor thing? Or is this something JSON schema just doesn’t handle?

dependencies:
  - type: requiredValue

2

Answers


  1. This is a code editor issue. JSON Schema is just the schema format. Other tooling such as linting and code completion is built on top of it.

    Login or Signup to reply.
  2. JSONBuddy provides a list of possible properties while editing your JSON data. There is a separate window with a list of properties together with an inline entry-helper while typing property names.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search