Florian Eisenmenger 1 год назад
Родитель
Сommit
1c2565960e
3 измененных файлов: 377 добавлений и 25 удалений
  1. +1
    -1
      export/openapi.json
  2. +373
    -18
      export/openapi.yaml
  3. +3
    -6
      src/ApiResource/ContactPartnerProductApi.php

+ 1
- 1
export/openapi.json
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 373
- 18
export/openapi.yaml Просмотреть файл

@@ -216,6 +216,215 @@ paths:
required: true
deprecated: false
parameters: []
/api/contact_partner_products:
get:
operationId: api_contact_partner_products_get_collection
tags:
- ContactPartnerProduct
responses:
200:
description: 'ContactPartnerProduct collection'
content:
application/ld+json:
schema:
type: object
properties:
'hydra:member': { type: array, items: { $ref: '#/components/schemas/ContactPartnerProduct.jsonld' } }
'hydra:totalItems': { type: integer, minimum: 0 }
'hydra:view': { type: object, properties: { '@id': { type: string, format: iri-reference }, '@type': { type: string }, 'hydra:first': { type: string, format: iri-reference }, 'hydra:last': { type: string, format: iri-reference }, 'hydra:previous': { type: string, format: iri-reference }, 'hydra:next': { type: string, format: iri-reference } }, example: { '@id': string, type: string, 'hydra:first': string, 'hydra:last': string, 'hydra:previous': string, 'hydra:next': string } }
'hydra:search': { type: object, properties: { '@type': { type: string }, 'hydra:template': { type: string }, 'hydra:variableRepresentation': { type: string }, 'hydra:mapping': { type: array, items: { type: object, properties: { '@type': { type: string }, variable: { type: string }, property: { type: [string, 'null'] }, required: { type: boolean } } } } } }
required:
- 'hydra:member'
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ContactPartnerProduct'
text/html:
schema:
type: array
items:
$ref: '#/components/schemas/ContactPartnerProduct'
application/hal+json:
schema:
type: object
properties:
_embedded: { type: array, items: { $ref: '#/components/schemas/ContactPartnerProduct.jsonhal' } }
totalItems: { type: integer, minimum: 0 }
itemsPerPage: { type: integer, minimum: 0 }
_links: { type: object, properties: { self: { type: object, properties: { href: { type: string, format: iri-reference } } }, first: { type: object, properties: { href: { type: string, format: iri-reference } } }, last: { type: object, properties: { href: { type: string, format: iri-reference } } }, next: { type: object, properties: { href: { type: string, format: iri-reference } } }, previous: { type: object, properties: { href: { type: string, format: iri-reference } } } } }
required:
- _links
- _embedded
summary: 'Retrieves the collection of ContactPartnerProduct resources.'
description: 'Retrieves the collection of ContactPartnerProduct resources.'
parameters:
-
name: page
in: query
description: 'The collection page number'
required: false
deprecated: false
allowEmptyValue: true
schema:
type: integer
default: 1
style: form
explode: false
allowReserved: false
-
name: itemsPerPage
in: query
description: 'The number of items per page'
required: false
deprecated: false
allowEmptyValue: true
schema:
type: integer
default: 10
minimum: 0
maximum: 50
style: form
explode: false
allowReserved: false
-
name: contact
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: string
style: form
explode: false
allowReserved: false
-
name: 'contact[]'
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: array
items:
type: string
style: form
explode: true
allowReserved: false
deprecated: false
post:
operationId: api_contact_partner_products_post
tags:
- ContactPartnerProduct
responses:
201:
description: 'ContactPartnerProduct resource created'
content:
application/ld+json:
schema:
$ref: '#/components/schemas/ContactPartnerProduct.jsonld'
application/json:
schema:
$ref: '#/components/schemas/ContactPartnerProduct'
text/html:
schema:
$ref: '#/components/schemas/ContactPartnerProduct'
application/hal+json:
schema:
$ref: '#/components/schemas/ContactPartnerProduct.jsonhal'
links: { }
400:
description: 'Invalid input'
422:
description: 'Unprocessable entity'
summary: 'Creates a ContactPartnerProduct resource.'
description: 'Creates a ContactPartnerProduct resource.'
parameters: []
requestBody:
description: 'The new ContactPartnerProduct resource'
content:
application/ld+json:
schema:
$ref: '#/components/schemas/ContactPartnerProduct.jsonld'
application/json:
schema:
$ref: '#/components/schemas/ContactPartnerProduct'
text/html:
schema:
$ref: '#/components/schemas/ContactPartnerProduct'
application/hal+json:
schema:
$ref: '#/components/schemas/ContactPartnerProduct.jsonhal'
required: true
deprecated: false
parameters: []
'/api/contact_partner_products/{id}':
get:
operationId: api_contact_partner_products_id_get
tags:
- ContactPartnerProduct
responses:
200:
description: 'ContactPartnerProduct resource'
content:
application/ld+json:
schema:
$ref: '#/components/schemas/ContactPartnerProduct.jsonld'
application/json:
schema:
$ref: '#/components/schemas/ContactPartnerProduct'
text/html:
schema:
$ref: '#/components/schemas/ContactPartnerProduct'
application/hal+json:
schema:
$ref: '#/components/schemas/ContactPartnerProduct.jsonhal'
404:
description: 'Resource not found'
summary: 'Retrieves a ContactPartnerProduct resource.'
description: 'Retrieves a ContactPartnerProduct resource.'
parameters:
-
name: id
in: path
description: 'ContactPartnerProductApi identifier'
required: true
deprecated: false
allowEmptyValue: false
schema:
type: string
style: simple
explode: false
allowReserved: false
deprecated: false
delete:
operationId: api_contact_partner_products_id_delete
tags:
- ContactPartnerProduct
responses:
204:
description: 'ContactPartnerProduct resource deleted'
404:
description: 'Resource not found'
summary: 'Removes the ContactPartnerProduct resource.'
description: 'Removes the ContactPartnerProduct resource.'
parameters:
-
name: id
in: path
description: 'ContactPartnerProductApi identifier'
required: true
deprecated: false
allowEmptyValue: false
schema:
type: string
style: simple
explode: false
allowReserved: false
deprecated: false
parameters: []
/api/contacts:
get:
operationId: api_contacts_get_collection
@@ -3866,6 +4075,137 @@ components:
- string
- 'null'
format: date-time
ContactPartnerProduct:
type: object
description: ''
deprecated: false
required:
- contact
- partnerProduct
properties:
contact:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
partnerProduct:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
productName:
readOnly: true
type:
- string
- 'null'
createdAt:
readOnly: true
type:
- string
- 'null'
format: date-time
ContactPartnerProduct.jsonhal:
type: object
description: ''
deprecated: false
required:
- contact
- partnerProduct
properties:
_links:
type: object
properties:
self:
type: object
properties:
href:
type: string
format: iri-reference
contact:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
partnerProduct:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
productName:
readOnly: true
type:
- string
- 'null'
createdAt:
readOnly: true
type:
- string
- 'null'
format: date-time
ContactPartnerProduct.jsonld:
type: object
description: ''
deprecated: false
required:
- contact
- partnerProduct
properties:
'@context':
readOnly: true
oneOf:
-
type: string
-
type: object
properties:
'@vocab':
type: string
hydra:
type: string
enum: ['http://www.w3.org/ns/hydra/core#']
required:
- '@vocab'
- hydra
additionalProperties: true
'@id':
readOnly: true
type: string
'@type':
readOnly: true
type: string
contact:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
partnerProduct:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
productName:
readOnly: true
type:
- string
- 'null'
createdAt:
readOnly: true
type:
- string
- 'null'
format: date-time
Document:
type: object
description: ''
@@ -4574,25 +4914,28 @@ components:
type: object
description: ''
deprecated: false
required:
- contact
- partnerProduct
properties:
contact:
user:
readOnly: true
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
partnerProduct:
userName:
readOnly: true
type:
- string
- 'null'
partner:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
productName:
partnerName:
readOnly: true
type:
- string
@@ -4603,13 +4946,12 @@ components:
- string
- 'null'
format: date-time
required:
- partner
PartnerFollow.jsonhal:
type: object
description: ''
deprecated: false
required:
- contact
- partnerProduct
properties:
_links:
type: object
@@ -4620,21 +4962,27 @@ components:
href:
type: string
format: iri-reference
contact:
user:
readOnly: true
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
partnerProduct:
userName:
readOnly: true
type:
- string
- 'null'
partner:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
productName:
partnerName:
readOnly: true
type:
- string
@@ -4645,13 +4993,12 @@ components:
- string
- 'null'
format: date-time
required:
- partner
PartnerFollow.jsonld:
type: object
description: ''
deprecated: false
required:
- contact
- partnerProduct
properties:
'@context':
readOnly: true
@@ -4676,21 +5023,27 @@ components:
'@type':
readOnly: true
type: string
contact:
user:
readOnly: true
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
partnerProduct:
userName:
readOnly: true
type:
- string
- 'null'
partner:
'owl:maxCardinality': 1
type:
- string
- 'null'
format: iri-reference
example: 'https://example.com/'
productName:
partnerName:
readOnly: true
type:
- string
@@ -4701,6 +5054,8 @@ components:
- string
- 'null'
format: date-time
required:
- partner
PartnerProduct:
type: object
description: ''


