local moo = import "moo.jsonnet";
// A schema builder in the given path (namespace)
local ns = "test";
local s = moo.oschema.schema(ns);
local test = {
bool_data: s.boolean("BoolData", doc="A bool"),
a_record: s.record("ARecord",
[
s.field("a_field", self.bool_data, false,
doc="A test field"),
],
doc="Test record"),
};
// Output a topologically sorted array.
moo.oschema.sort_select(test, ns)
generates the following hpp file:
#ifndef TEST_STRUCTS_HPP
#define TEST_STRUCTS_HPP
#include <cstdint>
namespace test {
// @brief A bool
using BoolData = bool;
// @brief Test record
struct ARecord {
// @brief A test field
BoolData a_field = False;
};
} // namespace test
#endif // TEST_STRUCTS_HPP
Thanks, yes, this looks to be a gap in C++ support in the templates. The Python "spelling" of false is leaking through and not getting translated to a C++ spelling. I'll fix it.
Hello,
The following schema jsonnet,
generates the following hpp file:
where
BoolData a_field = False;
is not valid C++.Do you know if this is an issue with
moo
?Regards, Stoyan