Skip to content
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

Published configuration and artisan command to create server does not play well together #3

Closed
jelhan opened this issue Jan 30, 2021 · 2 comments

Comments

@jelhan
Copy link

jelhan commented Jan 30, 2021

Published configuration includes a default server named v1:

'servers' => [
'v1' => \App\JsonApi\V1\Server::class,
],

But publishing the configuration does not create required files for that server. \App\JsonApi\V1\Server does not exist.

Artisan command to create the server fails because the server is already registered:

$ php artisan jsonapi:server v1
Server v1 is already registered in your JSON:API configuration.

Must remove the server registration in config/jsonapi.php before creating the required files with artisan command.

jsonapi:server artisan command does not register the created server in config/jsonapi.php. Registration deleted before running the command must be added again manually after running it.

Steps to reproduce

  1. Create a new laravel project with composer installer
    composer create-project laravel/laravel example-app
    cd example-app
  2. Install laravel-json-api/laravel (tested with v1.0.0-alpha.1)
    composer config minimum-stability alpha
    composer require laravel-json-api/laravel
    composer require --dev laravel-json-api/testing
  3. Publish configuration
    php artisan vendor:publish --provider="LaravelJsonApi\Laravel\ServiceProvider"
  4. Try to create server
    php artisan jsonapi:server v1
@lindyhopchris
Copy link
Contributor

Thanks for reporting! Yes, need to remove or comment-out the v1 example that's in the config file that gets published.

@jelhan
Copy link
Author

jelhan commented Jan 31, 2021

Thanks a lot for fixing it that quickly. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants