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

Guid like values gets guidified #138

Open
MiloszKrajewski opened this issue Feb 28, 2018 · 4 comments
Open

Guid like values gets guidified #138

MiloszKrajewski opened this issue Feb 28, 2018 · 4 comments

Comments

@MiloszKrajewski
Copy link

YamlConfig (or underlying SharpYaml.dll) lets itself to parse string values behind my back.

Example:

#r "FSharp.Configuration.dll"

open FSharp.Configuration

type Config = YamlConfig<YamlText = "Value: some text"> // <-- 1

let config = Config()
config.LoadText("Value: 77a66425d680d2925eb032ef6bcd1111") // <-- 2
printfn "%s" config.Value // 77a66425-d680-d292-5eb0-32ef6bcd1111 // <-- 3

Note:

  1. Value field gets defined as string
  2. Actual value is a string, although it may look a little bit like GUID
  3. YamlConfig decided to fix it for me

Expected result:
No hyphen should be added

Actual result:
77a66425d680d2925eb032ef6bcd1111 becomes 77a66425-d680-d292-5eb0-32ef6bcd1111

@vasily-kirichenko
Copy link
Contributor

type Config = YamlConfig<"...", InferTypesFromStrings = false>

@MiloszKrajewski
Copy link
Author

This is kind-of what I want but not exactly.
It seems like it does not infer types on compile time anymore.

I do want it to infer types, but on compile time only (YamlConfig<YamlText = "Value: some text">) not on run time (config.LoadText("Value: 77a66425d680d2925eb032ef6bcd1111")).

It seem like options currently are:

  1. neither on compile time nor run time
  2. both, on run time and compile time

@airmanx86
Copy link

@vasily-kirichenko I have similar problem and InferTypesFromStrings = false does help. It would be nice if we can only turn off certain config value like through defining a schema (json schema?) similar to the CSV provider.

@tihomir-kit
Copy link

I think it's incorrect to assume that something that doesn't contain dashes is a Guid just because of the amount of other characters and potentially the character set. It's simply not the same format.

Other type inferences might be useful to have still, so it also doesn't make a lot of sense to disable all inferences just to avoid incorrect Guid parsing.

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

4 participants