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

schema add command to support multiple files #1248

Closed
orpheuslummis opened this issue Mar 29, 2023 · 1 comment · Fixed by #3352
Closed

schema add command to support multiple files #1248

orpheuslummis opened this issue Mar 29, 2023 · 1 comment · Fixed by #3352
Assignees
Labels
area/cli Related to the CLI binary
Milestone

Comments

@orpheuslummis
Copy link
Contributor

Status quo: only the last file added via -f is considered

@orpheuslummis orpheuslummis added the area/cli Related to the CLI binary label Mar 29, 2023
@orpheuslummis
Copy link
Contributor Author

example test code

func TestAddSchemaWithMultipleFiles(t *testing.T) {
	conf := NewDefraNodeDefaultConfig(t)
	stopDefra := runDefraNode(t, conf)

	fname1 := schemaFileFixture(t, "schema1.graphql", `type Post { id: ID title: String }`)
	fname2 := schemaFileFixture(t, "schema2.graphql", `type User { id: ID name: String }`)

	stdout, _ := runDefraCommand(t, conf, []string{"client", "schema", "add", "-f", fname1, "-f", fname2})

	nodeLog := stopDefra()

	assertContainsSubstring(t, stdout, `{"data":{"result":"success"}}`)
	assertNotContainsSubstring(t, nodeLog, "ERROR")

	stdout, _ = runDefraCommand(t, conf, []string{"client", "query",
		`query IntrospectionQuery { __schema { types { name } } }`})
	assertContainsSubstring(t, stdout, `{"name":"Post"}`)
	assertContainsSubstring(t, stdout, `{"name":"User"}`)
}
*/

/* disabled because current implementation doesn't support this currently
func TestAddSchemaWithMultipleFilesWithIntertwinedSchemas(t *testing.T) {
	conf := NewDefraNodeDefaultConfig(t)
	stopDefra := runDefraNode(t, conf)

	fname1 := schemaFileFixture(t, "schema1.graphql", `type Post { id: ID title: String }`)
	fname2 := schemaFileFixture(t, "schema2.graphql", `type User { id: ID posts: [Post] }`)

	stdout, _ := runDefraCommand(t, conf, []string{"client", "schema", "add", "-f", fname1, "-f", fname2})

	nodeLog := stopDefra()

	assertContainsSubstring(t, stdout, `{"data":{"result":"success"}}`)
	assertNotContainsSubstring(t, nodeLog, "ERROR")

	stdout, _ = runDefraCommand(t, conf, []string{"client", "query",
		`query IntrospectionQuery { __schema { types { name } } }`})
	assertContainsSubstring(t, stdout, `{"name":"Post"}`)
	assertContainsSubstring(t, stdout, `{"name":"User"}`)
}
*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Related to the CLI binary
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants