extend schema
@link(
url: "https://specs.apollo.dev/connect/v0.4"
import: ["@connect"]
)
type Query {
dollar: String
@connect(
http: {
POST: "http://127.0.0.1",
body: "$" # INVALID - there is no input
}
selection: "$"
)
dollarField: String
@connect(
http: {
POST: "http://127.0.0.1",
body: "$.foo" # INVALID - there is no input
}
selection: "$"
)
objectLiteral: String
@connect(
http: {
POST: "http://127.0.0.1",
body: "{ userid: 'foo' }" # VALID - v0.4 drops $(...) around a bare SubSelection body
}
selection: "$"
)
objectLiteralWithVariable(userid: ID!): String
@connect(
http: {
POST: "http://127.0.0.1",
body: "{ userid: $args.userid }" # VALID - v0.4 drops $(...) around a bare SubSelection body
}
selection: "$"
)
objectLiteralStillWrappable: String
@connect(
http: {
POST: "http://127.0.0.1",
body: "$({ userid: 'foo' })" # VALID - explicit $(...) wrapping still parses in v0.4
}
selection: "$"
)
objectLiteralWithArrowMethod(userid: ID!): String
@connect(
http: {
POST: "http://127.0.0.1",
# A method chain on a top-level object literal requires the $(...)
# wrapper in v0.4 too, because `{...}` at the top level is a
# SubSelection (not a LitExpr), so it cannot grow a `->method` tail.
body: "$({ userid: $args.userid })->no_such_method" # INVALID - no such method
}
selection: "$"
)
invalidVariable(userid: ID!): String
@connect(
http: {
POST: "http://127.0.0.1",
body: "{ userid: $nosuchvariable }" # INVALID - no such variable (v0.4 naked form)
}
selection: "$"
)
}