Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

Add proof of concept for Thot.Json code generation #17

Closed
wants to merge 2 commits into from
Closed

Add proof of concept for Thot.Json code generation #17

wants to merge 2 commits into from

Conversation

alfonsogarciacaro
Copy link
Contributor

@alfonsogarciacaro alfonsogarciacaro commented Feb 27, 2018

Instructions :)

cd tools/CodeGenerator
dotnet run ../path/to/Project.fsproj Namespace.WithTypes

image

@alfonsogarciacaro
Copy link
Contributor Author

Don't look at ProjectCoreCracker.fs, I don't understand it either ;) Check Program.fs, the types in FCS can be a bit tricky, please ask me if you have questions (right now the tool asumes all types are records).

@MangelMaxime
Copy link
Owner

Oups, I looked at ProjectCoreCracker.fs :trollface:

Thanks for the code, I will play a bit with it :)

@jgrund
Copy link
Contributor

jgrund commented Mar 12, 2018

Let me know if you need some complex encoding / decoding examples, I have a few spots I'm converting to Thot that I can point you at.

@MangelMaxime
Copy link
Owner

@jgrund Are you using custom decoders ?

In my complexe structure, I am using some of them for decoding Date for example. I wonder, if I should not add an extension to Thot.Json for common decoders like that.

@jgrund
Copy link
Contributor

jgrund commented Mar 12, 2018

Date seems like something that could be configurable on the encoding side at least (different consumers may work with different datetime representations).

I'm converting a bunch of code from {of/to}Json to use Thot. I've needed one custom transform to deal with somewhat dynamic key names. Besides that it's dealing with a bunch of DU's and large records and a recursive DU.

@MangelMaxime
Copy link
Owner

Oh I don't think I have recursive DU in my code base so yes if you can share some types that could help us :)

@jgrund
Copy link
Contributor

jgrund commented Mar 12, 2018

https://github.com/intel-hpdd/rust-libzfs/blob/master/Fable.Import.NodeLibzfs/fable/NodeLibzfs.fs

Has a bunch of types I just converted to use Thot. Recursive bit is any field that contains VDev array.

@MangelMaxime
Copy link
Owner

Awesome thank you :)

I am abusing, if I ask for a json ? I didn't look at the repo to see if it's easy to produce one or no.

@jgrund
Copy link
Contributor

jgrund commented Mar 12, 2018

Sure, we have tests that are covering everything here (and have JSON strings that are being decoded): https://github.com/intel-hpdd/rust-libzfs/blob/master/Fable.Import.NodeLibzfs/test/NodeLibzfs.Test.fs

And generated snapshots for the output here (that have JSON strings output from encoding): https://github.com/intel-hpdd/rust-libzfs/blob/master/Fable.Import.NodeLibzfs/test/__snapshots__/NodeLibzfs.Test.fs.snap

@MangelMaxime
Copy link
Owner

I am closing in favor of #20 , I already started a discussion with Krys about that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants