Product definition schema

The product definition schema defines the properties (and their data types) that you can include in a product definition file.

{
  "id": "https://api.ibm.com/product/schema.json#",
  "$schema": "http://json-schema.org/draft-06/schema#",
  "title": "A schema to represent the IBM specific API configuration",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "product",
    "info"
  ],
  "patternProperties": {
    "^x-": {}
  },
  "properties": {
    "product": {
      "type": "string",
      "enum": [
        "1.0.0"
      ]
    },
    "info": {
      "$ref": "#/definitions/InfoSection"
    },
    "visibility": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "view",
        "subscribe"
      ],
      "patternProperties": {
        "^x-": {}
      },
      "properties": {
        "view": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "enum": [
                "public",
                "authenticated",
                "custom"
              ]
            },
            "orgs": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "tags": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "enabled": {
              "type": "boolean"
            }
          }
        },
        "subscribe": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "enum": [
                "authenticated",
                "custom"
              ]
            },
            "orgs": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "tags": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "enabled": {
              "type": "boolean"
            }
          }
        }
      }
    },
    "properties": {
      "type": "object",
      "propertyNames": {
        "pattern": "^([^ ])|([^ ].*[^ ])$"
      },
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "value": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "encoded": {
            "type": "boolean"
          }
        }
      }
    },
    "catalogs": {
      "type": "object",
      "propertyNames": {
        "pattern": "^([^ ])|([^ ].*[^ ])$"
      },
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "properties": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      }
    },
    "gateways": {
      "type": "array",
      "minItems": 1,
      "items": {
        "enum": [
          "micro-gateway",
          "datapower-gateway",
          "datapower-api-gateway",
          "event-gateway"
        ]
      }
    },
    "apis": {
      "type": "object",
      "propertyNames": {
        "pattern": "^([^ ])|([^ ].*[^ ])$"
      },
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "$ref": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      }
    },
    "oauthProviders": {
      "type": "array",
      "propertyNames": {
        "pattern": "^([^ ])|([^ ].*[^ ])$"
      },
      "items": {
        "type": "string"
      }
    },
    "billings": {
      "type": "object",
      "propertyNames": {
        "pattern": "^([^ ])|([^ ].*[^ ])$"
      },
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
            "type": "string"
          }
        }
      }
    },
    "plans": {
      "type": "object",
      "propertyNames": {
        "pattern": "^([^ ])|([^ ].*[^ ])$"
      },
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "patternProperties": {
          "^x-": {}
        },
        "required": [
          "title"
        ],
        "properties": {
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "approval": {
            "type": "boolean"
          },
          "rate-limit": {
            "$ref": "#/definitions/RateLimitSection"
          },
          "rate-limits": {
            "$ref": "#/definitions/RateLimitsSection"
          },
          "burst-limits": {
            "$ref": "#/definitions/BurstLimitsSection"
          },
          "assembly-rate-limits": {
            "$ref": "#/definitions/AssemblyRateLimitsSection"
          },
          "assembly-burst-limits": {
            "$ref": "#/definitions/AssemblyBurstLimitsSection"
          },
          "assembly-count-limits": {
            "$ref": "#/definitions/AssemblyCountLimitsSection"
          },
          "billing": {
            "$ref": "#/definitions/BillingSection"
          },
          "graphql": {
            "$ref": "#/definitions/GraphqlSection"
          },
          "apis": {
            "type": "object",
            "propertyNames": {
              "pattern": "^([^ ])|([^ ].*[^ ])$"
            },
            "additionalProperties": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "operations": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "operationId": {
                        "type": "string"
                      },
                      "path": {
                        "type": "string"
                      },
                      "operation": {
                        "type": "string"
                      },
                      "rate-limit": {
                        "$ref": "#/definitions/RateLimitSection"
                      },
                      "rate-limits": {
                        "$ref": "#/definitions/RateLimitsSection"
                      }
                    }
                  }
                },
                "graphql-schema-options": {
                  "$ref": "#/definitions/GraphQLSchemaOptions"
                }
              }
            }
          }
        }
      }
    }
  },
  "definitions": {
    "GraphQLSchemaOptions": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "visibility-list"
      ],
      "properties": {
        "visibility-list": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "values"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "remove"
              ]
            },
            "values": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/NonEmptyString"
              }
            }
          }
        }
      }
    },
    "InfoSection": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "title",
        "version"
      ],
      "patternProperties": {
        "^x-": {}
      },
      "properties": {
        "name": {
          "type": "string",
          "pattern": "^([a-zA-Z0-9._]+(-)*)*([a-zA-Z0-9])$"
        },
        "version": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "termsOfService": {
          "type": "string"
        },
        "contact": {
          "type": "object",
          "additionalProperties": false,
          "patternProperties": {
            "^x-": {}
          },
          "properties": {
            "name": {
              "type": "string"
            },
            "url": {
              "type": "string",
              "format": "uri"
            },
            "email": {
              "type": "string",
              "format": "email"
            }
          }
        },
        "license": {
          "type": "object",
          "additionalProperties": false,
          "patternProperties": {
            "^x-": {}
          },
          "required": [
            "name"
          ],
          "properties": {
            "name": {
              "type": "string"
            },
            "url": {
              "type": "string",
              "format": "uri"
            }
          }
        },
        "summary": {
          "type": "string",
          "description": "Short description of the API."
        },
        "categories": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "RateLimitSection": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "value"
      ],
      "patternProperties": {
        "^x-": {}
      },
      "properties": {
        "value": {
          "$ref": "#/definitions/RateLimitValue"
        },
        "hard-limit": {
          "$ref": "#/definitions/RateLimitHardLimit"
        }
      }
    },
    "AssemblyRateLimitSection": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "value",
          "hard-limit",
          "cache-only",
          "is-client",
          "use-api-name",
          "use-app-id",
          "use-client-id"
        ],
        "patternProperties": {
          "^x-": {}
        },
        "properties": {
          "value": {
            "$ref": "#/definitions/RateLimitValue"
          },
          "hard-limit": {
            "$ref": "#/definitions/RateLimitHardLimit"
          },
          "cache-only": {
            "type": "boolean"
          },
          "is-client": {
            "type": "boolean"
          },
          "use-api-name": {
            "type": "boolean"
          },
          "use-app-id": {
            "type": "boolean"
          },
          "use-client-id": {
            "type": "boolean"
          },
          "dynamic-value": {
            "type": "string"
          },
          "weight": {
            "$ref": "#/definitions/NonEmptyString"
          }
        }
      }
    },
    "AssemblyBurstLimitSection": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "value",
          "cache-only",
          "is-client",
          "use-api-name",
          "use-app-id",
          "use-client-id"
        ],
        "patternProperties": {
          "^x-": {}
        },
        "properties": {
          "value": {
            "$ref": "#/definitions/RateLimitValue"
          },
          "cache-only": {
            "type": "boolean"
          },
          "is-client": {
            "type": "boolean"
          },
          "use-api-name": {
            "type": "boolean"
          },
          "use-app-id": {
            "type": "boolean"
          },
          "use-client-id": {
            "type": "boolean"
          },
          "dynamic-value": {
            "type": "string"
          },
          "weight": {
            "$ref": "#/definitions/NonEmptyString"
          }
        }
      }
    },
    "NonEmptyString": {
      "type": "string",
      "pattern": ".+"
    },
    "AssemblyCountLimitSection": {
      "type": "array",
      "minItems": 1,
      "maxItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "value",
          "hard-limit",
          "cache-only",
          "is-client",
          "use-api-name",
          "use-app-id",
          "use-client-id"
        ],
        "patternProperties": {
          "^x-": {}
        },
        "properties": {
          "value": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "string",
                "enum": [
                  "unlimited"
                ]
              }
            ]
          },
          "hard-limit": {
            "$ref": "#/definitions/RateLimitHardLimit"
          },
          "cache-only": {
            "type": "boolean"
          },
          "is-client": {
            "type": "boolean"
          },
          "use-api-name": {
            "type": "boolean"
          },
          "use-app-id": {
            "type": "boolean"
          },
          "use-client-id": {
            "type": "boolean"
          },
          "dynamic-value": {
            "type": "string"
          },
          "weight": {
            "$ref": "#/definitions/NonEmptyString"
          },
          "auto-decrement": {
            "type": "boolean"
          }
        }
      }
    },
    "RateLimitValue": {
      "type": "string",
      "pattern": "^(([0-9]|[1-9][0-9]{1,8}|[1-3][0-9]{9}|4[01][0-9]{8}|42[0-8][0-9]{7}|429[0-3][0-9]{6}|4294[0-8][0-9]{5}|42949[0-5][0-9]{4}|429496[0-6][0-9]{3}|4294967[01][0-9]{2}|42949672[0-8][0-9]|429496729[0-5])\\/([0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])?(second|minute|hour|day|week)|unlimited)$"
    },
    "RateLimitHardLimit": {
      "type": "boolean",
      "default": false
    },
    "RateLimitsSection": {
      "type": "object",
      "patternProperties": {
        "^x-": {}
      },
      "additionalProperties": {
        "type": "object",
        "oneOf": [
          {
            "$ref": "#/definitions/RateLimitSection"
          }
        ]
      }
    },
    "AssemblyRateLimitsSection": {
      "type": "object",
      "patternProperties": {
        "^x-": {}
      },
      "additionalProperties": {
        "type": "object",
        "$ref": "#/definitions/AssemblyRateLimitSection"
      }
    },
    "AssemblyBurstLimitsSection": {
      "type": "object",
      "patternProperties": {
        "^x-": {}
      },
      "additionalProperties": {
        "type": "object",
        "$ref": "#/definitions/AssemblyBurstLimitSection"
      }
    },
    "AssemblyCountLimitsSection": {
      "type": "object",
      "patternProperties": {
        "^x-": {}
      },
      "additionalProperties": {
        "type": "object",
        "$ref": "#/definitions/AssemblyCountLimitSection"
      }
    },
    "BurstLimitsSection": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "value"
        ],
        "patternProperties": {
          "^x-": {}
        },
        "properties": {
          "value": {
            "type": "string",
            "pattern": "^((\\d+)\\/(\\d+)?(second|minute))$"
          }
        }
      }
    },
    "GraphqlSection": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "per-query-policy": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "maximum-nesting": {
              "type": "integer"
            },
            "maximum-resolve-complexity": {
              "type": "integer"
            },
            "maximum-type-complexity": {
              "type": "integer"
            }
          }
        },
        "rate-limits": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "oneOf": [
              {
                "$ref": "#/definitions/GraphqlRateLimitSection"
              }
            ]
          }
        }
      }

    },
    "GraphqlRateLimitSection": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "resolve-complexity",
        "type-complexity"
      ],
      "properties": {
        "resolve-complexity": {
          "$ref": "#/definitions/RateLimitSection"
        },
        "type-complexity": {
          "$ref": "#/definitions/RateLimitSection"
        }
      }
    },
    "BillingSection": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "billing": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "price": {
            "type": "string",
            "pattern": "^\\d+(\\.\\d+)?$"
          },
          "period": {
            "type": "integer"
          },
          "period-unit": {
            "type": "string",
            "enum": [
              "month"
            ]
          },
          "trial-period": {
            "type": "integer"
          },
          "trial-period-unit": {
            "type": "string",
            "enum": [
              "day"
            ]
          }
        }
      }
    }
}