1
Hardware
Manuel Aranda Rosales edited this page 2024-08-02 09:11:00 +02:00
Documentación - API ogCore
Select Language / Seleccionar Idioma
English
Table of Contents
Introduction
This documentation describes the configuration of API Platform in a Symfony project. It details the resources, operations, and entity properties exposed through the API.
Configuration
API configuration is done in Symfony configuration files, usually in the config/packages/api_platform.yaml
file.
resources:
App\Entity\Hardware:
processor: App\State\Processor\HardwareProcessor
input: App\Dto\Input\HardwareInput
output: App\Dto\Output\HardwareOutput
normalizationContext:
groups: ['default', 'hardware:read']
denormalizationContext:
groups: ['hardware:write']
operations:
ApiPlatform\Metadata\GetCollection:
provider: App\State\Provider\HardwareProvider
filters:
- 'api_platform.filter.hardware.order'
- 'api_platform.filter.hardware.search'
ApiPlatform\Metadata\Get:
provider: App\State\Provider\HardwareProvider
ApiPlatform\Metadata\Put:
provider: App\State\Provider\HardwareProvider
ApiPlatform\Metadata\Patch:
provider: App\State\Provider\HardwareProvider
ApiPlatform\Metadata\Post: ~
ApiPlatform\Metadata\Delete: ~
properties:
App\Entity\Hardware:
id:
identifier: false
uuid:
identifier: true
Resource Definition
App\Entity\Hardware
- Processor:
App\State\Processor\HardwareProcessor
- Input:
App\Dto\Input\HardwareInput
- Output:
App\Dto\Output\HardwareOutput
- Normalization Context:
['default', 'hardware:read']
- Denormalization Context:
['hardware:write']
API Operations
Hardware Operations
Get Hardware Collection (GetCollection)
- Provider:
App\State\Provider\HardwareProvider
- Filters:
- Order hardware:
api_platform.filter.hardware.order
- Search hardware:
api_platform.filter.hardware.search
- Order hardware:
Get Hardware (Get)
- Provider:
App\State\Provider\HardwareProvider
Update Hardware (Put)
- Provider:
App\State\Provider\HardwareProvider
Partially Update Hardware (Patch)
- Provider:
App\State\Provider\HardwareProvider
Create Hardware (Post)
- Default Operation: ~
Delete Hardware (Delete)
- Default Operation: ~
Entity Properties
App\Entity\Hardware
-
id:
- Identifier:
false
- Identifier:
-
uuid:
- Identifier:
true
- Identifier:
Hardware Input DTO
Fields Required in Hardware Endpoint Input
-
name
- Type: string
- Validation: Not blank
- Groups:
hardware:write
-
description
- Type: string
- Validation: Optional
- Groups:
hardware:write
-
type
- Type: string
- Validation: Not blank
- Groups:
hardware:write
-
price
- Type: float
- Validation: Positive value
- Groups:
hardware:write
Español
Índice
- Introducción
- Configuración
- Definición de Recursos
- Operaciones de API
- Propiedades de la Entidad
- DTO de Entrada de Hardware
Introducción
Esta documentación describe la configuración de API Platform en un proyecto Symfony. Se detallan los recursos, operaciones y propiedades de las entidades expuestas a través de la API.
Configuración
La configuración de la API se realiza en los archivos de configuración de Symfony, generalmente en config/packages/api_platform.yaml
.
resources:
App\Entity\Hardware:
processor: App\State\Processor\HardwareProcessor
input: App\Dto\Input\HardwareInput
output: App\Dto\Output\HardwareOutput
normalizationContext:
groups: ['default', 'hardware:read']
denormalizationContext:
groups: ['hardware:write']
operations:
ApiPlatform\Metadata\GetCollection:
provider: App\State\Provider\HardwareProvider
filters:
- 'api_platform.filter.hardware.order'
- 'api_platform.filter.hardware.search'
ApiPlatform\Metadata\Get:
provider: App\State\Provider\HardwareProvider
ApiPlatform\Metadata\Put:
provider: App\State\Provider\HardwareProvider
ApiPlatform\Metadata\Patch:
provider: App\State\Provider\HardwareProvider
ApiPlatform\Metadata\Post: ~
ApiPlatform\Metadata\Delete: ~
properties:
App\Entity\Hardware:
id:
identifier: false
uuid:
identifier: true
Definición de Recursos
App\Entity\Hardware
- Processor:
App\State\Processor\HardwareProcessor
- Input:
App\Dto\Input\HardwareInput
- Output:
App\Dto\Output\HardwareOutput
- Contexto de Normalización:
['default', 'hardware:read']
- Contexto de Desnormalización:
['hardware:write']
Operaciones de API
Operaciones de Hardware
Obtener Colección de Hardware (GetCollection)
- Provider:
App\State\Provider\HardwareProvider
- Filtros:
- Ordenar hardware:
api_platform.filter.hardware.order
- Buscar hardware:
api_platform.filter.hardware.search
- Ordenar hardware:
Obtener Hardware (Get)
- Provider:
App\State\Provider\HardwareProvider
Actualizar Hardware (Put)
- Provider:
App\State\Provider\HardwareProvider
Actualización Parcial de Hardware (Patch)
- Provider:
App\State\Provider\HardwareProvider
Crear Hardware (Post)
- Operación Predeterminada: ~
Eliminar Hardware (Delete)
- Operación Predeterminada: ~
Propiedades de la Entidad
App\Entity\Hardware
-
id:
- Identificador:
false
- Identificador:
-
uuid:
- Identificador:
true
- Identificador:
DTO de Entrada de Hardware
Campos Requeridos en la Entrada del Endpoint de Hardware
-
name
- Tipo: string
- Validación: No nulo
- Groups:
hardware:write
-
description
- Tipo: string
- Validación: Opcional
- Groups:
hardware:write
-
type
- Tipo: string
- Validación: No nulo
- Groups:
hardware:write
-
price
- Tipo: float
- Validación: Valor positivo
- Groups:
hardware:write
Table of Contents
- Select Language / Seleccionar Idioma
- English
- Table of Contents
- Introduction
- Configuration
- Resource Definition
- API Operations
- Entity Properties
- Hardware Input DTO
- Español