Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package update #17

Merged
merged 148 commits into from
May 15, 2023
Merged

Package update #17

merged 148 commits into from
May 15, 2023

Conversation

mittalaa
Copy link

@mittalaa mittalaa commented Aug 1, 2022

Last Sync-Up occurred on Sep 4, 2019. This PR is for syncing up with latest(Aug 1, 2022).
Changes

Pulled Latest Commit from graphql-go master. (Support for extensions was update)

In this PR we readded the custom change lost due to update like int64 support.

Note: We are trying to merge this PR into master since we are planning to use the latest features offered by graphql-go.
New Features and bug fixes introduces since last syncup: https://github.com/graph-gophers/graphql-go/releases

eloyekunle and others added 30 commits June 25, 2019 14:19
Support for embedded struct type in resolver
Adding example and documentation for how to create custom error
 implementations which include `extensions` within their `error` payload
Producing clearer error messages when field input arguments are
 implemented by code:

 * Which does not match the schema e.g. missing field; or
 * Function missing struct wrapper for field arguments
…input-resolver-mismatch-with-schema

Clarify errors for mismatching input implementation
…ntrypoints-without-explicit-schema

Allow `schema` to be omitted when using default root op names
Fix graph-gophers#357 - Allow passing integers as arguments to graphql.Time parameters
Multi-line descriptions need to have their common indentation level
 (which results from indentation of that part of the schema, rather than
 being intentional for the description text) removed to ensure the
 descriptions use the correct value, are formatted correctly etc

This is to meet the condition documented in the GraphQL spec:

https://graphql.github.io/graphql-spec/June2018/#sec-String-Value

> Since block strings represent freeform text often used in indented
>  positions, the string value semantics of a block string excludes
>  uniform indentation and blank initial and trailing lines via
>  BlockStringValue().
…tation-from-blockstring-descriptions

Strip Common Indentation from BlockString Descriptions
Syntax highlighting fixed in README
Fixed small punctuation and added my walkthrough package
Path []interface{} `json:"path,omitempty"`
Rule string `json:"-"`
ResolverError error `json:"-"`
Extensions map[string]interface{} `json:"extensions"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated Extensions type from a struct to a map

Message: fmt.Sprintf(format, a...),
Err: err,
Message: fmt.Sprintf(format, a...),
Extensions: make(map[string]interface{}),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialising Extension fields while returning a QueryError to avoid assignment to entry in nil map error

}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated code syntax as Extensions is update from a struct type to a map type field.

for _, loc := range err.Locations {
str += fmt.Sprintf(" (line %d, column %d)", loc.Line, loc.Column)
}
return str
}

func (err *QueryError) Unwrap() error {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unwarp() returns any underlying error if available.

maxParallelism: 10,
tracer: noop.Tracer{},
logger: &log.DefaultLogger{},
panicHandler: &errors.DefaultPanicHandler{},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initialising panicHandler to create custom panic errors that occur during query execution

maxParallelism: 10,
tracer: noop.Tracer{},
logger: &log.DefaultLogger{},
panicHandler: &errors.DefaultPanicHandler{},
}
for _, opt := range opts {
opt(s)
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add context to validation tracing

1a55b96

24abfa5

panicHandler errors.PanicHandler
useStringDescriptions bool
disableIntrospection bool
subscribeResolverTimeout time.Duration

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added possibility to customize subscription resolver timeout value
d77614a

return &Response{Errors: []*errors.QueryError{&errors.QueryError{Message: "graphql-ws protocol header is missing"}}}
return &Response{Errors: []*errors.QueryError{{Message: "graphql-ws protocol header is missing"}}}
}
if op.Type == query.Mutation {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow schema to be omitted when using default root op names 6c0f0e3

var err error
t.Time, err = time.Parse(time.RFC3339, string(input))
return err
case int32:
t.Time = time.Unix(int64(input), 0)
return nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

graphql.Time unmarshal unix nano time

@@ -31,14 +31,27 @@ func (t *Time) UnmarshalGraphQL(input interface{}) error {
var err error
t.Time, err = time.Parse(time.RFC3339, input)
return err
case int:
case []byte:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expose packer.Unmarshaler interface as graphql.Unmarshaler 04aa634

@@ -0,0 +1,44 @@
package types

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add types package bf0a0cc

| ------- | ------------------ |
| 1.x | :white_check_mark: |
| < 1.0 | :x: |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes were synced to this commit graph-gophers@64f8084 committed on Jul 20 2022 and the latest stable version is v1.4.0 which was released on April 11 2022 so this syncup with graphq-gophers/graphql-go is free of MaxDepth security vulnerability as this vulnerability is detected in versions <v1.3.0

GHSA-mh3m-8c74-74xh

@@ -0,0 +1,407 @@
#!/bin/sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semaphore CI script

@@ -0,0 +1,166 @@
package graphql

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added Support for nullable types fced4f6

Limiter: make(chan struct{}, s.maxParallelism),
Tracer: s.tracer,
Logger: s.logger,
PanicHandler: s.panicHandler,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added option for custom panichandler

Tracer: s.tracer,
Logger: s.logger,
PanicHandler: s.panicHandler,
SubscribeResolverTimeout: s.subscribeResolverTimeout,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added possibility to customise subscription resolver timeout value

@@ -0,0 +1,24 @@
// Package noop defines a no-op tracer implementation.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor Trace Package 24abfa5

@@ -0,0 +1,35 @@
# Apollo Federation
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apollo Federation Spec: Fetch service capabilities
https://github.com/graph-gophers/graphql-go/pull/507/files

With these changes, we can use graphql-go as subgraph behind Apollo Federation Gateway even though it's still not fully implements the specification, but at least it's one step closer

@@ -27,9 +27,13 @@ const Schema = `
role: Role!
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use struct fields as resolvers instead of methods example

@Umanish Umanish merged commit 6fb9e53 into master May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet