mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Fixed API Platform deprecations
This commit is contained in:
parent
d0a5b4dcd7
commit
717a9fb0a3
18 changed files with 72 additions and 29 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.8.2
|
||||
1.9.0-dev
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
"symfony/runtime": "6.3.*",
|
||||
"symfony/security-bundle": "6.3.*",
|
||||
"symfony/serializer": "6.3.*",
|
||||
"symfony/string": "6.3.*",
|
||||
"symfony/translation": "6.3.*",
|
||||
"symfony/twig-bundle": "6.3.*",
|
||||
"symfony/ux-translator": "^2.10",
|
||||
|
|
2
composer.lock
generated
2
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "a3d850bada24e7349d2181693a50c637",
|
||||
"content-hash": "258be26a5e5d25abc80062849a2a948e",
|
||||
"packages": [
|
||||
{
|
||||
"name": "api-platform/core",
|
||||
|
|
|
@ -8,6 +8,8 @@ api_platform:
|
|||
# eager_loading:
|
||||
# max_joins: 100
|
||||
|
||||
keep_legacy_inflector: false
|
||||
|
||||
swagger:
|
||||
api_keys:
|
||||
# overridden in OpenApiFactoryDecorator
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace App\ApiResource;
|
|||
use ApiPlatform\Metadata\ApiFilter;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\State\PartDBInfoProvider;
|
||||
|
||||
|
@ -35,7 +36,7 @@ use App\State\PartDBInfoProvider;
|
|||
#[ApiResource(
|
||||
uriTemplate: '/info.{_format}',
|
||||
description: 'Basic information about Part-DB like version, title, etc.',
|
||||
operations: [new Get(openapiContext: ['summary' => 'Get basic information about the installed Part-DB instance.'])],
|
||||
operations: [new Get(openapi: new Operation(summary: 'Get basic information about the installed Part-DB instance.'))],
|
||||
provider: PartDBInfoProvider::class
|
||||
)]
|
||||
#[ApiFilter(PropertyFilter::class)]
|
||||
|
|
|
@ -33,6 +33,7 @@ use ApiPlatform\Metadata\GetCollection;
|
|||
use ApiPlatform\Metadata\Link;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\ApiPlatform\Filter\LikeFilter;
|
||||
use App\Entity\Parts\Footprint;
|
||||
|
@ -70,7 +71,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
#[ApiResource(
|
||||
uriTemplate: '/attachment_types/{id}/children.{_format}',
|
||||
operations: [
|
||||
new GetCollection(openapiContext: ['summary' => 'Retrieves the children elements of an attachment type.'],
|
||||
new GetCollection(openapi: new Operation(summary: 'Retrieves the children elements of an attachment type.'),
|
||||
security: 'is_granted("@attachment_types.read")')
|
||||
],
|
||||
uriVariables: [
|
||||
|
|
|
@ -34,6 +34,7 @@ use ApiPlatform\Metadata\GetCollection;
|
|||
use ApiPlatform\Metadata\Link;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\ApiPlatform\Filter\LikeFilter;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
|
@ -72,8 +73,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
#[ApiResource(
|
||||
uriTemplate: '/categories/{id}/children.{_format}',
|
||||
operations: [
|
||||
new GetCollection(openapiContext: ['summary' => 'Retrieves the children elements of a category.'],
|
||||
security: 'is_granted("@categories.read")')
|
||||
new GetCollection(
|
||||
openapi: new Operation(summary: 'Retrieves the children elements of a category.'),
|
||||
security: 'is_granted("@categories.read")'
|
||||
)
|
||||
],
|
||||
uriVariables: [
|
||||
'id' => new Link(fromProperty: 'children', fromClass: Category::class)
|
||||
|
|
|
@ -34,6 +34,7 @@ use ApiPlatform\Metadata\GetCollection;
|
|||
use ApiPlatform\Metadata\Link;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\ApiPlatform\Filter\LikeFilter;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
|
@ -72,8 +73,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
#[ApiResource(
|
||||
uriTemplate: '/footprints/{id}/children.{_format}',
|
||||
operations: [
|
||||
new GetCollection(openapiContext: ['summary' => 'Retrieves the children elements of a footprint.'],
|
||||
security: 'is_granted("@footprints.read")')
|
||||
new GetCollection(
|
||||
openapi: new Operation(summary: 'Retrieves the children elements of a footprint.'),
|
||||
security: 'is_granted("@footprints.read")'
|
||||
)
|
||||
],
|
||||
uriVariables: [
|
||||
'id' => new Link(fromProperty: 'children', fromClass: Footprint::class)
|
||||
|
|
|
@ -33,6 +33,7 @@ use ApiPlatform\Metadata\GetCollection;
|
|||
use ApiPlatform\Metadata\Link;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\ApiPlatform\Filter\LikeFilter;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
|
@ -71,8 +72,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
#[ApiResource(
|
||||
uriTemplate: '/manufacturers/{id}/children.{_format}',
|
||||
operations: [
|
||||
new GetCollection(openapiContext: ['summary' => 'Retrieves the children elements of a manufacturer.'],
|
||||
security: 'is_granted("@manufacturers.read")')
|
||||
new GetCollection(
|
||||
openapi: new Operation(summary: 'Retrieves the children elements of a manufacturer.'),
|
||||
security: 'is_granted("@manufacturers.read")'
|
||||
)
|
||||
],
|
||||
uriVariables: [
|
||||
'id' => new Link(fromProperty: 'children', fromClass: Manufacturer::class)
|
||||
|
|
|
@ -33,6 +33,7 @@ use ApiPlatform\Metadata\GetCollection;
|
|||
use ApiPlatform\Metadata\Link;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\ApiPlatform\Filter\LikeFilter;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
|
@ -75,8 +76,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
#[ApiResource(
|
||||
uriTemplate: '/footprints/{id}/children.{_format}',
|
||||
operations: [
|
||||
new GetCollection(openapiContext: ['summary' => 'Retrieves the children elements of a MeasurementUnit.'],
|
||||
security: 'is_granted("@measurement_units.read")')
|
||||
new GetCollection(
|
||||
openapi: new Operation(summary: 'Retrieves the children elements of a MeasurementUnit.'),
|
||||
security: 'is_granted("@measurement_units.read")'
|
||||
)
|
||||
],
|
||||
uriVariables: [
|
||||
'id' => new Link(fromProperty: 'children', fromClass: MeasurementUnit::class)
|
||||
|
|
|
@ -33,6 +33,7 @@ use ApiPlatform\Metadata\GetCollection;
|
|||
use ApiPlatform\Metadata\Link;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\ApiPlatform\Filter\LikeFilter;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
|
@ -71,8 +72,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
#[ApiResource(
|
||||
uriTemplate: '/storage_locations/{id}/children.{_format}',
|
||||
operations: [
|
||||
new GetCollection(openapiContext: ['summary' => 'Retrieves the children elements of a storage location.'],
|
||||
security: 'is_granted("@storelocations.read")')
|
||||
new GetCollection(
|
||||
openapi: new Operation(summary: 'Retrieves the children elements of a storage location.'),
|
||||
security: 'is_granted("@storelocations.read")'
|
||||
)
|
||||
],
|
||||
uriVariables: [
|
||||
'id' => new Link(fromProperty: 'children', fromClass: Manufacturer::class)
|
||||
|
|
|
@ -33,6 +33,7 @@ use ApiPlatform\Metadata\GetCollection;
|
|||
use ApiPlatform\Metadata\Link;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\ApiPlatform\Filter\LikeFilter;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
|
@ -75,8 +76,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
)]
|
||||
#[ApiResource(
|
||||
uriTemplate: '/suppliers/{id}/children.{_format}',
|
||||
operations: [new GetCollection(openapiContext: ['summary' => 'Retrieves the children elements of a supplier'],
|
||||
security: 'is_granted("@manufacturers.read")')],
|
||||
operations: [new GetCollection(
|
||||
openapi: new Operation(summary: 'Retrieves the children elements of a supplier.'),
|
||||
security: 'is_granted("@manufacturers.read")'
|
||||
)],
|
||||
uriVariables: [
|
||||
'id' => new Link(fromClass: Supplier::class, fromProperty: 'children')
|
||||
],
|
||||
|
|
|
@ -33,6 +33,7 @@ use ApiPlatform\Metadata\GetCollection;
|
|||
use ApiPlatform\Metadata\Link;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\ApiPlatform\Filter\LikeFilter;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
|
@ -75,8 +76,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
#[ApiResource(
|
||||
uriTemplate: '/currencies/{id}/children.{_format}',
|
||||
operations: [
|
||||
new GetCollection(openapiContext: ['summary' => 'Retrieves the children elements of a currency.'],
|
||||
security: 'is_granted("@currencies.read")')
|
||||
new GetCollection(
|
||||
openapi: new Operation(summary: 'Retrieves the children elements of a currency.'),
|
||||
security: 'is_granted("@currencies.read")'
|
||||
)
|
||||
],
|
||||
uriVariables: [
|
||||
'id' => new Link(fromProperty: 'children', fromClass: Currency::class)
|
||||
|
|
|
@ -34,6 +34,7 @@ use ApiPlatform\Metadata\GetCollection;
|
|||
use ApiPlatform\Metadata\Link;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\ApiPlatform\Filter\LikeFilter;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
|
@ -73,8 +74,10 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
#[ApiResource(
|
||||
uriTemplate: '/parts/{id}/orderdetails.{_format}',
|
||||
operations: [
|
||||
new GetCollection(openapiContext: ['summary' => 'Retrieves the orderdetails of a part.'],
|
||||
security: 'is_granted("@parts.read")')
|
||||
new GetCollection(
|
||||
openapi: new Operation(summary: 'Retrieves the orderdetails of a part.'),
|
||||
security: 'is_granted("@parts.read")'
|
||||
)
|
||||
],
|
||||
uriVariables: [
|
||||
'id' => new Link(toProperty: 'part', fromClass: Part::class)
|
||||
|
|
|
@ -33,6 +33,7 @@ use ApiPlatform\Metadata\GetCollection;
|
|||
use ApiPlatform\Metadata\Link;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\ApiPlatform\Filter\LikeFilter;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
|
@ -74,8 +75,10 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||
#[ApiResource(
|
||||
uriTemplate: '/projects/{id}/children.{_format}',
|
||||
operations: [
|
||||
new GetCollection(openapiContext: ['summary' => 'Retrieves the children elements of a project.'],
|
||||
security: 'is_granted("@projects.read")')
|
||||
new GetCollection(
|
||||
openapi: new Operation(summary: 'Retrieves the children elements of a project.'),
|
||||
security: 'is_granted("@projects.read")'
|
||||
)
|
||||
],
|
||||
uriVariables: [
|
||||
'id' => new Link(fromProperty: 'children', fromClass: Project::class)
|
||||
|
|
|
@ -32,6 +32,7 @@ use ApiPlatform\Metadata\GetCollection;
|
|||
use ApiPlatform\Metadata\Link;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\ApiPlatform\Filter\LikeFilter;
|
||||
use App\Validator\UniqueValidatableInterface;
|
||||
|
@ -69,8 +70,10 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||
#[ApiResource(
|
||||
uriTemplate: '/projects/{id}/bom.{_format}',
|
||||
operations: [
|
||||
new GetCollection(openapiContext: ['summary' => 'Retrieves the BOM entries of the given project.'],
|
||||
security: 'is_granted("@projects.read")')
|
||||
new GetCollection(
|
||||
openapi: new Operation(summary: 'Retrieves the BOM entries of the given project.'),
|
||||
security: 'is_granted("@projects.read")'
|
||||
)
|
||||
],
|
||||
uriVariables: [
|
||||
'id' => new Link(fromProperty: 'bom_entries', fromClass: Project::class)
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace App\Entity\UserSystem;
|
|||
use ApiPlatform\Metadata\ApiFilter;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
|
@ -46,7 +47,9 @@ use Symfony\Component\Validator\Constraints\NotBlank;
|
|||
#[ApiResource(
|
||||
uriTemplate: '/tokens/current.{_format}',
|
||||
description: 'A token used to authenticate API requests.',
|
||||
operations: [new Get(openapiContext: ['summary' => 'Get information about the API token that is currently used.'])],
|
||||
operations: [new Get(
|
||||
openapi: new Operation(summary: 'Get information about the API token that is currently used.'),
|
||||
)],
|
||||
normalizationContext: ['groups' => ['token:read', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
|
||||
provider: CurrentApiTokenProvider::class,
|
||||
)]
|
||||
|
|
|
@ -31,6 +31,7 @@ use ApiPlatform\Metadata\ApiResource;
|
|||
use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use ApiPlatform\OpenApi\Model\Operation;
|
||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||
use App\ApiPlatform\Filter\LikeFilter;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
|
@ -86,10 +87,14 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface
|
|||
#[ApiResource(
|
||||
shortName: 'User',
|
||||
operations: [
|
||||
new Get(openapiContext: ['summary' => 'Get a specific user.'],
|
||||
security: 'is_granted("read", object)'),
|
||||
new GetCollection(openapiContext: ['summary' => 'Get all users defined in the system.'],
|
||||
security: 'is_granted("@users.read")'),
|
||||
new Get(
|
||||
openapi: new Operation(summary: 'Get information about the current user.'),
|
||||
security: 'is_granted("read", object)'
|
||||
),
|
||||
new GetCollection(
|
||||
openapi: new Operation(summary: 'Get all users defined in the system.'),
|
||||
security: 'is_granted("@users.read")'
|
||||
),
|
||||
],
|
||||
normalizationContext: ['groups' => ['user:read'], 'openapi_definition_name' => 'Read'],
|
||||
)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue