Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upschemas: rootType for advanced data layouts #208
Conversation
|
To be more specific, I’ve found it rather difficult to connect a schema to the data for an advanced layout in the implementation of the advanced layout itself. It’s actually not very practical to implement an advanced layout in a This PR would get me out of my current hack (naming the rootType and the advanced layout the same name). |
I wrote some code late last night that might be more illuminating. I’ve broken the data layout entirely into its own schema and implementation file and plan to eventually publish them as a separate module. I do a full API generation with these using When I do the main unixfsv2 The great thing about this approach is that it gets us completely out of needing any kind of import or reference syntax between schemas in the schema language itself. If a schema relies on an undeclared type an exception will occur when trying to generate an API for it. API generation and codegen can simply consume their own output from the dependent schema, leaving all of the details of how Advanced layout methods are defined and what the API’s look like for these types to the ecosystem and implementors of different |
|
(all your links are wrong now you've rearranged your repo btw, have to navigate to One minor benefit of a |
ya, i found out that aegir’s linter was actually ignoring
One thing that we considered for a minute and then dropped recently was: maybe all Advanced Layouts should be unions. I think we sort of dropped it because it was so different from what we’ve been doing and because it was a little heavy handed. However, looking at the Data schema, maybe they should be. It would change the layout a little and where I would put the advanced logic, but it would also forcibly add even more future proofing which may actually be a good thing. @warpfork I’m curious what you think. The idea was rather simple: all Advanced Layouts are unions and therefor have a union style syntax.
This first came up when we discussed how to best cover the schema migration problem in the context of advanced layouts, “what happens when you want to apply a different type.” To which my response was “if it wasn’t setup as a union you’re kind of screwed anyway.” |
optional, maybe it shouldn't beadvanced Foo {}rather than the currentadvanced Foo?@mikeal has good example of how this is useful, when you have an integrated set of components that included
advancedlayouts, withoutrootTypethey don't connect cleanly. It's still unclear exactly what you'd want when you're consuming someone else's ADL and don't want to care about the internal pieces of it (our HashMap or Vector for instance). And, do I need a schema and to use our tooling to produce publish an ADL? Can't I make one entirely programmatic that you could pick off the shelf?Anyway,
optionalgives us some wriggle room while we figure all of this stuff out.