capnpy
capnpy copied to clipboard
Allow load_schema() to accept a str
The current API assumes that schema is saved in a file, but in my case the capnp schema is fetched from some db as a str. Maybe an argument can be add to load_schema()
to support this usage?
That sounds like a good idea.
If it is implemented we can remove a lot of boilerplate code in tests e.g.
schema = """
@0xbf5147cbbecf40c1;
struct Point {
x @0 :Int64;
y @1 :Int64;
}
"""
mypkg = self.tmpdir.join("mypkg").ensure(dir=True)
myschema = mypkg.join("myschema.capnp")
myschema.write(schema)