Skip to content
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
15 changes: 8 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.14'
- name: Build wheel and source tarball
run: |
pip install wheel
python setup.py sdist bdist_wheel
python -m pip install --upgrade pip
pip install build
python -m build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@v1.1.0
uses: pypa/gh-action-pypi-publish@v1.8.14
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Build environment
run: make integration-build
- name: Run Integration Tests
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.10.5
python-version: 3.14
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10-alpine
FROM python:3-alpine

# Disable Python buffering in order to see the logs immediatly
ENV PYTHONUNBUFFERED=1
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@
# -------------------------

integration-build: ## Build environment for integration tests
cd integration_tests && docker-compose build
cd integration_tests && docker compose build
.PHONY: integration-build

integration-tests: ## Run integration tests
cd integration_tests && docker-compose down && docker-compose run --rm tests
cd integration_tests && docker compose down && docker compose run --rm tests
.PHONY: integration-test

# -------------------------
# Development and unit testing
# -------------------------

dev-setup: ## Install development dependencies
docker-compose up --build -d
docker compose up --build -d
.PHONY: dev-setup

tests: ## Run unit tests
docker-compose run graphene_federation py.test tests --cov=graphene_federation -vv
docker compose run --rm --remove-orphans graphene_federation py.test tests --cov=graphene_federation -vv
.PHONY: tests

check-style: ## Run linting
docker-compose run graphene_federation black graphene_federation --check
docker compose run --rm graphene_federation black graphene_federation --check
.PHONY: check-style

check-types: ## Run typing check
docker-compose run graphene_federation mypy graphene_federation
docker compose run --rm graphene_federation mypy graphene_federation
.PHONY: check-types

# -------------------------
Expand Down
35 changes: 26 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,17 @@ If you need to use a version compatible with `graphene` v2 I recommend using the
- [x] v2.3
- [x] v2.4
- [x] v2.5
- [x] v2.6 `STABLE_VERSION` . Rover dev supports only upto v2.6
- [x] v2.7 `LATEST_VERSION`
- [x] v2.6
- [x] v2.7
- [x] v2.8
- [x] v2.9
- [x] v2.10
- [x] v2.11 `STABLE_VERSION`,`LATEST_VERSION`

