mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-23 18:01:47 +01:00
GraphQL - custom scalar support (#1012)
* x * CustomScalars * more tests * . * add or set * ... * x
This commit is contained in:
@@ -43,6 +43,9 @@ namespace WireMock.Net.ConsoleApplication
|
||||
public static class MainApp
|
||||
{
|
||||
private const string TestSchema = @"
|
||||
scalar DateTime
|
||||
scalar MyCustomScalar
|
||||
|
||||
input MessageInput {
|
||||
content: String
|
||||
author: String
|
||||
@@ -56,6 +59,7 @@ namespace WireMock.Net.ConsoleApplication
|
||||
|
||||
type Mutation {
|
||||
createMessage(input: MessageInput): Message
|
||||
createAnotherMessage(x: MyCustomScalar, dt: DateTime): Message
|
||||
updateMessage(id: ID!, input: MessageInput): Message
|
||||
}
|
||||
|
||||
@@ -168,11 +172,12 @@ namespace WireMock.Net.ConsoleApplication
|
||||
|
||||
// server.AllowPartialMapping();
|
||||
#if GRAPHQL
|
||||
var customScalars = new Dictionary<string, Type> { { "MyCustomScalar", typeof(int) } };
|
||||
server
|
||||
.Given(Request.Create()
|
||||
.WithPath("/graphql")
|
||||
.UsingPost()
|
||||
.WithGraphQLSchema(TestSchema)
|
||||
.WithGraphQLSchema(TestSchema, customScalars)
|
||||
)
|
||||
.RespondWith(Response.Create()
|
||||
.WithBody("GraphQL is ok")
|
||||
|
||||
Reference in New Issue
Block a user