Skip to content

Inferred url in yaml config should save AbsoluteUri #148

Open

Description

@lzybkr

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: ''

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions