-
-
Notifications
You must be signed in to change notification settings - Fork 497
Add a recipe to install API Platform #21
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
Conversation
serializer: | ||
enabled: true | ||
property_info: | ||
enabled: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should not be needed. If API platform requires serializer and property_info, they will/should be enabled automatically.
@dunglas You can now easily test PRs :) Each PR has its own Flex server. So to test this PR for instance, define FLEX_ENDPOINT=https://pr21.flex.symfony.com/ composer req some/package |
@fabpot could it be reported on the github repo using the github deployment API so that contributors know when the updated deployment is available and don't have to guess the URL ? It would make it easier (not critical currently as the core team can remember the convention, but much easier once the repo becomes public) |
@stof Right now, Symfony Flex creates a commit status as you can see here with the link begin available on "Details". Is that what you're looking for? |
Well, as green status are collapsed by default, people might not notice that it includes info about a deployment. The commit status is good to make the PR unmergeable when recipes are invalid. (btw, could the validator be part of the repo like in https://github.com/FriendsOfPHP/security-advisories to allow running it locally or is it too much work ?). The deployment API on the other hand would make it easy to access the temporary deployment. |
@stof Done :) For the validator, it's part of the server, written in Go, so not easy to add to the repository. |
@dunglas Have you tested your recipe? Does it work well? I've tried and everything installs correctly at least :) |
The flex part works great. But I'll need to make some minor changes to do to the API Platform Bundle's configuration to allow it to work without the full stack framework installed. For now I've to do The only annoying thing related to Flex is that templates provided by bundles are not discovered automatically:
|
Btw, what is the preferred way to encourage the user to install some extra packages? For instance API Platform works with a minimal setup but the user will miss most interesting features like the Doctrine ORM integration and the UI. Should I add a post install message like "Type |
@dunglas you would need to use the |
Then fine. Having the CI can be enough if the report is clear enough (and feedback is fast on push) |
@dunglas You should really get rid of the For optional, but interesting packages, I think adding a |
Minor issues (including the template notation) fixed in API Platform and pack created.
|
Works like a charm! To test it:
Then, create an API for the "Hello" resource class: <?php
// src/Entity/Hello.php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Say Hello.
*
* @ORM\Entity
* @ApiResource
*/
class Hello
{
/**
* @var int The id
*
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
public $id;
/**
* @var string A name
*
* @ORM\Column
* @Assert\NotBlank
*/
public $name;
} And finally create the related schema:
Go to |
That's wonderful! I like it a lot. No configuration, nothing more than pure business logic. |
@@ -0,0 +1,3 @@ | |||
{ | |||
"aliases": ["api", "api-platform"] | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only change I would do is that I would not use master
as min-supported version. You want this to be compatible with default composer settings in the future, i.e. having a stable release of the api-pack. So you should already add a branch alias for your master branch, and use 1.0
as version in flex instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Thank you @dunglas. |
But I've no idea of how to test it 😅