NAME
Langertha::Role::OpenAPI - Role for APIs with OpenAPI definition
VERSION
version 0.301
openapi_operations
HashRef of pre-computed OpenAPI operation data. Contains server_url and an operations sub-hash mapping each operationId to its HTTP method, path, and content type. Built lazily; engines can override _build_openapi_operations to provide pre-computed data and skip the expensive YAML parsing / OpenAPI::Modern construction.
openapi
The OpenAPI::Modern instance loaded from the engine's openapi_file. Built lazily on first use. Only used as fallback when openapi_operations is not overridden. Only YAML format OpenAPI specs are currently supported.
supported_operations
ArrayRef of operationId strings that this engine instance supports. When non-empty, only listed operations are permitted; all others croak. Defaults to an empty ArrayRef (all operations allowed). Used to restrict engines that run in a limited compatibility mode.
can_operation
if ($engine->can_operation('createChatCompletion')) { ... }
Returns true if the given $operationId is supported by this engine. Always returns true when supported_operations is empty (unrestricted mode).
get_operation
my ($method, $url, $content_type) = $engine->get_operation($operationId);
Looks up an operation by $operationId in the OpenAPI spec and returns the HTTP method, full URL, and content type as a three-element list. Croaks if the operation is not in supported_operations.
generate_request
my $request = $engine->generate_request($operationId, $response_call, %args);
Generates an HTTP request for the named OpenAPI $operationId. Resolves the method, URL, and content type from the spec, then delegates to "generate_http_request" in Langertha::Role::HTTP.
SEE ALSO
Langertha::Role::HTTP - HTTP request building (required by this role)
Langertha::Role::Models - Model management (typically composed alongside this role)
OpenAPI::Modern - OpenAPI spec handling
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de> https://raudss.us/
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.