Skip to content

Fixed typos and broken links #752

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

Merged
merged 35 commits into from
Mar 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f9d17c8
fixed typos and broken links
SeaJayEm Mar 4, 2019
de926c0
fixed typos and broken links
SeaJayEm Mar 5, 2019
d5a6597
fixed typos and broken links
SeaJayEm Mar 6, 2019
aeb46ee
Update react.md
SeaJayEm Mar 6, 2019
119619a
Update angularjs-integration.md
SeaJayEm Mar 6, 2019
b2208f6
Update deprecations.md
SeaJayEm Mar 6, 2019
60e0e67
Update mercure.md
SeaJayEm Mar 6, 2019
88cb6c5
Update mongodb.md
SeaJayEm Mar 6, 2019
cda8b35
Update performance.md
SeaJayEm Mar 6, 2019
0beda67
Update kubernetes.md
SeaJayEm Mar 6, 2019
737ef1b
Update philosophy.md
SeaJayEm Mar 6, 2019
8a1f0dc
Update getting-started.md
SeaJayEm Mar 6, 2019
395c325
Update admin/getting-started.md
alanpoulain Mar 6, 2019
c69b9aa
Update core/dto.md
dunglas Mar 6, 2019
69faf22
Update core/dto.md
dunglas Mar 6, 2019
28c2c89
Update mercure.md
SeaJayEm Mar 6, 2019
0a91a62
Update index.md
SeaJayEm Mar 6, 2019
57da593
Update core/fosuser-bundle.md
dunglas Mar 6, 2019
8ba981e
Update schema-generator/configuration.md
dunglas Mar 6, 2019
c745338
Update index.md
SeaJayEm Mar 6, 2019
07e0a2b
Update data-persisters.md
SeaJayEm Mar 6, 2019
ca83d88
Update performance.md
SeaJayEm Mar 6, 2019
4beb0e0
Update serialization.md
SeaJayEm Mar 6, 2019
7571a2b
Update getting-started.md
SeaJayEm Mar 6, 2019
220566a
Update core/identifiers.md
alanpoulain Mar 6, 2019
929df8e
Update deployment/traefik.md
alanpoulain Mar 6, 2019
135a48b
Update index.md
SeaJayEm Mar 6, 2019
479de91
Update core/data-persisters.md
alanpoulain Mar 6, 2019
5948b02
Update core/performance.md
alanpoulain Mar 6, 2019
e47e602
Update core/serialization.md
alanpoulain Mar 6, 2019
626cf82
Update schema-generator/configuration.md
alanpoulain Mar 6, 2019
72329bd
Update schema-generator/index.md
alanpoulain Mar 6, 2019
283ef5f
Update index.md
SeaJayEm Mar 7, 2019
4e84d38
Update index.md
SeaJayEm Mar 7, 2019
2864e05
do not use dto word for object relations
soyuka Mar 6, 2019
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
16 changes: 8 additions & 8 deletions admin/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Installation

Install the skeleton and the library:
You'll need to install the skeleton and the library.