+ 3
- 6
src/ApiResource/ContactPartnerProductApi.php Просмотреть файл

@@ -12,20 +12,17 @@ use ApiPlatform\Doctrine\Orm\State\Options;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use App\Entity\Partner;
use App\Entity\PartnerFollow;
use App\Entity\User;
use App\Entity\ContactPartnerProduct;
use App\State\EntityClassDtoStateProcessor;
use App\State\EntityToDtoStateProvider;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Post;
use Symfony\Component\Serializer\Attribute\Groups;
use Symfony\Component\Validator\Constraints\NotBlank;

#[ApiResource(
shortName: 'PartnerFollow',
shortName: 'ContactPartnerProduct',
operations: [
new Get(
security: 'is_granted("ROLE_USER")'
@@ -43,7 +40,7 @@ use Symfony\Component\Validator\Constraints\NotBlank;
security: 'is_granted("ROLE_USER")',
provider: EntityToDtoStateProvider::class,
processor: EntityClassDtoStateProcessor::class,
stateOptions: new Options(entityClass: PartnerFollow::class),
stateOptions: new Options(entityClass: ContactPartnerProduct::class),
)]
#[ApiFilter(SearchFilter::class, properties: ['contact' => 'exact'])]
class ContactPartnerProductApi


Загрузка…
Отмена
Сохранить