0

I have the main Json-schema. It looks like that:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "listInfo": {
      "type": "object",
      "properties": {
        "limit": {
          "type": "integer"
        },
        "count": {
          "type": "integer"
        }
      },
      "required": [
        "offset",
        "count"
      ]
    },
    "items": {
      "type": ["array", "null"],
      "items": {
        "type": "object",
        "properties": {
          "startDate": {
            "type": "string"
          },
          "customer": {
            "type": "object",
            "properties": {
              "customerId": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "customerId",
              "name"
            ]
          }
        },
        "required": [
          "startDate",
          "customer"
        ]
      }
    }
  },
  "required": [
    "listInfo",
    "items"
  ]
}

Every time after sending a get query to a host I check Json on a validation with my schema. But Sometimes I need not all fields in it. For example I can add "&fields=startDate" in the end of my GET query. How I can generate new Json schema for my new data (I need to automatically delete lines about "customer" in my old Json schema and generate a new json-schema file)?

Beras Mark
  • 53
  • 1
  • 9
  • take a look at http://stackoverflow.com/questions/7341537/tool-to-generate-json-schema-from-json-data – Ali SAID OMAR Jul 12 '16 at 13:05
  • You didn't understand my task. I don't want to generate schema from data. I need to check validation of data with my schema. But schema depens on GET query. So I have one main schema and I need to generate schema depens on my query every time before checking validation – Beras Mark Jul 12 '16 at 13:51

0 Answers0