Export: JSON Schema

Converts the data contract to a JSON Schema document.

{/* AUTOGENERATED EXAMPLE: do not edit by hand; regenerate with the update script. */}

datacontract export jsonschema orders.odcs.yaml --schema-name orders --output orders.schema.json

Running this against the example orders contract produces:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "order_id": {
      "type": "string",
      "primaryKey": true,
      "unique": true,
      "description": "Unique identifier of the order."
    },
    "order_timestamp": {
      "type": "string",
      "format": "date",
      "description": "Timestamp when the order was placed."
    },
    "customer_id": {
      "type": "string",
      "description": "Reference to the customer who placed the order."
    },
    "order_total": {
      "type": "number",
      "description": "Total amount of the order in cents."
    },
    "status": {
      "type": "string",
      "description": "Current fulfilment status of the order."
    }
  },
  "required": [
    "order_id",
    "order_timestamp",
    "customer_id",
    "order_total",
    "status"
  ],
  "description": "One row per customer order."
}

{/* END AUTOGENERATED EXAMPLE */}