Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openapi_jsonapi
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
openapi_jsonapi
Merge requests
!6
Issue
#3079209
Hide POST, PUT, and DELETE endpoints when JSON:API is configured to be read-only
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3079209
Hide POST, PUT, and DELETE endpoints when JSON:API is configured to be read-only
issue/openapi_jsonapi-3079209:3079209-hide-post-put
into
3.x
Overview
0
Commits
4
Pipelines
2
Changes
20
Open
Vitalii Podoba
requested to merge
issue/openapi_jsonapi-3079209:3079209-hide-post-put
into
3.x
3 years ago
Overview
0
Commits
4
Pipelines
2
Changes
20
Expand
https://www.drupal.org/project/openapi_jsonapi/issues/3079209
Closes
#3079209
0
0
Merge request reports
Compare
3.x
version 3
b99f8fd3
8 months ago
version 2
d6e167e6
3 years ago
version 1
d6e167e6
3 years ago
3.x (HEAD)
and
latest version
latest version
17b8efa9
4 commits,
8 months ago
version 3
b99f8fd3
3 commits,
8 months ago
version 2
d6e167e6
2 commits,
3 years ago
version 1
d6e167e6
7 commits,
3 years ago
20 files
+
9129
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
20
Search (e.g. *.vue) (Ctrl+P)
src/Plugin/openapi/OpenApiGenerator/JsonApiGenerator.php
+
11
−
0
Options
@@ -220,7 +220,18 @@ class JsonApiGenerator extends OpenApiGeneratorBase {
public
function
getPaths
()
{
$routes
=
$this
->
getJsonApiRoutes
();
$api_paths
=
[];
$read_only_mode_is_enabled
=
$this
->
configFactory
->
get
(
'jsonapi.settings'
)
->
get
(
'read_only'
);
$read_only_methods
=
[
'GET'
,
'HEAD'
,
'OPTIONS'
,
'TRACE'
];
foreach
(
$routes
as
$route_name
=>
$route
)
{
if
(
$read_only_mode_is_enabled
===
TRUE
)
{
$supported_methods
=
$route
->
getMethods
();
assert
(
count
(
$supported_methods
)
>
0
,
'JSON:API routes always have a method specified.'
);
if
(
!
empty
(
array_diff
(
$supported_methods
,
$read_only_methods
)))
{
continue
;
}
}
/** @var \Drupal\jsonapi\ResourceType\ResourceType $resource_type */
$resource_type
=
$this
->
getResourceType
(
$route_name
,
$route
);
if
(
!
$resource_type
instanceof
ResourceType
)
{
Loading