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

Warn on invalid wrapped arguments #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
d9e8017
Add documentation for batch/item syntax in dataloader
cheerfulstoic May 2, 2021
1dd89ce
Document Absinthe.Schema.Notation.import_sdl/1
Cantido Sep 17, 2021
9cf9cf8
Update typespec for resolver_t
sega-yarkin Nov 2, 2021
5bd9587
Remove unused Absinthe.Phase.Validation module
maartenvanvliet Jan 19, 2022
94762dc
Remove unused Absinthe.Phase.Schema.Validation module
maartenvanvliet Jan 19, 2022
648c4bf
Remove unused Type.Fetch module
maartenvanvliet Jan 19, 2022
5ca9fff
Remove unused Absinthe.Type.BuiltIns.Scalars.Utils macro module
maartenvanvliet Jan 19, 2022
449d5e0
Add example of enum usage with field, per Slack discussion
pdgonzalez872 Jan 22, 2022
0482fe3
Test on otp 25
maartenvanvliet Aug 26, 2022
f64dd38
Fix SDL type definition rendering order
maartenvanvliet Sep 14, 2022
89fa88a
Remove Elixir 1.10 support
maartenvanvliet Sep 14, 2022
bdf96dc
Ensure an object has unique fields
maartenvanvliet Oct 3, 2022
b3b899d
Update changelog
maartenvanvliet Oct 3, 2022
85c5138
fix broken links
tofran Oct 9, 2022
e4d83b6
upgraded http links to https
tofran Oct 9, 2022
c652ae8
fix doc: removed double spaces
tofran Oct 10, 2022
d5af258
upgrade timex documentation to use the new syntax
tofran Oct 10, 2022
6975b45
removed duplicate module from documentation index
tofran Oct 10, 2022
70bd17d
Allow `Registry` compression to be configured by users
c-brenn Oct 13, 2022
f617cf4
Improve Absinthe.Type.Scalar documentation
tofran Oct 18, 2022
982dbfb
Merge pull request #1202 from tofran/fix/broken-links-and-doc-improve…
benwilson512 Oct 18, 2022
c83152c
Fix const parsing of empty lists
maartenvanvliet Nov 8, 2022
d456298
Fix bookkeeping of Resolution path when resolving
marcinkoziej Nov 16, 2022
161ed3c
fix Our First Query screenshot
millllllz Nov 17, 2022
ac9548a
Fix formatting with mix format
marcinkoziej Nov 17, 2022
703c23f
Add test for issue #1149
marcinkoziej Nov 17, 2022
0f20ed9
Enforce a configurable limit on tokens in a GraphQL document to prote…
Nov 23, 2022
918a4ea
Set the default token limit to 15_000, matching graphql-java's implem…
Nov 23, 2022
9e5c5ae
Include token limits in the documentation
Nov 23, 2022
75612b5
Fix limit typo in docs
Nov 23, 2022
0a32426
Avoid these options being passed through as a map
Nov 24, 2022
4824b6d
Tweak docs
Nov 24, 2022
2b6e7ea
Merge pull request #1209 from JasonMiller/patch-1
benwilson512 Nov 28, 2022
81622a3
Merge pull request #1205 from maartenvanvliet/fix-const-parsing-empty…
benwilson512 Nov 28, 2022
759c938
Merge pull request #1200 from maartenvanvliet/improve_unique_field_va…
benwilson512 Nov 28, 2022
972d7c8
Merge pull request #1208 from marcinkoziej/fix/1149
benwilson512 Nov 28, 2022
92f5960
Fix typo with quotes
maartenvanvliet Sep 7, 2022
9c269dc
Bring default_name in line with other usages
maartenvanvliet Sep 7, 2022
e0bd25a
Add specifiedBy type system directive as per spec
maartenvanvliet Sep 7, 2022
a917e3d
Pass directive names through language adapter
maartenvanvliet Sep 7, 2022
f9501eb
Test for specifiedBy presence in introspection
maartenvanvliet Sep 7, 2022
9b0cb1c
Update changelog
maartenvanvliet Sep 7, 2022
d4a7d9c
Fix typos in docs
stellanor Nov 30, 2022
58805fa
mix format
Nov 30, 2022
a6f523c
Merge branch 'token-limit' of github.com:stellanor/absinthe into toke…
Nov 30, 2022
f40f68d
fixup! Allow `Registry` compression to be configured by users
c-brenn Dec 1, 2022
d564d82
Merge pull request #1201 from c-brenn/feature/allow-compression-to-be…
benwilson512 Dec 1, 2022
c8d6642
Implement the token enforcement using a short-circuiting approach in …
Dec 3, 2022
594f4f3
I may be wrong but it seems to me like shouldn't be here since it's in
Dec 3, 2022
0ff0fcd
Pass resolution to dataloader callback
antonsatin Dec 4, 2022
2e42948
Merge pull request #1211 from antonsatin/feature/support-resolution-i…
benwilson512 Dec 4, 2022
6aa233b
changelog update
benwilson512 Dec 4, 2022
f3cec5a
update to setup-beam for ci
benwilson512 Dec 4, 2022
8b13357
try an older ubuntu for broader OTP support
benwilson512 Dec 4, 2022
7aa8ec7
Merge pull request #1212 from absinthe-graphql/fix-ci
benwilson512 Dec 5, 2022
4a59847
allow changing result phase for subscriptions
MortadaAK Dec 6, 2022
46675ec
Merge branch 'master' of https://github.com/absinthe-graphql/absinthe…
Dec 6, 2022
32db847
Place extra errors in extensions field
maartenvanvliet Dec 20, 2022
148d9ff
Update introspection.md
pavelloz Dec 20, 2022
16cbc8d
Merge pull request #1216 from pavelloz/patch-1
benwilson512 Dec 20, 2022
0995e43
it works
Dec 28, 2022
8a591af
comment out inspects
Dec 28, 2022
b4c35ef
one more to comment out
Dec 28, 2022
1bbe533
perf test
Dec 29, 2022
aa37b10
Add some code comments for the review process
Dec 29, 2022
571d537
Comments and notes from review
Dec 29, 2022
b7baf0e
Refactor for clarity
Dec 30, 2022
2b58b83
More refactoring for clarity
Dec 30, 2022
730c84c
Refactor slightly per code review feedback. Also optimized result acc…
Jan 4, 2023
2d0a0c0
formalize test
Jan 5, 2023
f3d954f
Comment new lexer perf test
Jan 5, 2023
d6fc14a
small stylistic tweak to be symmetrical with the nearby function head
Jan 5, 2023
c1a8377
Add pipeline modifier option to Absinthe.run
bernardd Jan 12, 2023
082025d
Use Enum.map_reduce, it's a little cleaner
Jan 12, 2023
3c3e5ea
Fix a bug the compiler caught
Jan 23, 2023
22fa9e9
In light of PR #1220, the default limit should now be infinity
Jan 23, 2023
a7d6ba3
Merge branch 'master' of https://github.com/absinthe-graphql/absinthe…
Jan 23, 2023
9576687
Propagate errors if a non-null list of non-null elements contains a null
jueberschlag Jan 24, 2023
5308d4a
Merge pull request #1220 from stellanor/stellanor-PR-optimize-lexer-c…
benwilson512 Feb 1, 2023
b6e9d28
Merge pull request #1221 from circles-learning-labs/run_pipeline_config
benwilson512 Feb 1, 2023
9864094
bump to 1.7.1
benwilson512 Feb 1, 2023
1562385
Update CHANGELOG.md
benwilson512 Feb 7, 2023
c84b8ad
Support propagating OTel context
rewritten Feb 8, 2023
57a87c2
Type extensions objects can be empty
maartenvanvliet Feb 10, 2023
7665edc
Update changelog
maartenvanvliet Feb 10, 2023
8d571bf
Merge pull request #1228 from maartenvanvliet/type-extensions-objects…
benwilson512 Feb 10, 2023
e0faf8c
Validate input object not being an Enum
rewritten Feb 17, 2023
f47cc7f
Merge pull request #1231 from rewritten/validate-input-object
benwilson512 Feb 17, 2023
7a67862
changelog notee
benwilson512 Feb 17, 2023
1f836b6
Missing bug fix from CHANGELOG
cheerfulstoic Feb 22, 2023
c13309b
Merge pull request #1232 from cheerfulstoic/patch-1
benwilson512 Feb 22, 2023
2777667
Merge branch 'master' of https://github.com/absinthe-graphql/absinthe…
Feb 27, 2023
206fd6f
Update test to account for default of :infinity
Feb 27, 2023
7eec586
Merge pull request #1210 from stellanor/token-limit
benwilson512 Feb 28, 2023
26e7f5e
Merge branch 'master' into otp-25
benwilson512 Mar 12, 2023
0069428
Merge pull request #1147 from pdgonzalez872/pg-add-example-01
benwilson512 Mar 20, 2023
6fd79f3
Fix endpoint and docket setup documentation for subscriptions
JoseMPena Mar 22, 2023
c6029c9
Merge pull request #1235 from JoseMPena/docfix
benwilson512 Mar 22, 2023
acf836c
add previous walk_results/6 as catch all for resolution without path
tfiedlerdejanze Mar 28, 2023
4f814d1
upgrade to newer ubuntu
benwilson512 Mar 28, 2023
96fd1dd
ci: run on ubuntu-20.04
tfiedlerdejanze Mar 28, 2023
53f9eae
Merge branch 'master' into patch-2
tfiedlerdejanze Mar 28, 2023
efece25
Merge pull request #1237 from ucwaldo/patch-2
benwilson512 Mar 28, 2023
632719e
Merge pull request #1227 from rewritten/pluggable-task-module
benwilson512 Mar 28, 2023
5d4ef4c
Merge pull request #1223 from jueberschlag/propagate-errors-on-non-nu…
benwilson512 Mar 28, 2023
c889901
Merge remote-tracking branch 'upstream/master' into patch-1
tfiedlerdejanze Mar 28, 2023
b425deb
Fix Absinthe.Subscription parameter in Subscriptions guide
mbuffa Mar 29, 2023
628ea46
Do the same for the tutorial
mbuffa Mar 29, 2023
46da214
Allow maps as arguments in macros
kzlsakal Feb 3, 2023
b326789
Handle quoted map argument handling in Notation instead of Input
kzlsakal Mar 30, 2023
c982582
Deduplicate directives when building schema
MaeIsBad Apr 13, 2023
520b130
Update CHANGELOG.md
MaeIsBad Apr 13, 2023
17f78c9
Revert "Deduplicate directives when building schema"
MaeIsBad Apr 13, 2023
92ae352
Don't import default directives into the prototype schema
MaeIsBad Apr 13, 2023
611ac79
Merge pull request #1236 from ucwaldo/patch-1
benwilson512 May 10, 2023
a7d1a6a
Merge pull request #1238 from mbuffa/chore/documentation-fix-absinthe…
benwilson512 May 13, 2023
1414fe1
Merge pull request #1226 from kzlsakal/kzlsakal/maps-as-macro-arguments
benwilson512 May 13, 2023
d82bd65
Merge pull request #1067 from cheerfulstoic/1066/documentation_for_da…
benwilson512 May 13, 2023
f8c31fd
Merge pull request #1102 from Cantido/add-docs-to-import-sdl
benwilson512 May 13, 2023
e2f02d6
Merge pull request #1116 from sega-yarkin/update-resolver-typespec
benwilson512 May 13, 2023
be22a3a
Merge pull request #1144 from maartenvanvliet/cleanup
benwilson512 May 13, 2023
9e2398d
typo fix
benwilson512 May 13, 2023
086393b
Merge pull request #1242 from MaeIsBad/deduplicate_directives
benwilson512 May 13, 2023
8b004d2
Merge branch 'master' into issues/918
benwilson512 May 13, 2023
d25f16d
Merge pull request #1193 from maartenvanvliet/issues/918
benwilson512 May 13, 2023
c6d94b0
cleanup some warnings
benwilson512 May 14, 2023
d5d2a0c
Merge pull request #1213 from MortadaAK/feature/allow-changing-result…
benwilson512 May 14, 2023
05ca9f2
typo fix
benwilson512 May 14, 2023
11b56c3
Do not unquote AST twice
josevalim May 17, 2023
002211f
Merge pull request #1244 from josevalim/patch-1
benwilson512 May 17, 2023
665a9ec
Add arg into resolver doc
hmy3743 Jun 7, 2023
8e96972
Merge pull request #1246 from hmy3743/master
benwilson512 Jun 7, 2023
c49f2ed
Add dialyxir to CI (and stop analysing dependencies)
paulo-ferraz-oliveira Jun 16, 2023
aed31be
Bump mix_test_watch to prevent compilation warnings
paulo-ferraz-oliveira Jun 16, 2023
6795e8a
Bump benchee to prevent compilation warnings
paulo-ferraz-oliveira Jun 16, 2023
8ecf60b
Update spec to prevent consumer errors on Dialyzer'ing
paulo-ferraz-oliveira Jun 16, 2023
dde9909
Fix all Dialyzer -issued warnings
paulo-ferraz-oliveira Jun 16, 2023
e236f96
Tweak config. as per recent dialyxir documentation
paulo-ferraz-oliveira Jun 16, 2023
8f737bf
Act on CI result
paulo-ferraz-oliveira Jun 16, 2023
3c2c1f9
Bump ex_doc to prevent compilation warnings
paulo-ferraz-oliveira Jun 18, 2023
82118c8
add map new to de-duplicate multiple entries to the same doc
beligante Jun 18, 2023
fab6ac9
Merge pull request #1248 from paulo-ferraz-oliveira/feature/dialyxir-…
benwilson512 Jun 19, 2023
555aeb8
Merge pull request #1215 from maartenvanvliet/issues/925-error-extens…
benwilson512 Jun 29, 2023
8d51f81
1.7.2
benwilson512 Jun 29, 2023
6a2954d
changelog update
benwilson512 Jun 29, 2023
6a04af9
Merge pull request #1197 from maartenvanvliet/otp-25
benwilson512 Jun 29, 2023
d0659a3
Merge branch 'master' into otp-25
benwilson512 Jun 29, 2023
3e3d4e6
Merge pull request #1252 from absinthe-graphql/otp-25
benwilson512 Jun 29, 2023
a9be40b
fix map sorting bugs
benwilson512 Jun 29, 2023
72b09fb
OTP 26 and Elixir 15 support
benwilson512 Jun 29, 2023
4d7449e
mix format
benwilson512 Jun 29, 2023
3e476d3
only do OTP 26 on Elixir 1.15
benwilson512 Jun 29, 2023
52c7e16
remove dialyxer from the CI for now
benwilson512 Jun 29, 2023
bc8a1c5
Merge pull request #1253 from absinthe-graphql/otp-26
benwilson512 Jun 29, 2023
ddd2a31
version bump
benwilson512 Jun 29, 2023
7d75be7
remove warning
benwilson512 Jun 29, 2023
2ee47cd
dedup documents before unpacking processing
beligante Jun 29, 2023
97ea4dc
refact: use map.new to save some traversals
beligante Jun 29, 2023
66c21a1
Adapt to 1.15's code path pruning, for dialyxir'ing purposes
paulo-ferraz-oliveira Jun 30, 2023
2a84558
Merge pull request #1255 from paulo-ferraz-oliveira/fix/dialyzer-in-c…
benwilson512 Jun 30, 2023
301ab7a
try a cache prefix
benwilson512 Jun 30, 2023
86e6c80
Merge pull request #1249 from beligante/fix-multiple-pushes-to-same-c…
benwilson512 Jun 30, 2023
bf80f04
changelog
benwilson512 Jun 30, 2023
196814b
Merge pull request #1254 from absinthe-graphql/re-enable-dialyzer-ci
benwilson512 Jun 30, 2023
3c102f0
v1.7.4
benwilson512 Jul 7, 2023
fa9c8b6
support dataloader 2.0
benwilson512 Jul 24, 2023
0f3cdb0
fix null propagation with non_null(list_of(non_null(type)))
benwilson512 Jul 14, 2020
4259e16
fix(phase/variable_types_match): soft fail with Logger.warn
jakerobers Sep 28, 2022
6837b46
Warn on invalid wrapped arguments
Nov 17, 2023
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
6 changes: 5 additions & 1 deletion .dialyzer_ignore.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[
{":0:unknown_function Function :persistent_term.get/1 does not exist."},
{":0:unknown_function Function :persistent_term.put/2 does not exist."}
{":0:unknown_function Function :persistent_term.put/2 does not exist."},
{"lib/absinthe/middleware/async.ex", :unknown_function, 117},
{"lib/absinthe/middleware/batch.ex", :unknown_function, 213},
{"lib/absinthe/utils/render.ex", :improper_list_constr, 51},
{":0:unknown_function Function OpentelemetryProcessPropagator.Task.async/1 does not exist."}
]
39 changes: 27 additions & 12 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,34 @@ on:
jobs:
test:
name: Elixir ${{matrix.elixir}} / OTP ${{matrix.otp}}
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

