xeipuuv/gojsonschema

Get all properties under a section

rajsenthil opened this issue · 0 comments

I have json schema as given below

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "https://example.com/product.schema.json",
  "title": "Demo",
  "description": "Demo properties and its definition",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "nested-prop": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "A unique id and cane be used in UI forms for an 'id' attribute "
        },
        "name": {
          "type": "string",
          "description": "handler name. This name can be used in UI form for 'name' attribute"
        },
        "label": {
          "type": "string",
          "description": "Label is used for displaying purpose. It is visible for example in UI forms"
        },
        "target": {
          "type": "string",
          "description": "'target' is a target service that validates and take actions"
        }
      },
      "required": ["id", "name", "label", "target"]
    }
  },
  "required": ["nested-prop"]
}

Is there a way, to get all the properties under nested-prop in some way ["id", "name", "label", "target"]?

Please let me know