Skip to content

Commit

Permalink
feat: update documentation following last changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek- committed Dec 11, 2021
1 parent 6add5a8 commit b981856
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.8.0] 2020-11-26
## [0.9.0] 2021-12-10
### Added
- Compatibility with PHP 8.1

### Changed
- Fix #54 to be able to build a melodiia application on any PAAS service

## [0.8.0] 2021-11-26
### Added
- Add json-api header in responses

Expand Down
1 change: 1 addition & 0 deletions docs/config-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ melodiia:
# Define as much APIs you want here.
main:
base_path: /api/v1
openapi_path: /path/to/your/openapi/doc.yaml
pagination:
# Using this query attribute you can change the max per page
max_per_page_attribute: max_per_page
Expand Down
18 changes: 15 additions & 3 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,23 @@ to configure the OpenAPI documentation in a good way was a serious pain and was
But it comes with some help to build your documentation:
1. Run `bin/console assets:insall`
2. Create a file `documentation.yml` (the `config` folder seems like a good location)
2. Add the following routing to your configuration
3. Add your documentation file in the global melodiia configuration and configure your documentation route

```yaml
# The documentation should be available only in dev environment
# routing_dev.yaml
# /config/packages/melodiia.yaml
melodiia:
apis:
main:
# Required all the time! Do not forget this!
base_path: /api/v1
# This is what we are looking for here:
openapi_path: /path/to/your/openapi/doc.yaml
```

```yaml
# The documentation should be available only in dev environment in some cases
# /config/routing_dev.yaml
documentation:
path: /documentation
controller: 'melodiia.documentation'
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/MelodiiaExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function load(array $configs, ContainerBuilder $container)
// This is just a helpful layer in case some dependency is missing, because twig is optional.
foreach ($config['api'] as $endpoint) {
if (!empty($endpoint[MelodiiaConfiguration::CONFIGURATION_OPENAPI_PATH])) {
throw new DependencyMissingException('You specified a documentation path but twig is not activated. Melodiia will not be able to render your documentation.');
throw new DependencyMissingException('You specified a documentation path but twig is not installed. Melodiia will not be able to render your documentation.');
}
}
}
Expand Down

0 comments on commit b981856

Please sign in to comment.