Skip to content

Commit

Permalink
API Update API to reflect changes to CLI interaction (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli authored Sep 26, 2024
1 parent 1549ab4 commit ad9d3c5
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 212 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ This module adds an implementation of [graphiql](https://github.com/graphql/grap

### Accessing the IDE

**In GraphQL 3.x**, it can be accessed at `/dev/graphiql/`.

**In GraphQL 4.x+**, it can be accessed at `/dev/graphql/ide`.
It can be accessed at `/dev/graphql/ide`.

This is because GraphQL 4+ has its own `DevelopmentAdmin` controller.

The GraphQL v4 version of the module allows you to clear your schema by calling the `/dev/graphql/clear` task.
The GraphQL v4 version of the module allows you to clear your schema by running `sake graphql:clear`.

## Security

By default, the tool has the same restrictions as other development tools like `dev/build`:
By default, the tool has the same restrictions as other development tools like `/dev/build`:

* In "dev" mode, it's available without authentication
* In "test" and "live" mode, it requires ADMIN permissions
Expand Down Expand Up @@ -100,13 +98,13 @@ You must be in CLI mode to use this task
To view help for the task to see what options are available:

```bash
vendor/bin/sake dev/tasks/GraphQLSchemaInitTask help=1
vendor/bin/sake tasks:GraphQLSchemaInitTask --help
```

To run the task with with minimal options:

```bash
vendor/bin/sake dev/tasks/GraphQLSchemaInitTask namespace=App
vendor/bin/sake tasks:GraphQLSchemaInitTask --namespace=App
```


Expand Down
33 changes: 7 additions & 26 deletions _config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,14 @@ SilverStripe\GraphQLDevTools\Controller:
default_schema: default

---
Name: graphql4-devtool-routes
Name: devtool-routes
After:
- 'graphql-dev'
Only:
classexists: 'SilverStripe\GraphQL\Schema\Schema'
---
SilverStripe\GraphQL\Dev\DevelopmentAdmin:
registered_controllers:
ide:
controller: 'SilverStripe\GraphQLDevTools\Controller'
links:
ide: Run the GraphQL IDE
clear:
controller: SilverStripe\GraphQLDevTools\Clear
links:
clear: Clear the GraphQL schema

---
Name: graphql3-devtool-routes
After:
- 'graphql-dev'
Except:
classexists: 'SilverStripe\GraphQL\Schema\Schema'
---
SilverStripe\Dev\DevelopmentAdmin:
registered_controllers:
graphiql:
controller: 'SilverStripe\GraphQLDevTools\Controller'
SilverStripe\GraphQLDevTools\Controller:
default_route: 'graphql'
commands:
'graphql/clear': 'SilverStripe\GraphQLDevTools\SchemaClear'
controllers:
'graphql/ide':
class: 'SilverStripe\GraphQLDevTools\Controller'
description: Run the GraphQL IDE
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "silverstripe/graphql-devtools",
"description": "Tools to help developers building new applications on SilverStripes GraphQL API",
"description": "Tools to help developers building new applications on SilverStripe's GraphQL API",
"type": "silverstripe-vendormodule",
"license": "BSD-3-Clause",
"require": {
"silverstripe/graphql": "^3 || ^4 || ^5 || ^6",
"symfony/finder": "^4 || ^5 || ^6 || ^7",
"symfony/filesystem": "^4 || ^5 || ^6 || ^7"
"silverstripe/graphql": "^6",
"symfony/finder": "^7",
"symfony/filesystem": "^7"
},
"require-dev": {
"phpunit/phpunit": "^11.3",
"silverstripe/framework": "^4.10",
"silverstripe/framework": "^6",
"squizlabs/php_codesniffer": "^3"
},
"autoload": {
Expand Down
70 changes: 0 additions & 70 deletions src/Clear.php

This file was deleted.

Loading

0 comments on commit ad9d3c5

Please sign in to comment.