1 Perfil Hardware
Manuel Aranda Rosales edited this page 2024-08-02 09:13:14 +02:00

Documentación - API ogCore

Select Language / Seleccionar Idioma


English

Table of Contents

  1. Introduction
  2. Configuration
  3. Resource Definition
  4. API Operations
  5. Entity Properties
  6. Hardware Profile Input DTO

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\HardwareProfile:
        processor: App\State\Processor\HardwareProfileProcessor
        input: App\Dto\Input\HardwareProfileInput
        output: App\Dto\Output\HardwareProfileOutput
        normalizationContext:
            groups: ['default', 'hardware-profile:read']
        denormalizationContext:
            groups: ['hardware-profile:write']
        operations:
            ApiPlatform\Metadata\GetCollection:
                provider: App\State\Provider\HardwareProfileProvider
                filters:
                    - 'api_platform.filter.hardware.order'
                    - 'api_platform.filter.hardware.search'
            ApiPlatform\Metadata\Get:
                provider: App\State\Provider\HardwareProfileProvider
            ApiPlatform\Metadata\Put:
                provider: App\State\Provider\HardwareProfileProvider
            ApiPlatform\Metadata\Patch:
                provider: App\State\Provider\HardwareProfileProvider
            ApiPlatform\Metadata\Post: ~
            ApiPlatform\Metadata\Delete: ~

properties:
    App\Entity\HardwareProfile:
        id:
            identifier: false
        uuid:
            identifier: true

Resource Definition

App\Entity\HardwareProfile

  • Processor: App\State\Processor\HardwareProfileProcessor
  • Input: App\Dto\Input\HardwareProfileInput
  • Output: App\Dto\Output\HardwareProfileOutput
  • Normalization Context: ['default', 'hardware-profile:read']
  • Denormalization Context: ['hardware-profile:write']

API Operations

Hardware Profile Operations

Get Hardware Profile Collection (GetCollection)
  • Provider: App\State\Provider\HardwareProfileProvider
  • Filters:
    • Order hardware profiles: api_platform.filter.hardware.order
    • Search hardware profiles: api_platform.filter.hardware.search
Get Hardware Profile (Get)
  • Provider: App\State\Provider\HardwareProfileProvider
Update Hardware Profile (Put)
  • Provider: App\State\Provider\HardwareProfileProvider
Partially Update Hardware Profile (Patch)
  • Provider: App\State\Provider\HardwareProfileProvider
Create Hardware Profile (Post)
  • Default Operation: ~
Delete Hardware Profile (Delete)
  • Default Operation: ~

Entity Properties

App\Entity\HardwareProfile

  • id:

    • Identifier: false
  • uuid:

    • Identifier: true

Hardware Profile Input DTO

Fields Required in Hardware Profile Endpoint Input

  1. profileName

    • Type: string
    • Validation: Not blank
    • Groups: hardware-profile:write
  2. specifications

    • Type: array
    • Validation: Not blank
    • Groups: hardware-profile:write
  3. isActive

    • Type: boolean
    • Validation: Not null
    • Groups: hardware-profile:write
    • Default: true

Español

Índice

  1. Introducción
  2. Configuración
  3. Definición de Recursos
  4. Operaciones de API
  5. Propiedades de la Entidad
  6. DTO de Entrada de Perfil 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\HardwareProfile:
        processor: App\State\Processor\HardwareProfileProcessor
        input: App\Dto\Input\HardwareProfileInput
        output: App\Dto\Output\HardwareProfileOutput
        normalizationContext:
            groups: ['default', 'hardware-profile:read']
        denormalizationContext:
            groups: ['hardware-profile:write']
        operations:
            ApiPlatform\Metadata\GetCollection:
                provider: App\State\Provider\HardwareProfileProvider
                filters:
                    - 'api_platform.filter.hardware.order'
                    - 'api_platform.filter.hardware.search'
            ApiPlatform\Metadata\Get:
                provider: App\State\Provider\HardwareProfileProvider
            ApiPlatform\Metadata\Put:
                provider: App\State\Provider\HardwareProfileProvider
            ApiPlatform\Metadata\Patch:
                provider: App\State\Provider\HardwareProfileProvider
            ApiPlatform\Metadata\Post: ~
            ApiPlatform\Metadata\Delete: ~

properties:
    App\Entity\HardwareProfile:
        id:
            identifier: false
        uuid:
            identifier: true

Definición de Recursos

App\Entity\HardwareProfile

  • Processor: App\State\Processor\HardwareProfileProcessor
  • Input: App\Dto\Input\HardwareProfileInput
  • Output: App\Dto\Output\HardwareProfileOutput
  • Contexto de Normalización: ['default', 'hardware-profile:read']
  • Contexto de Desnormalización: ['hardware-profile:write']

Operaciones de API

Operaciones de Perfil de Hardware

Obtener Colección de Perfiles de Hardware (GetCollection)
  • Provider: App\State\Provider\HardwareProfileProvider
  • Filtros:
    • Ordenar perfiles de hardware: api_platform.filter.hardware.order
    • Buscar perfiles de hardware: api_platform.filter.hardware.search
Obtener Perfil de Hardware (Get)
  • Provider: App\State\Provider\HardwareProfileProvider
Actualizar Perfil de Hardware (Put)
  • Provider: App\State\Provider\HardwareProfileProvider
Actualización Parcial de Perfil de Hardware (Patch)
  • Provider: App\State\Provider\HardwareProfileProvider
Crear Perfil de Hardware (Post)
  • Operación Predeterminada: ~
Eliminar Perfil de Hardware (Delete)
  • Operación Predeterminada: ~

Propiedades de la Entidad

App\Entity\HardwareProfile

  • id:

    • Identificador: false
  • uuid:

    • Identificador: true

DTO de Entrada de Perfil de Hardware

Campos Requeridos en la Entrada del Endpoint de Perfil de Hardware

  1. profileName

    • Tipo: string
    • Validación: No nulo
    • Groups: hardware-profile:write
  2. specifications

    • Tipo: array
    • Validación: No nulo
    • Groups: hardware-profile:write
  3. isActive

    • Tipo: booleano
    • Validación: No nulo
    • Groups: hardware-profile:write
    • Predeterminado: true