Skip to content

Commit

Permalink
Remove some operations
Browse files Browse the repository at this point in the history
Book can not be updated (no Patch)
Review can not be destroyed (no Destroy)

OpenAPI file is modified, two operations should be modified.
  • Loading branch information
Polo2 committed Sep 20, 2023
1 parent a386465 commit fc5df99
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 103 deletions.
16 changes: 15 additions & 1 deletion api/src/Entity/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@
// api/src/Entity/Book.php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\Put;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Post;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/** A book. */
#[ORM\Entity]
#[ApiResource]
#[ApiResource(
operations: [
new Get(),
new Put(),
new Delete(),
new GetCollection(),
new Post(),
]
)]

class Book
{
/** The ID of this book. */
Expand Down
16 changes: 15 additions & 1 deletion api/src/Entity/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@
// api/src/Entity/Review.php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\Put;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Post;
use ApiPlatform\Metadata\Patch;
use Doctrine\ORM\Mapping as ORM;
/** A review of a book. */
#[ORM\Entity]
#[ApiResource]
#[ApiResource(
operations: [
new Get(),
new Put(),
new GetCollection(),
new Post(),
new Patch(),
]
)]

class Review
{
/** The ID of this review. */
Expand Down
101 changes: 0 additions & 101 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,74 +377,6 @@
],
"deprecated": false
},
"patch": {
"operationId": "api_books_id_patch",
"tags": [
"Book"
],
"responses": {
"200": {
"description": "Book resource updated",
"content": {
"application/ld+json": {
"schema": {
"$ref": "#/components/schemas/Book.jsonld"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/Book"
}
},
"text/html": {
"schema": {
"$ref": "#/components/schemas/Book"
}
}
},
"links": {}
},
"400": {
"description": "Invalid input"
},
"404": {
"description": "Resource not found"
},
"422": {
"description": "Unprocessable entity"
}
},
"summary": "Updates the Book resource.",
"description": "Updates the Book resource.",
"parameters": [
{
"name": "id",
"in": "path",
"description": "Book identifier",
"required": true,
"deprecated": false,
"allowEmptyValue": false,
"schema": {
"type": "string"
},
"style": "simple",
"explode": false,
"allowReserved": false
}
],
"requestBody": {
"description": "The updated Book resource",
"content": {
"application/merge-patch+json": {
"schema": {
"$ref": "#/components/schemas/Book"
}
}
},
"required": true
},
"deprecated": false
},
"parameters": []
},
"/reviews": {
Expand Down Expand Up @@ -779,39 +711,6 @@
},
"deprecated": false
},
"delete": {
"operationId": "api_reviews_id_delete",
"tags": [
"Review"
],
"responses": {
"204": {
"description": "Review resource deleted"
},
"404": {
"description": "Resource not found"
}
},
"summary": "Removes the Review resource.",
"description": "Removes the Review resource.",
"parameters": [
{
"name": "id",
"in": "path",
"description": "Review identifier",
"required": true,
"deprecated": false,
"allowEmptyValue": false,
"schema": {
"type": "string"
},
"style": "simple",
"explode": false,
"allowReserved": false
}
],
"deprecated": false
},
"patch": {
"operationId": "api_reviews_id_patch",
"tags": [
Expand Down

0 comments on commit fc5df99

Please sign in to comment.