-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
[api-platform/core] prevent a deprecation warning and sync with upstream #1227
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
api_platform: | ||
title: Hello API Platform | ||
version: 1.0.0 | ||
# Good defaults for REST APIs | ||
defaults: | ||
stateless: true | ||
cache_headers: | ||
vary: ['Content-Type', 'Authorization', 'Origin'] | ||
extra_properties: | ||
standard_put: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
api_platform: | ||
resource: . | ||
type: api_platform | ||
prefix: /api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"bundles": { | ||
"ApiPlatform\\Symfony\\Bundle\\ApiPlatformBundle": ["all"] | ||
}, | ||
"copy-from-recipe": { | ||
"config/": "%CONFIG_DIR%/", | ||
"src/": "%SRC_DIR%/" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
* Your API is almost ready: | ||
1. Create your first API resource in <info>src/ApiResource</info>; | ||
dunglas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
2. Go to <info>/api</info> to browse your API | ||
|
||
* To enable the GraphQL support, run <comment>composer require webonyx/graphql-php</>, | ||
then browse <info>/api/graphql</info>. | ||
|
||
* <fg=blue>Read</> the documentation at <comment>https://api-platform.com/docs</> |
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This might be too opinionated? If you create a frontend on the same domain that logs in via cookies, then authentication wouldn't work, correct?
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.
Cookies can be used, but the session cannot. It's one of the mandatory constraints of the REST architecture.
IMHO it's not opinionated, it's just encouraging the correct way of creating REST APIs (and web applications in general).
Better let the user remove this line only if they know what they are doing (and by doing that they are probably doing a mistake) than having them creating non-stateless "REST" APIs.
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.
By the way since 6.3 stateless routes automatically enable stateless firewalls, so enabling this feature shouldn't be an issue even when using the default config of firewalls: https://symfony.com/doc/current/reference/configuration/security.html#stateless
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.
but if this is the good thing to do, why isn't it the default in ApiPlatform then ?
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.
@stof it is: https://github.com/api-platform/api-platform/blob/main/api/config/packages/api_platform.yaml
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.
I'm talking about the default in the Configuration class of the bundle (i.e. the actual default value of the setting), not the config provided in the API platform distribution.
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.
Because this would be a BC break. We'll maybe do that for API Platform 4 next year.