Skip to content

Commit

Permalink
Fixing resolvers
Browse files Browse the repository at this point in the history
  • Loading branch information
ansulgoenka committed Apr 19, 2022
1 parent a122d63 commit a4e4495
Show file tree
Hide file tree
Showing 49 changed files with 1,433 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
12 changes: 12 additions & 0 deletions Author.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DemoChoco
{
public class Author
{
public string Name { get; set; }
}
}
14 changes: 14 additions & 0 deletions Book.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DemoChoco
{
public class Book
{
public string Title { get; set; }

public Author Author { get; set; }
}
}
86 changes: 86 additions & 0 deletions Data/DataRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using HotChocolate.Validation;
using System.Globalization;

namespace DemoChoco.Data
{
public class DataRepository
{
public List<Human> humans = new List<Human>
{
new Human
{
Name = "foo",
Address = "foo"
},
new Human
{
Name = "foo2",
Address = "foo2"
}
};

public List<Dog> dogs = new List<Dog>
{
new Dog
{
Barks = true,
BarkVolume = 1,
Name = "Tofu",
Nickname = "Tofu",
Owner = new Human
{
Name = "foo",
Address = "foo"
}
},
new Dog
{
Barks = true,
BarkVolume = 3,
Name = "Ink",
Nickname = "Ink"
}
};

public List<Cat> cats = new List<Cat>
{
new Cat
{
MeowVolume = 1,
Name = "Tofu",
Nickname = "Tofu"
},
new Cat
{
MeowVolume = 3,
Name = "Ink",
Nickname = "Ink"
}
};

public string[] stringList =
{
"foo", "asd", "bar", "baz"
};

public void AddCat(List<Object> cat)
{
cats.Add(new Cat
{
Name = (string)cat[0],
MeowVolume = (int?)cat[2],
Nickname = (string)cat[1]
});
}

public void AddDog(List<Object> dog)
{
dogs.Add(new Dog
{
Name = (string)dog[0],
BarkVolume = (int?)dog[2],
Nickname = (string)dog[1]
});
}
}
}
14 changes: 14 additions & 0 deletions DemoChoco.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HotChocolate.AspNetCore" Version="12.6.2" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions DemoChoco.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32228.430
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DemoChoco", "DemoChoco.csproj", "{C9E76BAD-F7E1-44F5-ACF3-C30828F90FAD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C9E76BAD-F7E1-44F5-ACF3-C30828F90FAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9E76BAD-F7E1-44F5-ACF3-C30828F90FAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9E76BAD-F7E1-44F5-ACF3-C30828F90FAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9E76BAD-F7E1-44F5-ACF3-C30828F90FAD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3F5908EA-4FFD-41EE-B616-3CE13F232F7C}
EndGlobalSection
EndGlobal
9 changes: 9 additions & 0 deletions Models/Alien.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace HotChocolate.Validation
{
public class Alien
: ISentient
{
public string Name { get; set; }
public string HomePlanet { get; set; }
}
}
21 changes: 21 additions & 0 deletions Models/Cat.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using HotChocolate.Validation.Types;

namespace HotChocolate.Validation
{
public class Cat
: IPet
{
public string Name { get; set; }

public string Nickname { get; set; }

public int? MeowVolume { get; set; }

public FurColor? FurColor { get; set; }

public bool DoesKnowCommand(CatCommand catCommand)
{
return true;
}
}
}
9 changes: 9 additions & 0 deletions Models/CatCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace HotChocolate.Validation
{
public enum CatCommand
{
JUMP
}


}
11 changes: 11 additions & 0 deletions Models/ComplexInput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace HotChocolate.Validation
{
public class ComplexInput
{
public string? Name { get; set; }

public string? Owner { get; set; }

public ComplexInput? Child { get; set; }
}
}
11 changes: 11 additions & 0 deletions Models/ComplexInput2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace HotChocolate.Validation
{
public class ComplexInput2
{
public string Name { get; set; }

public string Owner { get; set; }

public ComplexInput2 Child { get; set; }
}
}
26 changes: 26 additions & 0 deletions Models/Dog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace HotChocolate.Validation
{
public class Dog
: IPet
{
public string Name { get; set; }

public string? Nickname { get; set; }

public int? BarkVolume { get; set; }

public bool Barks { get; set; }

public Human? Owner { get; set; }

public bool DoesKnowCommand(DogCommand dogCommand)
{
return true;
}

public bool IsHouseTrained(bool? atOtherHomes)
{
return true;
}
}
}
11 changes: 11 additions & 0 deletions Models/DogCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace HotChocolate.Validation
{
public enum DogCommand
{
Sit,
Down,
Heel
}


}
9 changes: 9 additions & 0 deletions Models/Human.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace HotChocolate.Validation
{
public class Human : ISentient
{
public string Name { get; set; }

public string Address { get; set; }
}
}
7 changes: 7 additions & 0 deletions Models/IPet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace HotChocolate.Validation
{
public interface IPet
{
string Name { get; }
}
}
9 changes: 9 additions & 0 deletions Models/ISentient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace HotChocolate.Validation
{
public interface ISentient
{
string Name { get; }
}


}
Loading

0 comments on commit a4e4495

Please sign in to comment.