All directives could be easily integrated with the help of [graphene-directives](https://github.com/strollby/graphene-directives).
Now every directive's values are validated at run time itself by [graphene-directives](https://github.com/strollby/graphene-directives).

### Directives (v2.7)
### Directives (v2.11)

```graphql
directive @composeDirective(name: String!) repeatable on SCHEMA
Expand Down Expand Up @@ -84,21 +88,38 @@ directive @authenticated on
| INTERFACE
| SCALAR
| ENUM
directive @requiresScopes(scopes: [[federation__Scope!]!]!) on
directive @requiresScopes(scopes: [[Scope!]!]!) on
FIELD_DEFINITION
| OBJECT
| INTERFACE
| SCALAR
| ENUM
directive @policy(policies: [[federation__Policy!]!]!) on
directive @policy(policies: [[Policy!]!]!) on
| FIELD_DEFINITION
| OBJECT
| INTERFACE
| SCALAR
| ENUM
directive @context(name: String!) on OBJECT | INTERFACE | UNION
directive @fromContext(field: ContextFieldValue) on ARGUMENT_DEFINITION
directive @listSize(
assumedSize: Int
slicingArguments: [String!]
sizedFields: [String!]
requireOneSlicingArgument: Boolean = true
) on FIELD_DEFINITION
directive @cost(weight: Int!) on
ARGUMENT_DEFINITION
| ENUM
| FIELD_DEFINITION
| INPUT_FIELD_DEFINITION
| OBJECT
| SCALAR
| ENUM
scalar federation__Policy
scalar federation__Scope
scalar FieldSet
scalar federation__ContextFieldValue
```

Read about directives in [official documentation](https://www.apollographql.com/docs/federation/federated-types/federated-directives)
Expand Down Expand Up @@ -430,10 +451,6 @@ schema = build_schema(query=Query, federation_version=LATEST_VERSION) # auto_cam

------------------------

## Known Issues

- Using `@composeDirective` with `@link` in Federation `v2.6` shows error in rover, rover cli only supports upto `v2.5` as of 16/01/2024

## Contributing

* You can run the unit tests by doing: `make tests`.
Expand Down
5 changes: 1 addition & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
version: '3.5'

services:

graphene_federation:
container_name: graphene_federation
build:
context: .
volumes:
- ./:/workdir
- ./:/workdir
69 changes: 69 additions & 0 deletions federation_spec/federation-v2.10.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
directive @composeDirective(name: String!) repeatable on SCHEMA
directive @extends on OBJECT | INTERFACE
directive @external on OBJECT | FIELD_DEFINITION
directive @key(fields: FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE
directive @inaccessible on
| FIELD_DEFINITION
| OBJECT
| INTERFACE
| UNION
| ENUM
| ENUM_VALUE
| SCALAR
| INPUT_OBJECT
| INPUT_FIELD_DEFINITION
| ARGUMENT_DEFINITION
directive @interfaceObject on OBJECT
directive @override(from: String!, label: String) on FIELD_DEFINITION
directive @provides(fields: FieldSet!) on FIELD_DEFINITION
directive @requires(fields: FieldSet!) on FIELD_DEFINITION
directive @shareable repeatable on FIELD_DEFINITION | OBJECT
directive @tag(name: String!) repeatable on
| FIELD_DEFINITION
| INTERFACE
| OBJECT
| UNION
| ARGUMENT_DEFINITION
| SCALAR
| ENUM
| ENUM_VALUE
| INPUT_OBJECT
| INPUT_FIELD_DEFINITION
directive @authenticated on
FIELD_DEFINITION
| OBJECT
| INTERFACE
| SCALAR
| ENUM
directive @requiresScopes(scopes: [[federation__Scope!]!]!) on
FIELD_DEFINITION
| OBJECT
| INTERFACE
| SCALAR
| ENUM
directive @policy(policies: [[federation__Policy!]!]!) on
| FIELD_DEFINITION
| OBJECT
| INTERFACE
| SCALAR
| ENUM
directive @context(name: String!) on OBJECT | INTERFACE | UNION
directive @fromContext(field: federation__ContextFieldValue) on ARGUMENT_DEFINITION
directive @listSize(
assumedSize: Int
slicingArguments: [String!]
sizedFields: [String!]
requireOneSlicingArgument: Boolean = true
) on FIELD_DEFINITION
directive @cost(weight: Int!) on
ARGUMENT_DEFINITION
| ENUM
| FIELD_DEFINITION
| INPUT_FIELD_DEFINITION
| OBJECT
| SCALAR
| ENUM
scalar federation__Policy
scalar federation__Scope
scalar FieldSet
scalar federation__ContextFieldValue
69 changes: 69 additions & 0 deletions federation_spec/federation-v2.11.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
directive @composeDirective(name: String!) repeatable on SCHEMA
directive @extends on OBJECT | INTERFACE
directive @external on OBJECT | FIELD_DEFINITION
directive @key(fields: FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE
directive @inaccessible on
| FIELD_DEFINITION
| OBJECT
| INTERFACE
| UNION
| ENUM
| ENUM_VALUE
| SCALAR
| INPUT_OBJECT
| INPUT_FIELD_DEFINITION
| ARGUMENT_DEFINITION
directive @interfaceObject on OBJECT
directive @override(from: String!, label: String) on FIELD_DEFINITION
directive @provides(fields: FieldSet!) on FIELD_DEFINITION
directive @requires(fields: FieldSet!) on FIELD_DEFINITION
directive @shareable repeatable on FIELD_DEFINITION | OBJECT
directive @tag(name: String!) repeatable on
| FIELD_DEFINITION
| INTERFACE
| OBJECT
| UNION
| ARGUMENT_DEFINITION
| SCALAR
| ENUM
| ENUM_VALUE
| INPUT_OBJECT
| INPUT_FIELD_DEFINITION
directive @authenticated on
FIELD_DEFINITION
| OBJECT
| INTERFACE
| SCALAR
| ENUM
directive @requiresScopes(scopes: [[federation__Scope!]!]!) on
FIELD_DEFINITION
| OBJECT
| INTERFACE
| SCALAR
| ENUM
directive @policy(policies: [[federation__Policy!]!]!) on
| FIELD_DEFINITION
| OBJECT
| INTERFACE
| SCALAR
| ENUM
directive @context(name: String!) on OBJECT | INTERFACE | UNION
directive @fromContext(field: federation__ContextFieldValue) on ARGUMENT_DEFINITION
directive @listSize(
assumedSize: Int
slicingArguments: [String!]
sizedFields: [String!]
requireOneSlicingArgument: Boolean = true
) on FIELD_DEFINITION
directive @cost(weight: Int!) on
ARGUMENT_DEFINITION
| ENUM
| FIELD_DEFINITION
| INPUT_FIELD_DEFINITION
| OBJECT
| SCALAR
| ENUM
scalar federation__Policy
scalar federation__Scope
scalar FieldSet
scalar federation__ContextFieldValue
55 changes: 55 additions & 0 deletions federation_spec/federation-v2.8.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
directive @composeDirective(name: String!) repeatable on SCHEMA
directive @extends on OBJECT | INTERFACE
directive @external on OBJECT | FIELD_DEFINITION
directive @key(fields: FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE
directive @inaccessible on
| FIELD_DEFINITION
| OBJECT
| INTERFACE
| UNION
| ENUM
| ENUM_VALUE
| SCALAR
| INPUT_OBJECT
| INPUT_FIELD_DEFINITION
| ARGUMENT_DEFINITION
directive @interfaceObject on OBJECT
directive @override(from: String!, label: String) on FIELD_DEFINITION
directive @provides(fields: FieldSet!) on FIELD_DEFINITION
directive @requires(fields: FieldSet!) on FIELD_DEFINITION
directive @shareable repeatable on FIELD_DEFINITION | OBJECT
directive @tag(name: String!) repeatable on
| FIELD_DEFINITION
| INTERFACE
| OBJECT
| UNION
| ARGUMENT_DEFINITION
| SCALAR
| ENUM
| ENUM_VALUE
| INPUT_OBJECT
| INPUT_FIELD_DEFINITION
directive @authenticated on
FIELD_DEFINITION
| OBJECT
| INTERFACE
| SCALAR
| ENUM
directive @requiresScopes(scopes: [[federation__Scope!]!]!) on
FIELD_DEFINITION
| OBJECT
| INTERFACE
| SCALAR
| ENUM
directive @policy(policies: [[federation__Policy!]!]!) on
| FIELD_DEFINITION
| OBJECT
| INTERFACE
| SCALAR
| ENUM
directive @context(name: String!) on OBJECT | INTERFACE | UNION
directive @fromContext(field: federation__ContextFieldValue) on ARGUMENT_DEFINITION
scalar federation__Policy
scalar federation__Scope
scalar FieldSet
scalar federation__ContextFieldValue
Loading