Directory.Build.props
+1
-1
diff --git a/Directory.Build.props b/Directory.Build.props
index 894c52f..11aba5b 100644
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>15</LangVersion>
<LangVersion>preview</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
JsonLdRecipeParser.slnx
+7
-2
diff --git a/JsonLdRecipeParser.slnx b/JsonLdRecipeParser.slnx
index 2a82abb..ee5e7ca 100644
@@ -1,4 +1,9 @@
<Solution>
<Project Path="src/JsonLdRecipeParser/JsonLdRecipeParser.csproj" />
<Project Path="test/JsonLdRecipeParser.Tests/JsonLdRecipeParser.Tests.csproj" />
<Folder Name="/src/">
<Project Path="src/JsonLdRecipeParser/JsonLdRecipeParser.csproj" />
<Project Path="src/CompilerServices/CompilerServices.csproj" />
</Folder>
<Folder Name="/test/">
<Project Path="test/JsonLdRecipeParser.Tests/JsonLdRecipeParser.Tests.csproj" />
</Folder>
</Solution>
src/CompilerServices/ClosedAttribute.cs
+4
-0
diff --git a/src/CompilerServices/ClosedAttribute.cs b/src/CompilerServices/ClosedAttribute.cs
new file mode 100644
index 0000000..140c49c
@@ -0,0 +1,4 @@
namespace System.Runtime.CompilerServices;
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class ClosedAttribute : Attribute;
src/CompilerServices/CompilerFeatureRequiredAttribute.cs
+37
-0
diff --git a/src/CompilerServices/CompilerFeatureRequiredAttribute.cs b/src/CompilerServices/CompilerFeatureRequiredAttribute.cs
new file mode 100644
index 0000000..d7d21f6
@@ -0,0 +1,37 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Runtime.CompilerServices
{
/// <summary>
/// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
/// </summary>
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
public sealed class CompilerFeatureRequiredAttribute : Attribute
{
public CompilerFeatureRequiredAttribute(string featureName)
{
FeatureName = featureName;
}
/// <summary>
/// The name of the compiler feature.
/// </summary>
public string FeatureName { get; }
/// <summary>
/// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand <see cref="FeatureName"/>.
/// </summary>
public bool IsOptional { get; init; }
/// <summary>
/// The <see cref="FeatureName"/> used for the ref structs C# feature.
/// </summary>
public const string RefStructs = nameof(RefStructs);
/// <summary>
/// The <see cref="FeatureName"/> used for the required members C# feature.
/// </summary>
public const string RequiredMembers = nameof(RequiredMembers);
}
}
src/CompilerServices/CompilerServices.csproj
+6
-0
diff --git a/src/CompilerServices/CompilerServices.csproj b/src/CompilerServices/CompilerServices.csproj
new file mode 100644
index 0000000..aacf7ab
@@ -0,0 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>System.Runtime.CompilerServices</RootNamespace>
<AssemblyName>System.Runtime.CompilerServices</AssemblyName>
</PropertyGroup>
</Project>
src/CompilerServices/IsExternalInit.cs
+14
-0
diff --git a/src/CompilerServices/IsExternalInit.cs b/src/CompilerServices/IsExternalInit.cs
new file mode 100644
index 0000000..56b012e
@@ -0,0 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.ComponentModel;
namespace System.Runtime.CompilerServices
{
/// <summary>
/// Reserved to be used by the compiler for tracking metadata.
/// This class should not be used by developers in source code.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static class IsExternalInit { }
}
src/CompilerServices/RequiredMemberAttribute.cs
+16
-0
diff --git a/src/CompilerServices/RequiredMemberAttribute.cs b/src/CompilerServices/RequiredMemberAttribute.cs
new file mode 100644
index 0000000..8fc5eea
@@ -0,0 +1,16 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.ComponentModel;
namespace System.Runtime.CompilerServices
{
/// <summary>Specifies that a type has required members or that a member is required.</summary>
[AttributeUsage(
AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property,
AllowMultiple = false,
Inherited = false
)]
[EditorBrowsable(EditorBrowsableState.Never)]
public sealed class RequiredMemberAttribute : Attribute { }
}
src/CompilerServices/packages.lock.json
+27
-0
diff --git a/src/CompilerServices/packages.lock.json b/src/CompilerServices/packages.lock.json
new file mode 100644
index 0000000..fabeb49
@@ -0,0 +1,27 @@
{
"version": 2,
"dependencies": {
".NETStandard,Version=v2.0": {
"CSharpier.MsBuild": {
"type": "Direct",
"requested": "[1.3.0, )",
"resolved": "1.3.0",
"contentHash": "jzzLpmz7F6LyBh5FTZy8/4dEYVcAG9VjBPKryZ82LIoUuupcBkCSXzaeS/4oYcp/rBC8yVLcDstJ8CIv9n2IFw=="
},
"NETStandard.Library": {
"type": "Direct",
"requested": "[2.0.3, )",
"resolved": "2.0.3",
"contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
},
"Microsoft.NETCore.Platforms": {
"type": "Transitive",
"resolved": "1.1.0",
"contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A=="
}
}
}
}
\ No newline at end of file
src/JsonLdRecipeParser/Amount.cs
+11
-0
diff --git a/src/JsonLdRecipeParser/Amount.cs b/src/JsonLdRecipeParser/Amount.cs
new file mode 100644
index 0000000..abccf8b
@@ -0,0 +1,11 @@
namespace JsonLdRecipeParser;
public class Amount
{
public required AmountValue Value { get; set; }
public required string Unit { get; set; }
}
public closed record AmountValue;
public record ExactAmountValue(double Value) : AmountValue;
public record RangeAmountValue(double From, double To) : AmountValue;
src/JsonLdRecipeParser/Author.cs
+6
-0
diff --git a/src/JsonLdRecipeParser/Author.cs b/src/JsonLdRecipeParser/Author.cs
new file mode 100644
index 0000000..412c95c
@@ -0,0 +1,6 @@
namespace JsonLdRecipeParser;
public class Author
{
public required string Name { get; set; }
}
src/JsonLdRecipeParser/Ingredient.cs
+7
-0
diff --git a/src/JsonLdRecipeParser/Ingredient.cs b/src/JsonLdRecipeParser/Ingredient.cs
new file mode 100644
index 0000000..9ea0dfa
@@ -0,0 +1,7 @@
namespace JsonLdRecipeParser;
public class Ingredient
{
public required string Name { get; set; }
public Amount? Amount { get; set; }
}
src/JsonLdRecipeParser/Instruction.cs
+7
-0
diff --git a/src/JsonLdRecipeParser/Instruction.cs b/src/JsonLdRecipeParser/Instruction.cs
new file mode 100644
index 0000000..fd9a9e3
@@ -0,0 +1,7 @@
namespace JsonLdRecipeParser;
public class Instruction
{
public string? Name { get; set; }
public required string Text { get; set; }
}
src/JsonLdRecipeParser/InstructionSection.cs
+7
-0
diff --git a/src/JsonLdRecipeParser/InstructionSection.cs b/src/JsonLdRecipeParser/InstructionSection.cs
new file mode 100644
index 0000000..9d26536
@@ -0,0 +1,7 @@
namespace JsonLdRecipeParser;
public class InstructionSection
{
public string? Name { get; set; }
public Instruction[] Instructions { get; set; } = [];
}
src/JsonLdRecipeParser/JsonLdRecipeParser.csproj
+3
-0
diff --git a/src/JsonLdRecipeParser/JsonLdRecipeParser.csproj b/src/JsonLdRecipeParser/JsonLdRecipeParser.csproj
index 0bce9b4..c9e755b 100644
@@ -3,4 +3,7 @@
<RootNamespace>JsonLdRecipeParser</RootNamespace>
<AssemblyName>JsonLdRecipeParser</AssemblyName>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\CompilerServices\CompilerServices.csproj" Private="True" />
</ItemGroup>
</Project>
src/JsonLdRecipeParser/Nutrients.cs
+11
-0
diff --git a/src/JsonLdRecipeParser/Nutrients.cs b/src/JsonLdRecipeParser/Nutrients.cs
new file mode 100644
index 0000000..09a574b
@@ -0,0 +1,11 @@
namespace JsonLdRecipeParser;
public class Nutrients
{
public Amount? ServingSize { get; set; }
public Amount? Calories { get; set; }
public Amount? Carbohydrates { get; set; }
public Amount? Fat { get; set; }
public Amount? Fiber { get; set; }
public Amount? Protein { get; set; }
}
src/JsonLdRecipeParser/Recipe.cs
+19
-0
diff --git a/src/JsonLdRecipeParser/Recipe.cs b/src/JsonLdRecipeParser/Recipe.cs
new file mode 100644
index 0000000..bf3d173
@@ -0,0 +1,19 @@
using System;
namespace JsonLdRecipeParser;
public class Recipe
{
public required string Name { get; set; }
public string? Description { get; set; }
public Author[] Authors { get; set; } = [];
public TimeSpan? TotalTime { get; set; }
public TimeSpan? PrepTime { get; set; }
public TimeSpan? CookTime { get; set; }
public Ingredient[] Ingredients { get; set; } = [];
public InstructionSection[] InstructionSections { get; set; } = [];
public Nutrients? Nutrients { get; set; }
public Amount? Yield { get; set; }
public string[] Category { get; set; } = [];
public string[] Cuisine { get; set; } = [];
}
src/JsonLdRecipeParser/packages.lock.json
+3
-0
diff --git a/src/JsonLdRecipeParser/packages.lock.json b/src/JsonLdRecipeParser/packages.lock.json
index fabeb49..f3d98d7 100644
@@ -21,6 +21,9 @@
"type": "Transitive",
"resolved": "1.1.0",
"contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A=="
},
"System.Runtime.CompilerServices": {
"type": "Project"
}
}
}
test/JsonLdRecipeParser.Tests/packages.lock.json
+6
-0
diff --git a/test/JsonLdRecipeParser.Tests/packages.lock.json b/test/JsonLdRecipeParser.Tests/packages.lock.json
index 9bd96a2..e200380 100644
@@ -156,6 +156,12 @@
"contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ=="
},
"jsonldrecipeparser": {
"type": "Project",
"dependencies": {
"System.Runtime.CompilerServices": "[1.0.0, )"
}
},
"System.Runtime.CompilerServices": {
"type": "Project"
}
}