Skip to content

Feat : update doc for website V4 #338

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 3 commits into from
Nov 10, 2017
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
10 changes: 3 additions & 7 deletions admin/authentication-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Authentication can easily be handled when using the API Platform's admin library.
In the following section, we will assume [the API is secured using JWT](https://api-platform.com/docs/core/jwt), but the
process is similar for other authentication mechanisms. The `login_uri` is the full URI to the route specified by the `firewalls.login.json_login.check_path` config in the [JWT documentation](https://api-platform.com/docs/core/jwt).
process is similar for other authentication mechanisms. The `login_uri` is the full URI to the route specified by the `firewalls.login.json_login.check_path` config in the [JWT documentation](https://api-platform.com/docs/core/jwt).

The first step is to create a client to handle the authentication process:

Expand All @@ -11,7 +11,7 @@ The first step is to create a client to handle the authentication process:
import { AUTH_LOGIN, AUTH_LOGOUT, AUTH_ERROR, AUTH_CHECK } from 'admin-on-rest';

// Change this to be your own login check route.
const login_uri = 'https://demo.api-platform.com/login_check';
const login_uri = 'https://demo.api-platform.com/login_check';

export default (type, params) => {
switch (type) {
Expand Down Expand Up @@ -47,7 +47,7 @@ export default (type, params) => {

case AUTH_CHECK:
return localStorage.getItem('token') ? Promise.resolve() : Promise.reject();

default:
return Promise.resolve();
}
Expand Down Expand Up @@ -82,7 +82,3 @@ export default class extends Component {

Refer to [the chapter dedicated to authentication in the Admin On Rest documentation](https://marmelab.com/admin-on-rest/Authentication.html)
for more information.

Previous chapter: [Getting Started](getting-started.md)

Next chapter: [Handling Relations to Collections](handling-relations-to-collections.md)
8 changes: 2 additions & 6 deletions admin/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Then, create a new React application for your admin:
$ create-react-app my-admin

React and React DOM will be directly provided as dependencies of Admin On REST. As having different versions of React
causes issues, remove `react` and `react-dom` from the `dependencies` section of the generated `package.json` file:
causes issues, remove `react` and `react-dom` from the `dependencies` section of the generated `package.json` file:

```patch
- "react": "^15.6.1",
Expand Down Expand Up @@ -157,7 +157,7 @@ export default (props) => (
__Note__: In this example, we choose to send the file via a multi-part form data, but you are totally free to use another solution (like `base64`). But keep in mind that multi-part form data is the most efficient solution.

### Using a Custom Validation Function or Inject Custom Props

You can use `fieldProps` and `inputProps` to respectively inject custom properties to fields and inputs generated by API
Platform Admin. This is particularly useful to add custom validation rules:

Expand Down Expand Up @@ -190,7 +190,3 @@ export default class extends Component {
}
}
```

Previous chapter: [Introduction](index.md)

Next chapter: [Authentication Support](authentication-support.md)
4 changes: 0 additions & 4 deletions admin/handling-relations-to-collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,3 @@ Then edit the configuration of API Platform Admin to pass a `filterToQuery` prop
```

The autocomplete field should now work properly!

Previous chapter: [Authentication Support](authentication-support.md)

Next chapter: [Client Generator: Introduction](../client-generator/index.md)
4 changes: 0 additions & 4 deletions admin/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,3 @@ You can also customize all screens by using Admin On Rest components and even ra
* 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)
* **100% customizable**

Previous chapter: [Schema Generator: configuration](../schema-generator/configuration.md)

Next chapter: [Getting Started](getting-started.md)
4 changes: 0 additions & 4 deletions client-generator/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,3 @@ The generator works especially well with APIs built with the [API Platform](http
* The generated HTML is compatible with [Bootstrap](https://getbootstrap.com/) and includes mandatory classes
* The generated HTML code is accessible to people with disabilities ([ARIA](https://www.w3.org/WAI/intro/aria) support)
* The Redux and the React Router configuration is also generated

Previous chapter: [Admin: Handling Relations to Collections](../admin/handling-relations-to-collections.md)

Next chapter: [React generator](react.md)
8 changes: 2 additions & 6 deletions client-generator/react.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Bootstrap 3 - last release 0.1.15
```html
<!-- ... -->
<title>React App</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<!-- ... -->
Expand All @@ -29,7 +29,7 @@ Bootstrap 4 - from release 0.1.16
```html
<!-- ... -->
<title>React App</title>

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
</head>
Expand Down Expand Up @@ -81,7 +81,3 @@ ReactDom.render(

registerServiceWorker();
```

Previous chapter: [Introduction](index.md)

Next chapter: [Vue.js generator](vuejs.md)
4 changes: 0 additions & 4 deletions client-generator/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,3 @@ details:
Check access to the specified url, in this case `https://demo.api-platform.com/contexts/Entrypoint`, use curl to check
access and the response `curl https://demo.api-platform.com/contexts/Entrypoint`. In the above case an "Access Denied"
message in JSON format was being returned.

Previous chapter: [Vue.js generator](vuejs.md)

Next chapter: [Deployment: Introduction](../deployment/index.md)
5 changes: 1 addition & 4 deletions client-generator/vuejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Create a Vue.js application using [vue-cli](https://github.com/vuejs/vue-cli):

Install Vue Router, Vuex and babel-plugin-transform-builtin-extend (to allow extending bultin types like Error and Array):

$ yarn add vue-router vuex babel-plugin-transform-builtin-extend babel-preset-es2015 babel-preset-stage-2
$ yarn add vue-router vuex babel-plugin-transform-builtin-extend babel-preset-es2015 babel-preset-stage-2

Install the generator globally:

Expand Down Expand Up @@ -100,6 +100,3 @@ Replace the `App.vue` file with the following :
</div>
</template>
```
Previous chapter: [React generator](react.md)

Next chapter: [Troubleshooting](troubleshooting.md)
4 changes: 0 additions & 4 deletions core/angularjs-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,3 @@ nga.configure(admin);
```

You can look at what we have done as another exemple [api-platform/admin](https://github.com/api-platform/admin).

Previous chapter: [NelmioApiDocBundle integration](nelmio-api-doc.md)

Next chapter: [Schema Generator: Introduction](../schema-generator/index.md)
4 changes: 0 additions & 4 deletions core/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,3 @@ api_platform:

# ...
```

Previous chapter: [Getting Started](getting-started.md)

Next chapter: [Operations](operations.md)
6 changes: 1 addition & 5 deletions core/content-negotiation.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,7 @@ class CustomItemNormalizer implements NormalizerInterface, DenormalizerInterface

return $result;
}

// ...
}
```

Previous chapter: [The Serialization Process](core/serialization.md)

Next chapter: [Validation](core/validation.md)
4 changes: 0 additions & 4 deletions core/data-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,3 @@ services:
'AppBundle\DataProvider\BlogPostItemDataProvider':
tags: [ 'api_platform.item_data_provider' ]
```

Previous chapter: [The Event System](core/events.md)

Next chapter: [Extensions](core/extensions.md)
4 changes: 0 additions & 4 deletions core/default-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,3 @@ class Book
public $author;
}
```

Previous chapter: [Operations](operations.md)

Next chapter: [Filters](filters.md)
4 changes: 0 additions & 4 deletions core/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,3 @@ Constant | Event | Priority |
`POST_WRITE` | `kernel.view` | 31 |
`PRE_RESPOND` | `kernel.view` | 9 |
`POST_RESPOND` | `kernel.response` | 0 |

Previous chapter: [Pagination](pagination.md)

Next chapter: [Data Providers](core/data-providers.md)
8 changes: 2 additions & 6 deletions core/extending-jsonld-context.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Extending JSON-LD context

API Platform Core provides the possibility to extend the JSON-LD context of properties. This allows you to describe JSON-LD
API Platform Core provides the possibility to extend the JSON-LD context of properties. This allows you to describe JSON-LD
typed values, inverse properties using the `@reverse` keyword and you can even overwrite the `@id` property this way. Everything you define
within the following annotation, will be passed to the context, that provides a generic way to extend the context.

Expand All @@ -23,7 +23,7 @@ class Book
/**
* ...
* @ApiProperty(
* iri="http://schema.org/name",
* iri="http://schema.org/name",
* attributes={
* "jsonld_context"={
* "@id"="http://yourcustomid.com",
Expand Down Expand Up @@ -62,7 +62,3 @@ The generated context will now have your custom attributes set:
```

Note that you do not have to provide the `@id` attribute, if you do not provide an `@id` attribute, the value from `iri` will be taken.

Previous chapter: [Using External Vocabularies](external-vocabularies.md)

Next chapter: [FOSUserBundle Integration](core/fosuser-bundle.md)
4 changes: 0 additions & 4 deletions core/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,3 @@ security:
- { path: ^/offers, roles: IS_AUTHENTICATED_FULLY }
- { path: ^/users, roles: IS_AUTHENTICATED_FULLY }
```

Previous chapter: [Extensions](core/extensions.md)

Next chapter: [Security](core/security.md)
4 changes: 0 additions & 4 deletions core/external-vocabularies.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,3 @@ The generated JSON for products and the related context document will now use ex
```

An extended list of existing open vocabularies is available on [the Linked Open Vocabularies (LOV) database](http://lov.okfn.org/dataset/lov/).

Previous chapter: [Content Negotiation](content-negotiation.md)

Next chapter: [Extending JSON-LD context](extending-jsonld-context.md)
4 changes: 0 additions & 4 deletions core/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,3 @@ services:
'AppBundle\Filter\CustomOrderFilter':
tags: [ 'api_platform.filter' ]
```

Previous chapter: [Operations](operations.md)

Next chapter: [The Serialization Process](serialization.md)
4 changes: 0 additions & 4 deletions core/form-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,3 @@ class AppBundle extends Bundle
}

```

Previous chapter: [Operation Path Naming](operation-path-naming.md)

Next chapter: [Using External Vocabularies](core/external-vocabularies.md)
4 changes: 0 additions & 4 deletions core/fosuser-bundle.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,3 @@ class User extends BaseUser
}
}
```

Previous chapter: [Extending the JSON-LD context](core/extending-jsonld-context.md)

Next chapter: [NelmioApiDocBundle integration](core/nelmio-api-doc.md)
8 changes: 2 additions & 6 deletions core/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Product // The class name will be used to name exposed resources
* @Assert\NotBlank
*/
public $name;

// Notice the "cascade" option below, this is mandatory if you want Doctrine to automatically persist the related entity
/**
* @ORM\OneToMany(targetEntity="Offer", mappedBy="product", cascade={"persist"})
Expand All @@ -95,7 +95,7 @@ class Product // The class name will be used to name exposed resources

public function __construct()
{
$this->offers = new ArrayCollection(); // Initialize $offers as an Doctrine collection
$this->offers = new ArrayCollection(); // Initialize $offers as an Doctrine collection
}

// Adding both an adder and a remover as well as updating the reverse relation are mandatory
Expand Down Expand Up @@ -229,7 +229,3 @@ Run the Symfony app (`bin/console server:run`) and browse the API entrypoint at
Interact with the API using a REST client (we recommend [Postman](https://www.getpostman.com/)) or an Hydra aware application
(you should give [Hydra Console](https://github.com/lanthaler/HydraConsole) a try). Take
a look at the usage examples in [the `features` directory](https://github.com/api-platform/api-platform/tree/master/features).

Previous chapter: [Introduction](index.md)

Next chapter: [Configuration](configuration.md)
4 changes: 0 additions & 4 deletions core/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,3 @@ contains a working app covering all features of the library.
* (french) [Tour d'horizon des changements dans API Platform v2](https://les-tilleuls.coop/fr/blog/article/la-premiere-alpha-d-api-platform-2-0-est-disponible)
* (french) [A la découverte de API Platform (Symfony Live Paris 2015)](https://dunglas.fr/2015/04/mes-slides-du-symfony-live-2015-a-la-decouverte-de-api-platform/)
* (french) [API-first et Linked Data avec Symfony (sfPot Lille 2015)](https://les-tilleuls.coop/slides/dunglas/slides-sfPot-2015-01-15/#/)

Previous chapter: [API Platform Distribution: Testing and Specifying the API](../distribution/testing.md)

Next chapter: [Getting Started](getting-started.md)
6 changes: 1 addition & 5 deletions core/jwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ security:
providers:
fos_userbundle:
id: fos_user.user_provider.username

firewalls:
login:
pattern: ^/login
Expand Down Expand Up @@ -157,7 +157,3 @@ default:
```

Finally, mark your scenarios with the `@login` annotation to automatically add a valid `Authorization` header, and with `@logout` to be sure to destroy the token after this scenario.

Previous chapter: [FOSUserBundle Integration](fosuser-bundle.md)

Next chapter: [NelmioApiDocBundle integration](nelmio-api-doc.md)
4 changes: 0 additions & 4 deletions core/nelmio-api-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,3 @@ nelmio_api_doc:
Please note that NelmioApiDocBundle has a sandbox limitation where you cannot pass a JSON array as parameter, so you cannot
use it to deserialize nested objects.
Previous chapter: [FOSUserBundle Integration](core/fosuser-bundle.md)
Next chapter: [AngularJS Integration](angularjs-integration.md)
4 changes: 0 additions & 4 deletions core/operation-path-naming.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,3 @@ services:
api_platform:
default_operation_path_resolver: 'AppBundle\PathResolver\NoSeparatorsOperationPathResolver'
```

Previous chapter: [Performance](performance.md)

Next chapter: [Accept application/x-www-form-urlencoded Form Data](form-data.md)
5 changes: 0 additions & 5 deletions core/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,3 @@ book_special:
_api_resource_class: 'AppBundle\Entity\Book'
_api_item_operation_name: 'special'
```
Previous chapter: [Configuration](configuration.md)
Next chapter: [Overriding Default Order](default-order.md)
4 changes: 0 additions & 4 deletions core/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,3 @@ class Book
// ...
}
```

Previous chapter: [Validation](validation.md)

Next chapter: [The Event System](events.md)
4 changes: 0 additions & 4 deletions core/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,3 @@ api_platform:
```

The whole configuration seen before will no longer work and Doctrine will recover its default behavior.

Previous chapter: [Swagger Support](core/swagger.md)

Next chapter: [Operation Path Naming](operation-path-naming.md)
8 changes: 2 additions & 6 deletions core/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ class Book
* @ORM\GeneratedValue(strategy="AUTO")
*/
public $id;

/**
* @var string The title
*
* @ORM\Column
* @Assert\NotBlank
*/
public $title;

/**
* @ORM\Column
*/
Expand All @@ -65,7 +65,3 @@ that a user could not create a book.

It is also possible to use the [event system](events.md) for more advanced logic or even [custom actions](operations.md#creating-custom-operations-and-controllers)
if you really need to.

Previous chapter: [JWT Authentification](core/jwt.md)

Next chapter: [Swagger Support](core/swagger.md)
4 changes: 0 additions & 4 deletions core/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,3 @@ class Book
// ...
}
```

Previous chapter: [Filters](filters.md)

Next chapter: [Content Negotiation](content-negotiation.md)
Loading