Navigation

IDL builder module

This module constructs the example-idl spec with mb.ornaments.idl.fromProtobuf, then exposes the same interpreter views used by the tour page.

Source path: examples/idl/builder.nix.

nix
{ mb, ... }:

let
  idl = mb.ornaments.idl;

  spec = idl.fromProtobuf {
    name = "example-idl";
    protos = [ ./schema.proto ];
    languages = [ "cpp" "java" ];
  };

  program = mb.program.fromOrnamentedSpec
    idl.IdlBuilder.T spec;

  value = {
    builder = {
      inherit (idl) IdlBuilder fromProtobuf descriptor schema;
    };
    inherit spec program;
    # Verdict only: the validated program value is already in scope.
    validation = { inherit (mb.program.validate.run program) ok diagnostics; };
    deps = mb.program.deps.run program;
    dryRun = mb.program."dry-run".run program;
    planView = mb.program."plan-view".run program;
    docs = mb.program.describe.run program;
    selfView = mb.program.introspect.run program;
    materialize = mb.program.materialize.run program;
    schemas = mb.reference.schemas;
    datatypes = mb.reference.datatypes;
  };

in
{
  scope = {
    inherit spec program value;
  };
}