Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/GraphQL.Relay.StarWars/Types/Film.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public FilmGraphType(Swapi api)
);
}

public override Task<Films> GetById(string id) =>
public override Task<Films> GetById(IResolveFieldContext<object> context, string id) =>
_api.GetEntity<Films>(id);
}
}
2 changes: 1 addition & 1 deletion src/GraphQL.Relay.StarWars/Types/People.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public PeopleGraphType(Swapi api)
);
}

public override Task<People> GetById(string id) =>
public override Task<People> GetById(IResolveFieldContext<object> context, string id) =>
_api.GetEntity<People>(id);

}
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL.Relay.StarWars/Types/Planet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public PlanetGraphType(Swapi api)
);
}

public override Task<Planets> GetById(string id) =>
public override Task<Planets> GetById(IResolveFieldContext<object> context, string id) =>
_api.GetEntity<Planets>(id);

}
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL.Relay.StarWars/Types/Species.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public SpeciesGraphType(Swapi api)
);
}

public override Task<Species> GetById(string id) =>
public override Task<Species> GetById(IResolveFieldContext<object> context, string id) =>
_api.GetEntity<Species>(id);

}
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL.Relay.StarWars/Types/Starship.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public StarshipGraphType(Swapi api)
);
}

public override Task<Starships> GetById(string id) =>
public override Task<Starships> GetById(IResolveFieldContext<object> context, string id) =>
_api.GetEntity<Starships>(id);

}
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL.Relay.StarWars/Types/Vehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public VehicleGraphType(Swapi api)
);
}

public override Task<Vehicles> GetById(string id) =>
public override Task<Vehicles> GetById(IResolveFieldContext<object> context, string id) =>
_api.GetEntity<Vehicles>(id);

}
Expand Down
6 changes: 3 additions & 3 deletions src/GraphQL.Relay.Test/NodeTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ public DroidType()

public class DroidType : DroidType<Droid>
{
public override Droid GetById(string id)
public override Droid GetById(IResolveFieldContext<object> context, string id)
{
return new Droid { Id = id, Name = "text" };
}
}

public class DroidTypeAsync : DroidType<Task<Droid>>
{
public override async Task<Droid> GetById(string id)
public override async Task<Droid> GetById(IResolveFieldContext<object> context, string id)
{
await Task.Delay(0);
return new Droid { Id = id, Name = "text" };
Expand All @@ -57,7 +57,7 @@ public async void it_should_allow_async()
{
var type = new DroidTypeAsync();

var droid = await type.GetById("3");
var droid = await type.GetById(null, "3");
droid.Id.ShouldBe("3");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL.Relay.Test/Types/QueryGraphTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public SimpleNodeGraphType() : base()
Id(x => x.Id);
}

public override SimpleData GetById(string id) => SimpleData
public override SimpleData GetById(IResolveFieldContext<object> context, string id) => SimpleData
.GetData()
.FirstOrDefault(x => x.Id.Equals(id));

Expand Down
4 changes: 2 additions & 2 deletions src/GraphQL.Relay.Todo/Schema/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public TodoGraphType() {
Field("complete", t => t.Completed);
}

public override Todo GetById(string id) =>
public override Todo GetById(IResolveFieldContext<object> context, string id) =>
Database.GetTodoById(id);
}

Expand Down Expand Up @@ -61,7 +61,7 @@ public UserGraphType() {
);
}

public override User GetById(string id) =>
public override User GetById(IResolveFieldContext<object> context, string id) =>
Database.GetUserById(id);
}

Expand Down
6 changes: 3 additions & 3 deletions src/GraphQL.Relay/Types/NodeGraphType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class GlobalId

public interface IRelayNode<out T>
{
T GetById(string id);
T GetById(IResolveFieldContext<object> context, string id);
}

public static class Node
Expand Down Expand Up @@ -54,7 +54,7 @@ protected NodeGraphType()
Interface<NodeInterface>();
}

public abstract TOut GetById(string id);
public abstract TOut GetById(IResolveFieldContext<object> context, string id);

public FieldType Id<TReturnType>(Expression<Func<T, TReturnType>> expression)
{
Expand Down Expand Up @@ -131,7 +131,7 @@ public DefaultNodeGraphType(Func<string, TOut> getById)
_getById = getById;
}

public override TOut GetById(string id)
public override TOut GetById(IResolveFieldContext<object> context, string id)
{
return _getById(id);
}
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL.Relay/Types/QueryGraphType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private object ResolveObjectFromGlobalId(IResolveFieldContext<object> context)
var parts = Node.FromGlobalId(globalId);
var node = context.Schema.AllTypes[parts.Type] as IRelayNode<object>;

return node.GetById(parts.Id);
return node.GetById(context, parts.Id);
}
}
}