Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FSharp.Data.Toolbox.dll requires sample json files #1

Closed
evelinag opened this issue Apr 27, 2014 · 1 comment
Closed

FSharp.Data.Toolbox.dll requires sample json files #1

evelinag opened this issue Apr 27, 2014 · 1 comment

Comments

@evelinag
Copy link
Contributor

Compiled assembly using JSON provider (FSharp.Data.Toolbox.Twitter.dll) requires sample json files. Can we modify the project so that the files are not needed when using the Twitter provider?

tpetricek added a commit to tpetricek/FSharp.Data that referenced this issue Apr 28, 2014
This was triggered by the issue in Twitter: fsprojects/FSharp.Data.Toolbox#1

The problem is that `FSharp.Data.Toolbox.Twitter.dll` exposes the types
generated by the JSON type provider to the caller - so the methods in the
Twitter API return types generated by the type provider from sample JSON
files (I think this is reasonable - if we had to re-write all the type
declarations by hand, then this would be hard work).

The problem is that the samples are in a local folder (`json/foo.json`)
and when you build `FSharp.Data.Toolbox.Twitter.dll`, you do not want to
always keep them around (because referencing the Twitter API will trigger
the type provider and the type provider will be looking for them).
Embedding the samples inline also does not work - they are just too long
and the F# compiler cannot deal with them.

With this change, we can say `JsonProvider<"sample.json", EmbeddedResource="MyLib,sample.json">`.
The type provider will first try to load `MyLib` and find the resource
there (so, when you are referencing compiled `FSharp.Data.Toolbox.Twitter.dll`,
it will find the resource there). If this fails, it falls back to standard
directory search (which handles the case when you are compiling
`FSharp.Data.Toolbox.Twitter.dll` itself).

I'm not entirely happy with this solution (feels a bit hacky), but I do not
think that there is any other way - aside from making the type providers
generative, which would be nice thing to do, but AFAIK not something that'll
happen very soon.
@evelinag
Copy link
Contributor Author

Fixed in #6

arestenko referenced this issue in arestenko/FSharp.Data.Toolbox Oct 3, 2015
tpetricek pushed a commit that referenced this issue May 9, 2016
Bugfix: exception when date is encoded with less than 8 bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant