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

Type extensions objects can be empty #1228

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- Bug Fix: [Object type extensions may be empty](https://github.com/absinthe-graphql/absinthe/pull/1228)

## 1.7.1
- Breaking Bugfix: [Validate repeatable directives on schemas](https://github.com/absinthe-graphql/absinthe/pull/1179)
- Breaking Bugfix: [Add "Objects must define fields" schema validation](https://github.com/absinthe-graphql/absinthe/pull/1167)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ defmodule Absinthe.Phase.Schema.Validation.ObjectMustDefineFields do
obj
end

defp validate_objects(%Blueprint.Schema.TypeExtensionDefinition{} = node) do
{:halt, node}
end

defp validate_objects(%struct{} = node)
when struct in [
Blueprint.Schema.ObjectTypeDefinition,
Expand Down
20 changes: 20 additions & 0 deletions test/absinthe/schema/rule/object_must_define_fields_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,24 @@ defmodule Absinthe.Schema.Rule.ObjectMustDefineFieldsTest do
Code.eval_string(@schema)
end)
end

@schema ~S(
defmodule ExtendObjectSchema do
use Absinthe.Schema

query do
field :foo, :string
end

object :bar do
field :baz, :string
end

extend object :bar do
end
end
)
test "does not error on empty object extension" do
assert Code.eval_string(@schema)
end
end