Flow PHP

OpenAPIConverter

FinalYes

Bidirectional converter between Flow PHP schemas and OpenAPI 3.0 specifications.

This converter enables you to:

  • Generate OpenAPI documentation from Flow schemas
  • Parse OpenAPI specifications to create Flow schemas
  • Preserve metadata (descriptions, examples) during conversion
  • Support all common data types and structures
Tags
example

Basic Flow to OpenAPI conversion

$schema = schema(
    int_schema('id', false),
    str_schema('name', true)
);
$openApi = $converter->toOpenAPI($schema);
example

Basic OpenAPI to Flow conversion

$openApiSpec = [
    'type' => 'object',
    'properties' => [
        'id' => ['type' => 'integer', 'nullable' => false],
        'name' => ['type' => 'string', 'nullable' => true]
    ]
];
$schema = $converter->fromOpenAPI($openApiSpec);

Methods

fromOpenAPI()  : Schema
toOpenAPI()  : array<string, mixed>

Methods

fromOpenAPI()

public fromOpenAPI(array<string, mixed> $openApiSpec) : Schema
Parameters
$openApiSpec : array<string, mixed>

OpenAPI object specification with 'type' and 'properties'

Tags
throws
InvalidArgumentException

When the specification is invalid or unsupported

Return values
Schema

toOpenAPI()

public toOpenAPI(Schema $schema) : array<string, mixed>
Parameters
$schema : Schema

Flow schema containing field definitions

Return values
array<string, mixed>

OpenAPI object specification with 'type' and 'properties'


        
On this page

Search results