strategy:
matrix:
elixir:
- "1.10"
- "1.11"
- "1.12"
- "1.13"
- "1.14"
- "1.15"
otp:
- "22"
- "23"
- "24"
exclude:
- elixir: "1.10"
otp: "24"
- "25"
- "26"
include:
- elixir: "1.13"
otp: "24"
- elixir: "1.15"
otp: "26"
format: true
exclude:
- otp: 26
elixir: 1.13
- otp: 26
elixir: 1.14

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Elixir
uses: erlef/setup-elixir@v1
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
Expand Down Expand Up @@ -69,3 +70,17 @@ jobs:
mix test
env:
SCHEMA_PROVIDER: persistent_term

- name: Cache/uncache PLTs
uses: actions/cache@v3
with:
path: |
priv/plts
key: "v1-${{ runner.os }}-\
erlang-${{ matrix.otp }}-\
elixir-${{ matrix.elixir }}-\
${{ hashFiles('mix.lock') }}"

- name: Run Dialyzer
run: mix dialyzer

34 changes: 32 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,47 @@
# Changelog

## Unreleased
## 1.7.4

- Feature: Support Dataloader 2.0

## 1.7.4

- Bug Fix: [Bugfix: multiple pushes per client for subscriptions that have a context_id](https://github.com/absinthe-graphql/absinthe/pull/1249)

## 1.7.3

- Bug Fix: [OTP 26 and Elixir 1.15 tweaks](https://github.com/absinthe-graphql/absinthe/pull/1253)
- Bug Fix: [OTP 25 tweaks](https://github.com/absinthe-graphql/absinthe/pull/1253)
- Bug Fix: [Place extra error attributes in error extensions field](https://github.com/absinthe-graphql/absinthe/pull/1215)

## 1.7.2

- Bug Fix: [Validate type references for invalid wrapped types](https://github.com/absinthe-graphql/absinthe/pull/1195)
- Feature: [Add `specifiedBy` type system directive](https://github.com/absinthe-graphql/absinthe/pull/1193)
- Bug Fix: [Object type extensions may be empty](https://github.com/absinthe-graphql/absinthe/pull/1228)
- Bug Fix: [Validate input object not being an Enum](https://github.com/absinthe-graphql/absinthe/pull/1231)
- Bug Fix: [Deduplicate directives when building schema](https://github.com/absinthe-graphql/absinthe/pull/1242)

## 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)
- Bug Fix: [Validate field identifier uniqueness](https://github.com/absinthe-graphql/absinthe/pull/1200)
- Bug Fix: [Validate type references for invalid wrapped types](https://github.com/absinthe-graphql/absinthe/pull/1195)
- Bug Fix: Adds **optional fix** for non compliant built-in scalar Int type. `use Absinthe.Schema, use_spec_compliant_int_scalar: true` in your schema to use the fixed Int type. It is also advisable to upgrade for custom types if you are leveraging the use of integers outside the GraphQl standard. [#1131](https://github.com/absinthe-graphql/absinthe/pull/1131).
- Feature: [Support error tuples when scalar parsing fails](https://github.com/absinthe-graphql/absinthe/pull/1187)
- Feature: [Convert SDL Language.\* structs to SDL notation](https://github.com/absinthe-graphql/absinthe/pull/1160)
- Feature: [Support passing the resolution struct to dataloader helper callbacks](https://github.com/absinthe-graphql/absinthe/pull/1211)
- Feature: [Add support for type extensions](https://github.com/absinthe-graphql/absinthe/pull/1157)
- Bug Fix: [Add type system directives to introspection results](https://github.com/absinthe-graphql/absinthe/pull/1189)
- Bug Fix: [Add `__private__` field to EnumValueDefinition](https://github.com/absinthe-graphql/absinthe/pull/1148)
- Bug Fix: [Fix bug in Schema.**absinthe_types**(:all) for Persistent Term](https://github.com/absinthe-graphql/absinthe/pull/1161)
- Bug Fix: [Fix default enum value check for SDL schema's](https://github.com/absinthe-graphql/absinthe/pull/1188)
- Bug Fix: [Add "Objects must define fields" schema validation](https://github.com/absinthe-graphql/absinthe/pull/1167)
- Feature: [Add `import_directives` macro](https://github.com/absinthe-graphql/absinthe/pull/1158)
- Feature: [Support type extensions on schema declarations](https://github.com/absinthe-graphql/absinthe/pull/1176)
- Bug Fix: [Root objects are marked as referenced correctly](https://github.com/absinthe-graphql/absinthe/pull/1186)
- Bug Fix: [Prevent DDOS attacks with long queries](https://github.com/absinthe-graphql/absinthe/pull/1220)
- Feature: [pipeline_modifier option to Absinthe.run/3](https://github.com/absinthe-graphql/absinthe/pull/1221)
- Bug Fix: [Add end_time_mono to telemetry :stop events](https://github.com/absinthe-graphql/absinthe/pull/1174)

## 1.7.0

Expand Down Expand Up @@ -104,6 +130,10 @@ too impactful for a patch release.
- Bug Fix: Handle null propagation with `non_null(list_of(non_null(type)))` properly
- Bug Fix: Fix [double escaping issue](https://github.com/absinthe-graphql/absinthe/pull/962) with string literal arguments.

## 1.5.3 (unreleased)

- Bug Fix: Handle null propagation with `non_null(list_of(non_null(type)))` properly

## 1.5.2

- Bug Fix: Fix issue with persistent term backend.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ Some things that will increase the chance that your pull request is accepted:

Thanks again for helping!

[commit]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[commit]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Goals:
- Detailed error messages and documentation.
- A focus on robustness and production-level performance.

Please see the website at [http://absinthe-graphql.org](http://absinthe-graphql.org).
Please see the website at [https://absinthe-graphql.org](https://absinthe-graphql.org).

## Why Use Absinthe?

Expand Down Expand Up @@ -86,7 +86,7 @@ See [CHANGELOG](./CHANGELOG.md) for upgrade steps between versions.

- [Absinthe hexdocs](https://hexdocs.pm/absinthe).
- For the tutorial, guides, and general information about Absinthe-related
projects, see [http://absinthe-graphql.org](http://absinthe-graphql.org).
projects, see [https://absinthe-graphql.org](https://absinthe-graphql.org).

### Mix Tasks

Expand Down
24 changes: 22 additions & 2 deletions guides/complexity-analysis.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
# Complexity Analysis
# Safety Limits

A misbehaving client might send a very complex GraphQL query that would require
considerable resources to handle. In order to protect against this scenario, the
considerable resources to handle. There are two variations of this problem:

- Complex queries that overwhelm resolution resources.
- Extremely long queries that could take considerable resources to parse.
(For example, an attacker could craft a long query including thousands of
undefined fields or directives.)

Either of these could be a vector for a denial-of-service attack in any GraphQL
service. Absinthe includes mechanisms to protect services each of these.

## Complexity Analysis

To protect against queries that could overwhelm available resources, the
complexity of a query can be estimated before it is resolved and limited to a
specified maximum.

Expand Down Expand Up @@ -105,3 +117,11 @@ But this, at a complexity of `60`, wouldn't:
If a document's calculated complexity exceeds the configured limit, resolution
will be skipped and an error will be returned in the result detailing the
calculated and maximum complexities.

## Token Limits

To protect a service from invalid queries that could take considerable resources to parse,
Absinthe offers the option to configure a maximum limit on tokens in the GraphQL request document.
If the lexer encounters more tokens than this, it will stop the parse phase and return a phase error
with the message `"Token limit exceeded"`. This limit is `:infinity` by default (no limit)
and can be overridden by providing an integer to the option `token_limit` to `Absinthe.run`.
4 changes: 2 additions & 2 deletions guides/introduction/learning.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The following are some Absinthe-specific educational resources that are availabl

## Online Resources

* [Website](http://absinthe-graphql.org) (mostly just links elsewhere)
* [Website](https://absinthe-graphql.org) (mostly just links elsewhere)
* [Documentation](https://hexdocs.pm/absinthe) (current stable release)
* [How to GraphQL (with Absinthe)](https://www.howtographql.com/graphql-elixir/0-introduction/)

Expand All @@ -21,4 +21,4 @@ The following are some Absinthe-specific educational resources that are availabl

There's a ton of GraphQL resources on the web.

The [official website](http://graphql.org/) and [How to GraphQL](https://www.howtographql.com) are good places to start.
The [official website](https://graphql.org/) and [How to GraphQL](https://www.howtographql.com) are good places to start.
2 changes: 1 addition & 1 deletion guides/introduction/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ If you're new to GraphQL, we suggest you read up a bit on GraphQL's foundational

Here are a few resources that might be helpful:

- The official [GraphQL](http://graphql.org/) website
- The official [GraphQL](https://graphql.org/) website
- [How to GraphQL](https://www.howtographql.com/), which includes a [brief tutorial](https://www.howtographql.com/graphql-elixir/0-introduction/) using Absinthe

## Absinthe
Expand Down
8 changes: 1 addition & 7 deletions guides/introspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,5 @@ end
```

If you'd prefer to use a desktop application, we recommend using the pre-built
[Electron](http://electron.atom.io)-based wrapper application,
[Electron](https://electron.atom.io)-based wrapper application,
[GraphiQL.app](https://github.com/skevy/graphiql-app).

### GraphQL Hub

[GraphQL Hub](https://www.graphqlhub.com/) is an interesting website that you
can use to introspect a number of public GraphQL servers, using GraphiQL in the
browser and providing useful examples.
2 changes: 1 addition & 1 deletion guides/plug-phoenix.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ With a query string:
?query=query+GetItem($id:ID!){item(id:$id){name}}&variables={id:"foo"}
```

Due to [varying limits on the maximum size of URLs](http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers),
Due to [varying limits on the maximum size of URLs](https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers),
we recommend using one of the POST options below instead, putting the `query` into the body of the request.

### Via an `application/json` POST
Expand Down
9 changes: 9 additions & 0 deletions guides/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,17 @@ line:
Supervisor.start_link(children, opts)
```

See `Absinthe.Subscription.child_spec/1` for more information on the supported
options.

In your `MyAppWeb.Endpoint` module add:

```elixir
use Absinthe.Phoenix.Endpoint
```

Now, you need to configure your socket. I.e. in your `MyAppWeb.UserSocket` module add:

```elixir
use Absinthe.Phoenix.Socket,
schema: MyAppWeb.Schema
Expand Down
26 changes: 26 additions & 0 deletions guides/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,29 @@ After a query is executed, you'll see something like:
}
}
```

## Opentelemetry

When using Opentelemetry, one usually wants to correlate spans that are created
in spawned tasks with the main trace. For example, you might have a trace started
in a Phoenix endpoint, and then have spans around database access.

One can correlate manually by attaching the OTel context the task function:

```elixir
ctx = OpenTelemetry.Ctx.get_current()

Task.async(fn ->
OpenTelemetry.Ctx.attach(ctx)

# do stuff that might create spans
end)
```

When using the `async` and `batch` middleware, the tasks are spawned by Absinthe,
so you can't attach the context manually.

Instead, you can add the `:opentelemetry_process_propagator` package to your
dependencies, which has a `Task.async/1` wrapper that will attach the context
automatically. If the package is installed, the middleware will use it in place
of the default `Task.async/1`.
2 changes: 1 addition & 1 deletion guides/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ end
```

Phoenix generates the `MyAppWeb.ConnCase` test helper module. This supplies the
`conn` variable containing the request and response. It also has helper functions
`conn` variable containing the request and response. It also has helper functions
such as [`post/3`](https://hexdocs.pm/phoenix/Phoenix.ConnTest.html#post/3)
and [`json_response/2`](https://hexdocs.pm/phoenix/Phoenix.ConnTest.html#json_response/2).

Expand Down
4 changes: 2 additions & 2 deletions guides/tutorial/our-first-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ which is where all the domain logic for posts lives, invoking its
> for [advanced plugins](middleware-and-plugins.md) that further process the data.
>
> If you're asking yourself what the implementation of the domain logic looks like, and exactly how
> the related Ecto schemas are built, read through the code in the [absinthe_tutorial](http://github.com/absinthe-graphql/absinthe_tutorial)
> the related Ecto schemas are built, read through the code in the [absinthe_tutorial](https://github.com/absinthe-graphql/absinthe_tutorial)
> repository. The tutorial content here is intentionally focused on the Absinthe-specific code.

Now that we have the functional pieces in place, let's configure our
Expand Down Expand Up @@ -156,7 +156,7 @@ Once it's up-and-running, take a look at [http://localhost:4000/api/graphiql](ht

Make sure that the `URL` is pointing to the correct place and press the play button. If everything goes according to plan, you should see something like this:

<img style="box-shadow: 0 0 6px #ccc;" src="assets/tutorial/graphiql.png" alt=""/>
<img style="box-shadow: 0 0 6px #ccc;" src="/guides/assets/tutorial/graphiql.png" alt=""/>

## Next Step

Expand Down
2 changes: 1 addition & 1 deletion guides/tutorial/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Absinthe.

Before you start, it's a good idea to have some background into GraphQL in general. Here are a few resources that might be helpful:

- The official [GraphQL](http://graphql.org/) website
- The official [GraphQL](https://graphql.org/) website
- [How to GraphQL](https://www.howtographql.com/) (this includes another [brief tutorial](https://www.howtographql.com/graphql-elixir/0-introduction/) using Absinthe)

## The Example
Expand Down
2 changes: 1 addition & 1 deletion guides/tutorial/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ In `lib/blog/application.ex`:
children = [
# other children ...
{BlogWeb.Endpoint, []}, # this line should already exist
{Absinthe.Subscription, [BlogWeb.Endpoint]}, # add this line
{Absinthe.Subscription, BlogWeb.Endpoint}, # add this line
# other children ...
]
```
Expand Down
2 changes: 1 addition & 1 deletion guides/upgrading/v1.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ The reason for this is that you can also access the `context` within the `exec`

## Calling All Resolvers: The Null Literal Has Arrived

Absinthe now supports [GraphQL `null` literals](http://facebook.github.io/graphql/October2016/#sec-Null-Value).
Absinthe now supports [GraphQL `null` literals](https://spec.graphql.org/October2016/#sec-Null-Value).

`null` values, when provided as arguments, are passed on to Absinthe resolvers as `nil` (provided they don't run afoul of a `non_null/1` argument constraint).

Expand Down
14 changes: 11 additions & 3 deletions lib/absinthe.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Absinthe do
Documentation for the Absinthe package, a toolkit for building GraphQL
APIs with Elixir.

For usage information, see [the documentation](http://hexdocs.pm/absinthe), which
For usage information, see [the documentation](https://hexdocs.pm/absinthe), which
includes guides, API information for important modules, and links to useful resources.
"""

Expand Down Expand Up @@ -49,6 +49,8 @@ defmodule Absinthe do
| %{data: nil | result_selection_t, errors: [result_error_t]}
| %{errors: [result_error_t]}

@type pipeline_modifier_fun :: (Absinthe.Pipeline.t(), Keyword.t() -> Absinthe.Pipeline.t())

@doc """
Evaluates a query document against a schema, with options.

Expand Down Expand Up @@ -92,7 +94,8 @@ defmodule Absinthe do
operation_name: String.t(),
analyze_complexity: boolean,
variables: %{optional(String.t()) => any()},
max_complexity: non_neg_integer | :infinity
max_complexity: non_neg_integer | :infinity,
pipeline_modifier: pipeline_modifier_fun()
]

@type run_result :: {:ok, result_t} | {:error, String.t()}
Expand All @@ -103,9 +106,12 @@ defmodule Absinthe do
run_opts
) :: run_result
def run(document, schema, options \\ []) do
pipeline_modifier = options[:pipeline_modifier] || (&pipeline_identity/2)

pipeline =
schema
|> Absinthe.Pipeline.for_document(options)
|> pipeline_modifier.(options)

case Absinthe.Pipeline.run(document, pipeline) do
{:ok, %{result: result}, _phases} ->
Expand All @@ -126,12 +132,14 @@ defmodule Absinthe do
@spec run!(
binary | Absinthe.Language.Source.t() | Absinthe.Language.Document.t(),
Absinthe.Schema.t(),
Keyword.t()
run_opts
) :: result_t | no_return
def run!(input, schema, options \\ []) do
case run(input, schema, options) do
{:ok, result} -> result
{:error, err} -> raise ExecutionError, message: err
end
end

defp pipeline_identity(pipeline, _options), do: pipeline
end
Loading