Start by installing [the Yarn package manager](https://yarnpkg.com/) ([NPM](https://www.npmjs.com/) is also supported) and
the [Create React App](https://facebook.github.io/create-react-app/) tool.
Expand All @@ -21,7 +21,7 @@ Finally, install the `@api-platform/admin` library:

## Creating the Admin

Edit the `src/App.js` file like the following:
Edit the `src/App.js` file the following way:

```javascript
import React from 'react';
Expand Down Expand Up @@ -62,11 +62,11 @@ Note: if you don't want to hardcode the API URL, you can [use an environment var

## Customizing the Admin

The API Platform's admin parses the Hydra documentation exposed by the API and transforms it to an object data structure. This data structure can be customized to add, remove or customize resources and properties. To do so, we can leverage the `AdminBuilder` component provided by the library. It's a lower level component than the `HydraAdmin` one we used in the previous example. It allows to access to the object storing the structure of admin's screens.
The API Platform's admin parses the Hydra documentation exposed by the API and transforms it to an object data structure. This data structure can be tailored to add, remove or customize resources and properties. To do so, we can leverage the `AdminBuilder` component provided by the library. It's a lower level component than the `HydraAdmin` one we used in the previous example. It allows to access the object storing the structure of admin's screens.

### Using Custom Components

In the following example, we change components used for the `description` property of the `books` resource to ones accepting HTML (respectively `RichTextField` that renders HTML markup and `RichTextInput`, a WYSWYG editor).
In the following example, we change components used for the `description` property of the `books` resource to ones accepting HTML (respectively `RichTextField` that renders HTML markup and `RichTextInput`, a WYSIWYG editor).
(To use the `RichTextInput`, the `ra-input-rich-text` package is must be installed: `yarn add ra-input-rich-text`).

```javascript
Expand Down Expand Up @@ -104,7 +104,7 @@ export default (props) => <HydraAdmin apiDocumentationParser={myApiDocumentation
```

The `field` property of the `Field` class allows to set the component used to render a property in list and show screens.
The `input` property allows to set the component to use to render the input used in create and edit screens.
The `input` property allows to set the component used to render the input used in create and edit screens.

Any [field](https://marmelab.com/react-admin/Fields.html) or [input](https://marmelab.com/react-admin/Inputs.html) provided by the React Admin library can be used.

Expand All @@ -113,7 +113,7 @@ To go further, take a look to the "[Including react-admin on another React app](
### Managing Files and Images

In the following example, we will:
* find every [ImageObject](http://schema.org/ImageObject) resources. For each [contentUrl](http://schema.org/contentUrl) fields, we will use [ImageField](https://marmelab.com/react-admin/Fields.html#imagefield) as `field` and [ImageInput](https://marmelab.com/react-admin/Inputs.html#imageinput) as `input`.
* find every [ImageObject](http://schema.org/ImageObject) resource. For each [contentUrl](http://schema.org/contentUrl) field, we will use [ImageField](https://marmelab.com/react-admin/Fields.html#imagefield) as `field` and [ImageInput](https://marmelab.com/react-admin/Inputs.html#imageinput) as `input`.
* [ImageInput](https://marmelab.com/react-admin/Inputs.html#imageinput) will return a [File](https://developer.mozilla.org/en/docs/Web/API/File) instance. In this example, we will send a multi-part form data to a special action (`https://demo.api-platform.com/images/upload`). The action will return the ID of the uploaded image. We will "replace" the [File](https://developer.mozilla.org/en/docs/Web/API/File) instance by the ID in `normalizeData`.
* As `contentUrl` fields will return a string, we have to convert Hydra data to React Admin data. This action will be done by `denormalizeData`.

Expand Down Expand Up @@ -227,9 +227,9 @@ export default class extends Component {

### Using the Hydra Data Provider Directly with react-admin

By default, the `HydraAdmin` component shipped with API Platform Admin will generate a convenient admin interface for every resources and every properties exposed by the API. But sometimes, you may prefer having full control over the generated admin.
By default, the `HydraAdmin` component shipped with API Platform Admin will generate a convenient admin interface for every resource and every property exposed by the API. But sometimes, you may prefer having full control over the generated admin.

To do so, an alternative approach is [to configure every react-admin components manually](https://marmelab.com/react-admin/Tutorial.html) instead of letting the library generating it, but to still leverage the built-in Hydra [data provider](https://marmelab.com/react-admin/DataProviders.html):
To do so, an alternative approach is [to configure every react-admin component manually](https://marmelab.com/react-admin/Tutorial.html) instead of letting the library generate them, but to still leverage the built-in Hydra [data provider](https://marmelab.com/react-admin/DataProviders.html):

```javascript
// admin/src/App.js
Expand Down
16 changes: 8 additions & 8 deletions admin/handling-relations-to-collections.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Handling Relations to Collections

Considering an API exposing `Person` and `Book` resources linked with a `many-to-many`
relation between them (through the `authors` property).
Let's consider an API exposing `Person` and `Book` resources linked by a `many-to-many`
relation (through the `authors` property).

This API using the following PHP code:
This API uses the following PHP code:

```php
<?php
Expand Down Expand Up @@ -73,7 +73,7 @@ The admin handles this `to-many` relation automatically!

## Customizing a Property

Let's customize the components used for the `authors` property, to display them by their 'name' instead 'id' (the default behavior).
Let's customize the components used for the `authors` property, to display them by their 'name' instead of their 'id' (the default behavior).

```javascript
import React, { Component } from 'react';
Expand Down Expand Up @@ -123,15 +123,15 @@ export default class extends Component {

## Customizing an Icon

Now that our `authors` property is displaying the name instead of an 'id', let's change the icon shown in the list menu.
Now that our `authors` property is displaying the name instead of the 'id', let's change the icon shown in the list menu.

Just add an import statement from `@material-ui` for adding the icon, in this case, a user icon:
Just add an import statement from `@material-ui` for adding the icon - in this case, a user icon:

`import UserIcon from '@material-ui/icons/People';`

and add it to the `authors.icon` property
and add it to the `authors.icon` property.

The code for just customizing the icon will be:
The code for customizing only the icon will be:

```javascript
import React, { Component } from 'react';
Expand Down
18 changes: 9 additions & 9 deletions admin/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ You can also customize all screens by using React Admin components and even raw

## Features

* Automatically generate an admin interface for all the resources of the API thanks to hypermedia features of Hydra
* Generate list, create, show, edit screens as well as a delete button
* Generate suitable inputs and fields according to the API doc (e.g. number HTML input for numbers, checkbox for booleans, selectbox for relationships...)
* Generate suitable inputs and fields according to Schema.org types if available (e.g. email field for http://schema.org/email)
* Handle relationships
* Pagination support
* Automatically validate if a field is mandatory client-side according to the API description
* Send proper HTTP requests to the API and decode them using Hydra and JSON-LD formats
* Nicely display server-side errors (e.g. advanced validation)
* Automatically generates an admin interface for all the resources of the API thanks to hypermedia features of Hydra
* Generates 'list', 'create', 'show', and 'edit' screens, as well as a delete button
* Generates suitable inputs and fields according to the API doc (e.g. number HTML input for numbers, checkbox for booleans, selectbox for relationships...)
* Generates suitable inputs and fields according to Schema.org types if available (e.g. email field for http://schema.org/email)
* Handles relationships
* Supports pagination
* Automatically validates whether a field is mandatory client-side according to the API description
* Sends proper HTTP requests to the API and decodes them using Hydra and JSON-LD formats
* Nicely displays server-side errors (e.g. advanced validation)
* **100% customizable**
8 changes: 4 additions & 4 deletions client-generator/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ Client Generator works especially well with APIs built with the [API Platform](h

## Features

* Generate high-quality ES6:
* Generates high-quality ES6:
* list view (with pagination)
* detail view
* creation form
* editation form
* update form
* delete button
* Supports to-one and to-many relations
* Uses the appropriate input type (`number`, `date`...)
* Client-side validation
* Subscribe to data updates pushed by servers supporting [the Mercure protocol](https://mercure.rocks)
* Display server-side validation errors under the related input (if using API Platform Core)
* Subscribes to data updates pushed by servers supporting [the Mercure protocol](https://mercure.rocks)
* Displays server-side validation errors under the related input (if using API Platform Core)
* Integration with [Bootstrap](https://getbootstrap.com/) and [FontAwesome](https://fontawesome.com/) (Progressive Web Apps)
* Integration with [React Native Elements](https://react-native-training.github.io/react-native-elements/)
* Accessible to people with disabilities ([ARIA](https://www.w3.org/WAI/intro/aria) support in webapps)
2 changes: 1 addition & 1 deletion client-generator/react.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ It contains the React Client Generator, all dependencies it needs, a Progressive
a development Docker container to serve the webapp, and all the API Platform components you may need, including an API server
supporting Hydra.

If you use the API Platform, jump to the next section!
If you use API Platform, jump to the next section!
Alternatively, you can generate a skeleton and install the generator using [npx](https://www.npmjs.com/package/npx).
To use this generator you need [Node.js](https://nodejs.org/) and [Yarn](https://yarnpkg.com/) (or [NPM](https://www.npmjs.com/)) installed.

Expand Down
2 changes: 1 addition & 1 deletion client-generator/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ api_jsonld_context ANY ANY ANY /contexts/{s
specified the documentation URL instead of the entrypoint. For example if you are using API Platform and your
documentation URL is at [https://demo.api-platform.com/docs](https://demo.api-platform.com/docs) the entry point is
likely at [https://demo.api-platform.com](https://demo.api-platform.com). You can see an example of the expected
response from an entrypoint in your browser by clicking visiting
response from an entrypoint in your browser by visiting
[https://demo.api-platform.com/index.jsonld](https://demo.api-platform.com/index.jsonld).

* If you receive `TypeError: Cannot read property '@type' of undefined` or `TypeError: Cannot read property '0'
Expand Down
2 changes: 1 addition & 1 deletion client-generator/vuejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ In the app directory, generate the files for the resource you want:
# Replace the URL by the entrypoint of your Hydra-enabled API
# Omit the resource flag to generate files for all resource types exposed by the API

The code is ready to be executed! Register the generated routes and store modules in the `main.js` file, here is an example:
The code is ready to be executed! Register the generated routes and store modules in the `main.js` file. Here is an example:

```javascript
import Vue from 'vue'
Expand Down
4 changes: 2 additions & 2 deletions core/angularjs-integration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AngularJS Integration

Warning: For new project, you should consider using [the API Platform's Progressive Web App generator](../client-generator/index.md)
Warning: for a new project, you should consider using [the API Platform's Progressive Web App generator](../client-generator/index.md)
(that supports React and Vue.js) instead of this Angular v1 integration.

## Restangular
Expand Down Expand Up @@ -97,4 +97,4 @@ admin.addEntity(article);
nga.configure(admin);
```

You can look at what we have done as another example [api-platform/admin](https://github.com/api-platform/admin).
You can look at what we have done on [api-platform/admin](https://github.com/api-platform/admin).
2 changes: 1 addition & 1 deletion core/configuration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration

Here's the complete configuration of the Symfony bundle with including default values:
Here's the complete configuration of the Symfony bundle including default values:

```yaml
# api/config/packages/api_platform.yaml
Expand Down
18 changes: 9 additions & 9 deletions core/content-negotiation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ By default, only the [JSON-LD](https://json-ld.org) format is enabled. However A

The framework natively supports JSON-LD, GraphQL, JSONAPI, HAL, raw JSON, XML, YAML and CSV (YAML and CSV support is only available if you use Symfony 3.2+).

Both XML and JSON formats are experimental and there are no assurance that we will not break them.
Both XML and JSON formats are experimental and there is no assurance that we will not break them.

API Platform Core will automatically detect the best resolving format depending on:

Expand All @@ -28,7 +28,7 @@ Format | Format name |
[CSV](https://tools.ietf.org/html/rfc4180) | `csv` | `text/csv` | no
[HTML](https://whatwg.org/) (API docs) | `html` | `text/html` | no

If the client requested format is not specified (if it's not supported, it will throw an HTTP bad request error), the response format will be the first format defined in the `formats` configuration key (see below).
If the client's requested format is not specified (if it's not supported, it will throw an HTTP bad request error), the response format will be the first format defined in the `formats` configuration key (see below).
An example using the built-in XML support is available in [Behat specs](https://github.com/api-platform/core/blob/master/features/main/content_negotiation.feature).

The API Platform content negotiation system is extendable. Support for other formats can be added by [creating and registering appropriate encoders and, sometimes, normalizers](https://symfony.com/doc/current/serializer.html#adding-normalizers-and-encoders). Adding support for other
Expand Down Expand Up @@ -83,8 +83,8 @@ class Book
}
```

In the example above, `xml` or `jsonld` will be allowed and there is no need to specify the mime types as they are already defined in the configuration.
Additionally the `csv` format is added with the mime type `text/csv`.
In the example above, `xml` or `jsonld` will be allowed and there is no need to specify the MIME types as they are already defined in the configuration.
Additionally the `csv` format is added with the MIME type `text/csv`.

It is also important to notice that the usage of this attribute will override the formats defined in the configuration, therefore
this configuration might disable the `json` or the `html` on this resource for example.
Expand Down Expand Up @@ -151,17 +151,17 @@ resources:

## Registering a Custom Serializer

If you are adding support for a format not supported by default by API Platform nor by the Symfony Serializer Component,
you need to create custom encoder, decoder and eventually a normalizer and a denormalizer. Refer to the
If you are adding support for a format supported by default neither by API Platform nor by the Symfony Serializer Component,
you need to create a custom encoder, decoder and eventually a normalizer and a denormalizer. Refer to the
Symfony documentation to learn [how to create and register such classes](https://symfony.com/doc/current/cookbook/serializer.html#adding-normalizers-and-encoders).

API Platform Core will automatically call the serializer with your defined format name (`myformat` in previous examples)
as `format` parameter during the deserialization process. Then it will return the result to the client with the asked MIME
as `format` parameter during the deserialization process. It will then return the result to the client with the requested MIME
type using its built-in responder.

## Writing a Custom Normalizer

Using composition is the recommended way to implement a custom normalizer. You can use the following template to start with your
Using composition is the recommended way to implement a custom normalizer. You can use the following template to start your
own implementation of `CustomItemNormalizer`:

```yaml
Expand Down Expand Up @@ -220,7 +220,7 @@ final class CustomItemNormalizer implements NormalizerInterface, DenormalizerInt
```

For example if you want to make the `csv` format work for even complex entities with a lot of hierarchy, you have to
flatten or remove too complex relations:
flatten or remove overly complex relations:

```php
<?php
Expand Down
8 changes: 4 additions & 4 deletions core/data-persisters.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ the `@ApiResource` annotation). This instance contains data submitted by the cli
process](serialization.md).

A data persister using [Doctrine ORM](http://www.doctrine-project.org/projects/orm.html) is included with the library and
is enabled by default. It is able to persist and delete objects that are also mapped as [Doctrine entities](https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/basic-mapping.html).
is enabled by default. It is able to persist and delete objects that are also mapped as [Doctrine entities](https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/basic-mapping.html).
A [Doctrine MongoDB ODM](https://www.doctrine-project.org/projects/mongodb-odm.html) data persister is also included and can be enabled by following the [MongoDB documentation](mongodb.md).

However, you may want to:

* store data to other persistence layers (ElasticSearch, external web services...)
* store data to other persistence layers (Elasticsearch, external web services...)
* not publicly expose the internal model mapped with the database through the API
* use a separate model for [read operations](data-providers.md) and for updates by implementing patterns such as [CQRS](https://martinfowler.com/bliki/CQRS.html)

Custom data persisters can be used to do so. A project can include as many data persisters as it needs. The first able to
Custom data persisters can be used to do so. A project can include as many data persisters as needed. The first able to
persist data for a given resource will be used.

## Creating a Custom Data Persister
Expand All @@ -25,7 +25,7 @@ This interface defines only 3 methods:

* `persist`: to create or update the given data
* `remove`: to delete the given data
* `support`: checks whether the given data is supported by this data persister
* `support`: to check whether the given data is supported by this data persister

Here is an implementation example:

Expand Down
Loading