Import: Protobuf

Creates a data contract from a Protobuf .proto schema file.

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

Given this orders.proto:

syntax = "proto3";

package checkout;

// One row per customer order.
message Orders {
  string order_id = 1;
  string order_timestamp = 2;
  string customer_id = 3;
  int64 order_total = 4;
  string status = 5;
}

Run:

datacontract import protobuf --source orders.proto

to produce the data contract:

version: 1.0.0
kind: DataContract
apiVersion: v3.1.0
id: my-data-contract
name: My Data Contract
status: draft
schema:
- name: Orders
  physicalType: message
  description: Details of Orders.
  logicalType: object
  physicalName: Orders
  properties:
  - name: order_id
    physicalType: '9'
    description: Field order_id
    logicalType: string
    required: false
  - name: order_timestamp
    physicalType: '9'
    description: Field order_timestamp
    logicalType: string
    required: false
  - name: customer_id
    physicalType: '9'
    description: Field customer_id
    logicalType: string
    required: false
  - name: order_total
    physicalType: '3'
    description: Field order_total
    logicalType: integer
    required: false
  - name: status
# …

{/* END AUTOGENERATED EXAMPLE */}