Skip to content

Commit

Permalink
docs: updated with annotations removal
Browse files Browse the repository at this point in the history
  • Loading branch information
fogrye committed Apr 13, 2024
1 parent 2d5ce22 commit 6d33ecf
Show file tree
Hide file tree
Showing 31 changed files with 247 additions and 2,896 deletions.
14 changes: 7 additions & 7 deletions website/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ public function toGraphQLInputType(Type $type, ?InputType $subType, string $argu

### New features

- [@Input](annotations-reference.md#input-annotation) annotation is introduced as an alternative to `@Factory`. Now GraphQL input type can be created in the same manner as `@Type` in combination with `@Field` - [example](input-types.mdx#input-attribute).
- [@Input](annotations-reference.md#input-annotation) annotation is introduced as an alternative to `#[Factory]`. Now GraphQL input type can be created in the same manner as `#[Type]` in combination with `#[Field]` - [example](input-types.mdx#input-attribute).
- New attributes has been added to [@Field](annotations-reference.md#field-annotation) annotation: `for`, `inputType` and `description`.
- The following annotations now can be applied to class properties directly: `@Field`, `@Logged`, `@Right`, `@FailWith`, `@HideIfUnauthorized` and `@Security`.
- The following annotations now can be applied to class properties directly: `#[Field]`, `#[Logged]`, `#[Right]`, `@FailWith`, `@HideIfUnauthorized` and `#[Security]`.

## 4.1.0

Expand Down Expand Up @@ -174,21 +174,21 @@ changed.

### New features

- You can directly [annotate a PHP interface with `@Type` to make it a GraphQL interface](inheritance-interfaces.mdx#mapping-interfaces)
- You can directly [annotate a PHP interface with `#[Type]` to make it a GraphQL interface](inheritance-interfaces.mdx#mapping-interfaces)
- You can autowire services in resolvers, thanks to the new `@Autowire` annotation
- Added [user input validation](validation.mdx) (using the Symfony Validator or the Laravel validator or a custom `@Assertion` annotation
- Added [user input validation](validation.mdx) (using the Symfony Validator or the Laravel validator or a custom `#[Assertion]` annotation
- Improved security handling:
- Unauthorized access to fields can now generate GraphQL errors (rather that schema errors in GraphQLite v3)
- Added fine-grained security using the `@Security` annotation. A field can now be [marked accessible or not depending on the context](fine-grained-security.mdx).
- Added fine-grained security using the `#[Security]` annotation. A field can now be [marked accessible or not depending on the context](fine-grained-security.mdx).
For instance, you can restrict access to the field "viewsCount" of the type `BlogPost` only for post that the current user wrote.
- You can now inject the current logged user in any query / mutation / field using the `@InjectUser` annotation
- You can now inject the current logged user in any query / mutation / field using the `#[InjectUser]` annotation
- Performance:
- You can inject the [Webonyx query plan in a parameter from a resolver](query-plan.mdx)
- You can use the [dataloader pattern to improve performance drastically via the "prefetchMethod" attribute](prefetch-method.mdx)
- Customizable error handling has been added:
- You can throw [many errors in one exception](error-handling.mdx#many-errors-for-one-exception) with `TheCodingMachine\GraphQLite\Exceptions\GraphQLAggregateException`
- You can force input types using `@UseInputType(for="$id", inputType="ID!")`
- You can extend an input types (just like you could extend an output type in v3) using [the new `@Decorate` annotation](extend-input-type.mdx)
- You can extend an input types (just like you could extend an output type in v3) using [the new `#[Decorate]` annotation](extend-input-type.mdx)
- In a factory, you can [exclude some optional parameters from the GraphQL schema](input-types#ignoring-some-parameters)

Many extension points have been added
Expand Down
61 changes: 0 additions & 61 deletions website/docs/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ slug: /
sidebar_label: GraphQLite
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<p align="center">
<img src="https://graphqlite.thecodingmachine.io/img/logo.svg" alt="GraphQLite logo" width="250" height="250" />
</p>
Expand All @@ -26,14 +23,6 @@ file uploads, security, validation, extendable types and more!

First, declare a query in your controller:

<Tabs
defaultValue="php8"
values={[
{label: 'PHP 8', value: 'php8'},
{label: 'PHP 7', value: 'php7'},
]}>
<TabItem value="php8">

```php
class ProductController
{
Expand All @@ -45,35 +34,8 @@ class ProductController
}
```

</TabItem>
<TabItem value="php7">

```php
class ProductController
{
/**
* @Query()
*/
public function product(string $id): Product
{
// Some code that looks for a product and returns it.
}
}
```

</TabItem>
</Tabs>

Then, annotate the `Product` class to declare what fields are exposed to the GraphQL API:

<Tabs
defaultValue="php8"
values={[
{label: 'PHP 8', value: 'php8'},
{label: 'PHP 7', value: 'php7'},
]}>
<TabItem value="php8">

```php
#[Type]
class Product
Expand All @@ -87,29 +49,6 @@ class Product
}
```

</TabItem>
<TabItem value="php7">

```php
/**
* @Type()
*/
class Product
{
/**
* @Field()
*/
public function getName(): string
{
return $this->name;
}
// ...
}
```

</TabItem>
</Tabs>

That's it, you're good to go! Query and enjoy!

```graphql
Expand Down
Loading

0 comments on commit 6d33ecf

Please sign in to comment.