Skip to content

Commit

Permalink
Adding duration scalar conforming to ISO8601 standard (#2800)
Browse files Browse the repository at this point in the history
* Adding duration scalar

* simple Duration scalar docs

* using MarshalString, to add proper double quotes

* adding deps and running go mod tidy on _examples

* Re-organize imports

Signed-off-by: Steve Coffman <[email protected]>

* Fix test now that imports are sorted

Signed-off-by: Steve Coffman <[email protected]>

---------

Signed-off-by: Steve Coffman <[email protected]>
Co-authored-by: Steve Coffman <[email protected]>
  • Loading branch information
rwrz and StevenACoffman authored Oct 3, 2023
1 parent 37f8e4e commit 5925864
Show file tree
Hide file tree
Showing 145 changed files with 385 additions and 200 deletions.
5 changes: 3 additions & 2 deletions _examples/chat/chat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"sync"
"testing"

"github.com/99designs/gqlgen/client"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/client"
"github.com/99designs/gqlgen/graphql/handler"
)

func TestChatSubscriptions(t *testing.T) {
Expand Down
8 changes: 3 additions & 5 deletions _examples/chat/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import (
"net/url"
"time"

"github.com/99designs/gqlgen/graphql/handler/extension"
"github.com/99designs/gqlgen/graphql/handler/transport"

"github.com/99designs/gqlgen/graphql/playground"

"github.com/gorilla/websocket"
"github.com/opentracing/opentracing-go"
"github.com/rs/cors"
Expand All @@ -20,6 +15,9 @@ import (

"github.com/99designs/gqlgen/_examples/chat"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/handler/extension"
"github.com/99designs/gqlgen/graphql/handler/transport"
"github.com/99designs/gqlgen/graphql/playground"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion _examples/dataloader/dataloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package dataloader
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/client"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/introspection"
"github.com/stretchr/testify/require"
)

func TestTodo(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion _examples/embedding/subdir/embedding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package subdir
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/_examples/embedding/subdir/gendir"
"github.com/99designs/gqlgen/client"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/stretchr/testify/require"
)

func TestEmbeddingWorks(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion _examples/fileupload/fileupload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import (
"os"
"testing"

"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/_examples/fileupload/model"
gqlclient "github.com/99designs/gqlgen/client"
"github.com/99designs/gqlgen/graphql"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/handler/transport"
"github.com/stretchr/testify/require"
)

func TestFileUpload(t *testing.T) {
Expand Down
8 changes: 3 additions & 5 deletions _examples/fileupload/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ import (
"log"
"net/http"

"github.com/99designs/gqlgen/graphql/handler/extension"
"github.com/99designs/gqlgen/graphql/handler/transport"

"github.com/99designs/gqlgen/graphql/playground"

"github.com/99designs/gqlgen/_examples/fileupload"
"github.com/99designs/gqlgen/_examples/fileupload/model"
"github.com/99designs/gqlgen/graphql"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/handler/extension"
"github.com/99designs/gqlgen/graphql/handler/transport"
"github.com/99designs/gqlgen/graphql/playground"
)

func main() {
Expand Down
1 change: 1 addition & 0 deletions _examples/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sosodev/duration v1.1.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/tools v0.9.3 // indirect
Expand Down
2 changes: 2 additions & 0 deletions _examples/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06B
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU=
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
github.com/sosodev/duration v1.1.0 h1:kQcaiGbJaIsRqgQy7VGlZrVw1giWO+lDoX3MCPnpVO4=
github.com/sosodev/duration v1.1.0/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand Down
3 changes: 2 additions & 1 deletion _examples/scalars/scalar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/client"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/introspection"
"github.com/stretchr/testify/require"
)

type RawUser struct {
Expand Down
3 changes: 2 additions & 1 deletion _examples/selection/selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"fmt"
"time"

"github.com/99designs/gqlgen/graphql"
"github.com/vektah/gqlparser/v2/ast"

"github.com/99designs/gqlgen/graphql"
)

type Resolver struct{}
Expand Down
3 changes: 2 additions & 1 deletion _examples/selection/selection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package selection
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/client"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/stretchr/testify/require"
)

func TestSelection(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion _examples/starwars/resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"time"

"github.com/99designs/gqlgen/_examples/starwars/generated"

"github.com/99designs/gqlgen/_examples/starwars/models"
)

Expand Down
3 changes: 2 additions & 1 deletion _examples/starwars/starwars_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package starwars
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/_examples/starwars/generated"
"github.com/99designs/gqlgen/client"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/introspection"
"github.com/stretchr/testify/require"
)

func TestStarwars(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion _examples/todo/todo.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
"fmt"
"time"

"github.com/99designs/gqlgen/graphql"
"github.com/mitchellh/mapstructure"

"github.com/99designs/gqlgen/graphql"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion _examples/todo/todo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package todo
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/client"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/introspection"
"github.com/stretchr/testify/require"
)

func TestTodo(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions _examples/type-system-extension/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import (
"net/http"
"os"

"github.com/99designs/gqlgen/graphql/playground"

extension "github.com/99designs/gqlgen/_examples/type-system-extension"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/playground"
)

const defaultPort = "8080"
Expand Down
9 changes: 5 additions & 4 deletions _examples/websocket-initfunc/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import (
"os"
"time"

"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/handler/extension"
"github.com/99designs/gqlgen/graphql/handler/transport"
"github.com/99designs/gqlgen/graphql/playground"
"github.com/go-chi/chi"
"github.com/gorilla/websocket"
"github.com/gqlgen/_examples/websocket-initfunc/server/graph"
"github.com/rs/cors"

"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/handler/extension"
"github.com/99designs/gqlgen/graphql/handler/transport"
"github.com/99designs/gqlgen/graphql/playground"
)

func webSocketInit(ctx context.Context, initPayload transport.InitPayload) (context.Context, *transport.InitPayload, error) {
Expand Down
3 changes: 2 additions & 1 deletion api/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"path"
"testing"

"github.com/99designs/gqlgen/codegen/config"
"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/codegen/config"
)

func cleanup(workDir string) {
Expand Down
3 changes: 2 additions & 1 deletion api/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package api
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/codegen/config"
"github.com/99designs/gqlgen/plugin"
"github.com/99designs/gqlgen/plugin/federation"
"github.com/99designs/gqlgen/plugin/modelgen"
"github.com/99designs/gqlgen/plugin/resolvergen"
"github.com/stretchr/testify/require"
)

type testPlugin struct{}
Expand Down
3 changes: 2 additions & 1 deletion client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import (
"testing"
"time"

"github.com/99designs/gqlgen/client"
"github.com/mitchellh/mapstructure"
"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/client"
)

func TestClient(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion client/withfilesoption_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import (
"strings"
"testing"

"github.com/99designs/gqlgen/client"
"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/client"
)

func TestWithFiles(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion codegen/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"go/types"
"strings"

"github.com/vektah/gqlparser/v2/ast"

"github.com/99designs/gqlgen/codegen/config"
"github.com/99designs/gqlgen/codegen/templates"
"github.com/vektah/gqlparser/v2/ast"
)

type ArgSet struct {
Expand Down
4 changes: 2 additions & 2 deletions codegen/config/binder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"go/types"
"testing"

"github.com/99designs/gqlgen/internal/code"

"github.com/stretchr/testify/require"
"github.com/vektah/gqlparser/v2"
"github.com/vektah/gqlparser/v2/ast"

"github.com/99designs/gqlgen/internal/code"
)

func TestBindingToInvalid(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions codegen/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package codegen
import (
"testing"

"github.com/99designs/gqlgen/codegen/config"
"github.com/stretchr/testify/assert"
"github.com/vektah/gqlparser/v2/ast"

"github.com/stretchr/testify/assert"
"github.com/99designs/gqlgen/codegen/config"
)

func TestData_Directives(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion codegen/directive.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"strconv"
"strings"

"github.com/99designs/gqlgen/codegen/templates"
"github.com/vektah/gqlparser/v2/ast"

"github.com/99designs/gqlgen/codegen/templates"
)

type DirectiveList map[string]*Directive
Expand Down
5 changes: 3 additions & 2 deletions codegen/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (
"strconv"
"strings"

"github.com/99designs/gqlgen/codegen/config"
"github.com/99designs/gqlgen/codegen/templates"
"github.com/vektah/gqlparser/v2/ast"
"golang.org/x/text/cases"
"golang.org/x/text/language"

"github.com/99designs/gqlgen/codegen/config"
"github.com/99designs/gqlgen/codegen/templates"
)

type Field struct {
Expand Down
3 changes: 2 additions & 1 deletion codegen/field_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
"go/types"
"testing"

"github.com/99designs/gqlgen/codegen/config"
"github.com/stretchr/testify/require"
ast2 "github.com/vektah/gqlparser/v2/ast"

"github.com/99designs/gqlgen/codegen/config"
)

func TestFindField(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion codegen/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
"runtime"
"strings"

"github.com/vektah/gqlparser/v2/ast"

"github.com/99designs/gqlgen/codegen/config"
"github.com/99designs/gqlgen/codegen/templates"
"github.com/vektah/gqlparser/v2/ast"
)

//go:embed *.gotpl
Expand Down
3 changes: 2 additions & 1 deletion codegen/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"strings"
"unicode"

"github.com/99designs/gqlgen/codegen/config"
"github.com/vektah/gqlparser/v2/ast"
"golang.org/x/text/cases"
"golang.org/x/text/language"

"github.com/99designs/gqlgen/codegen/config"
)

type GoFieldType int
Expand Down
4 changes: 2 additions & 2 deletions codegen/templates/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
"testing"

"github.com/99designs/gqlgen/internal/code"

"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/internal/code"
)

func TestImports(t *testing.T) {
Expand Down
Loading

0 comments on commit 5925864

Please sign in to comment.