-
Notifications
You must be signed in to change notification settings - Fork 4
/
playground.fsx
34 lines (24 loc) · 970 Bytes
/
playground.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#r "nuget: YamlDotNet, 15.1.2"
#r "../src/AVPRIndex/bin/Debug/net8.0/AVPRIndex.dll"
open AVPRIndex
open AVPRIndex.Domain
open AVPRIndex.Frontmatter
open YamlDotNet.Serialization
open System
open System.IO
open System.Text
let yamlDeserializer =
DeserializerBuilder()
.WithNamingConvention(NamingConventions.PascalCaseNamingConvention.Instance)
.Build()
let p = @"C:\Users\schne\source\repos\nfdi4plants\arc-validate-package-registry\src\PackageRegistryService\StagingArea\pride\[email protected]"
ValidationPackageMetadata.extractFromScript(p)
let f = File.ReadAllText(p).ReplaceLineEndings()
f.ReplaceLineEndings().StartsWith(Frontmatter.frontMatterStart)
f.ReplaceLineEndings().Contains(Frontmatter.frontMatterEnd)
let fm =
f.Substring(
frontMatterStart.Length,
(f.IndexOf(Frontmatter.frontMatterEnd, StringComparison.Ordinal) - frontMatterEnd.Length)
)
yamlDeserializer.Deserialize<ValidationPackageMetadata>(fm)