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

Inferred url in yaml config should save AbsoluteUri #148

Open
lzybkr opened this issue Jan 17, 2019 · 0 comments
Open

Inferred url in yaml config should save AbsoluteUri #148

lzybkr opened this issue Jan 17, 2019 · 0 comments

Comments

@lzybkr
Copy link

lzybkr commented Jan 17, 2019

If I specify a URL in my yaml config, it seems useful to automatically infer the type to be System.Uri, but when saving the type, it doesn't seem useful to write out the properties of System.Uri, instead it should write out just the AbsoluteUri.

Reproduced with 2.0.0-alpha2 - the best workaround I've found is to add something to the sample to force the type to string.

Sample script:

#r "FSharp.Configuration.dll"

open FSharp.Configuration

type Config = YamlConfig<YamlText = "url: http://localhost">

let config = Config()
config.LoadText("url: http://localhost:9999")
config.Save("config.yml")

And the resulting config.yml:

url:
  AbsolutePath: /
  AbsoluteUri: http://localhost:9999/
  LocalPath: /
  Authority: localhost:9999
  HostNameType: Dns
  IsLoopback: true
  PathAndQuery: /
  Segments:
  - /
  Host: localhost
  Port: 9999
  Query: ''
  Fragment: ''
  Scheme: http
  OriginalString: http://localhost:9999
  DnsSafeHost: localhost
  IdnHost: localhost
  IsAbsoluteUri: true
  UserInfo: ''
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