yoanm / jsonrpc-http-server-openapi-doc-sdk
SDK to generate Http JSON-RPC server documentation for OpenAPI v3.0.0
Installs: 29 045
Dependents: 2
Suggesters: 1
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- php: ^8.0
- yoanm/jsonrpc-server-doc-sdk: ^1.0
Requires (Dev)
- ext-json: *
- behat/behat: ^3.9.0
- dvdoug/behat-code-coverage: ^5.0
- phpspec/prophecy: ^1.15
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: ^9.6
- squizlabs/php_codesniffer: ^3.5
- yoanm/php-unit-extended: ^2.0
Suggests
- yoanm/jsonrpc-params-symfony-constraint-doc-sdk: SDK to generate JSON-RPC documentation from symfony constraint
- yoanm/jsonrpc-server-sdk: Server SDK to convert a json-rpc request string into json-rpc response string
- yoanm/symfony-jsonrpc-http-server: Symfony Bundle to convert an HTTP json-rpc request into HTTP json-rpc response
- yoanm/symfony-jsonrpc-http-server-doc: Symfony bundle for easy JSON-RPC server documentation
- yoanm/symfony-jsonrpc-http-server-openapi-doc: Symfony bundle for easy JSON-RPC server OpenAPI 3.0.0 documentation
This package is auto-updated.
Last update: 2024-10-31 00:21:51 UTC
README
SDK to generate Http JSON-RPC server documentation for OpenAPI v3.0.0
See yoanm/symfony-jsonrpc-http-server-openapi-doc
for automatic dependency injection.
How to use
Create the normalizer :
use Yoanm\JsonRpcHttpServerOpenAPIDoc\App\Normalizer\Component\ErrorDocNormalizer; use Yoanm\JsonRpcHttpServerOpenAPIDoc\App\Normalizer\Component\ExternalSchemaListDocNormalizer; use Yoanm\JsonRpcHttpServerOpenAPIDoc\App\Normalizer\Component\OperationDocNormalizer; use Yoanm\JsonRpcHttpServerOpenAPIDoc\App\Normalizer\Component\RequestDocNormalizer; use Yoanm\JsonRpcHttpServerOpenAPIDoc\App\Normalizer\Component\ResponseDocNormalizer; use Yoanm\JsonRpcHttpServerOpenAPIDoc\App\Normalizer\Component\SchemaTypeNormalizer; use Yoanm\JsonRpcHttpServerOpenAPIDoc\App\Normalizer\Component\ShapeNormalizer; use Yoanm\JsonRpcHttpServerOpenAPIDoc\App\Normalizer\Component\TypeDocNormalizer; use Yoanm\JsonRpcHttpServerOpenAPIDoc\App\Resolver\DefinitionRefResolver; use Yoanm\JsonRpcHttpServerOpenAPIDoc\Infra\Normalizer\DocNormalizer; $shapeNormalizer = new ShapeNormalizer(); $definitionRefResolver = new DefinitionRefResolver(); $typeDocNormalizer = new TypeDocNormalizer( new SchemaTypeNormalizer() ); $normalizer = new DocNormalizer( new ExternalSchemaListDocNormalizer( $definitionRefResolver, $typeDocNormalizer, new ErrorDocNormalizer( $typeDocNormalizer, $shapeNormalizer ) ), new OperationDocNormalizer( $definitionRefResolver, new RequestDocNormalizer( $definitionRefResolver, $shapeNormalizer ), new ResponseDocNormalizer( $definitionRefResolver, $shapeNormalizer ) ) );
Then you can convert ServerDoc
or HttpServerDoc
by doing :
use Yoanm\JsonRpcServerDoc\Domain\Model\ServerDoc; $serverDoc = new ServerDoc(); // Configure server doc ... // Add methods documentation ... // Then normalize /** @var array $openAPIDoc */ $openAPIDoc = $normalizer->normalize($serverDoc);