swagger-php/Examples
Alexander Tebiev 1cdb866e71
Add example schema-query-parameter-attributes processor (#1569)
2024-04-19 11:00:03 +12:00
..
example-object allOf/oneOf/anyOf are not always of type object (#1254) 2022-06-03 09:05:02 +12:00
misc Tweak CS rules around global imports and enforce (#1305) 2022-09-02 16:09:01 +12:00
nesting Set `type: 'object'` when moving properties into `allOf` (#1489) 2023-10-18 10:21:06 +13:00
petstore-3.0 Tweak CS rules around global imports and enforce (#1305) 2022-09-02 16:09:01 +12:00
petstore.swagger.io Tweak CS rules around global imports and enforce (#1305) 2022-09-02 16:09:01 +12:00
polymorphism Set `type: 'object'` when moving properties into `allOf` (#1489) 2023-10-18 10:21:06 +13:00
processors Add example schema-query-parameter-attributes processor (#1569) 2024-04-19 11:00:03 +12:00
swagger-spec Tweak CS rules around global imports and enforce (#1305) 2022-09-02 16:09:01 +12:00
using-interfaces Set `type: 'object'` when moving properties into `allOf` (#1489) 2023-10-18 10:21:06 +13:00
using-links Address psalm warnings (#1297) 2022-08-25 15:33:58 +12:00
using-links-php81 Handle nullable in 3.1.0 in conjuction with oneOf (#1470) 2023-08-31 10:56:22 +12:00
using-refs Set `type: 'object'` when moving properties into `allOf` (#1489) 2023-10-18 10:21:06 +13:00
using-traits Follow CS and phpstan changes (#1530) 2024-01-08 10:56:47 +13:00
webhooks Add support for OpenApi 3.1.0 Webhooks (#1511) 2023-12-11 21:34:47 +13:00
webhooks81 Add support for OpenApi 3.1.0 Webhooks (#1511) 2023-12-11 21:34:47 +13:00
Readme.md Add example schema-query-parameter-attributes processor (#1569) 2024-04-19 11:00:03 +12:00

Readme.md

Code/Annotation examples

Collection of code/annotation examples and their corresponding OpenAPI specs generated using swagger-php.

Custom processors

Processors implement the various steps involved in converting annotations into an OpenAPI spec.

Writing a custom processor is the recommended way to extend swagger-php in a clean way.

Processors are expected to implement the __invoke() method expecting the current Analysis object as single parameter:

<?php
...
use OpenApi\Analysis;
...

class MyCustomProcessor
{
    public function __invoke(Analysis $analysis)
    {
        // custom processing
    }
}
  • schema-query-parameter processor

    A processor that takes a vendor tag (expecting a schema #ref) and injects all properties of that given schema as query parameter to the request definition.

    source

  • schema-query-parameter-attributes processor

    Same as the schema-query-parameter processor but uses php attributes instead of annotations. A processor that takes a vendor tag (expecting a schema #ref) and injects all properties of that given schema as query parameter to the request definition.

    source

  • sort-components processor

    A processor that sorts components so they appear in alphabetical order.

    source