mirror of
https://github.com/symfony/recipes-contrib.git
synced 2026-09-11 23:26:40 +03:00
101 lines
5.4 KiB
JSON
101 lines
5.4 KiB
JSON
{
|
|
"manifests": {
|
|
"jane-php/open-api-common": {
|
|
"manifest": {
|
|
"copy-from-recipe": {
|
|
"bin/": "%BIN_DIR%/",
|
|
"config/": "%CONFIG_DIR%/"
|
|
},
|
|
"conflict": {
|
|
"symfony/symfony": "<5.0"
|
|
},
|
|
"post-install-output": [
|
|
" * <fg=blue>Finish</> package configuration:",
|
|
" 1. Place your API specification at <comment>config/jane/open-api.yaml</>, or update <comment>openapi-file</> in <comment>config/jane/open_api.php</>",
|
|
" 2. Replace <comment>MyApp\\Library\\Generated</> with your own namespace in <comment>config/jane/open_api.php</> and in <comment>config/packages/jane.yaml</>",
|
|
" 3. Add <comment>generated/</> directory to your composer autoload definition (eg. <comment>\"MyApp\\\\Library\\\\Generated\\\\\": \"generated/\"</>)",
|
|
" 4. Run <comment>bin/jane-open-api-generate</>",
|
|
" 5. Once generation succeeded, uncomment the service in <comment>config/packages/jane.yaml</> to enable autowiring of the generated normalizer",
|
|
"",
|
|
"Documentation: https://jane.jolicode.com/latest/"
|
|
]
|
|
},
|
|
"files": {
|
|
"bin/jane-open-api-generate": {
|
|
"contents": [
|
|
"#!/usr/bin/env php",
|
|
"<?php",
|
|
"",
|
|
"require __DIR__ . '/../vendor/autoload.php';",
|
|
"",
|
|
"use Jane\\Component\\OpenApiCommon\\Console\\Command\\GenerateCommand;",
|
|
"use Jane\\Component\\OpenApiCommon\\Console\\Loader\\ConfigLoader;",
|
|
"use Jane\\Component\\OpenApiCommon\\Console\\Loader\\OpenApiMatcher;",
|
|
"use Jane\\Component\\OpenApiCommon\\Console\\Loader\\SchemaLoader;",
|
|
"use Symfony\\Component\\Console\\Application;",
|
|
"use Symfony\\Component\\Console\\Input\\ArrayInput;",
|
|
"use Symfony\\Component\\Console\\Output\\ConsoleOutput;",
|
|
"",
|
|
"$command = new GenerateCommand(new ConfigLoader(), new SchemaLoader(), new OpenApiMatcher());",
|
|
"$inputArray = new ArrayInput(['--config-file' => __DIR__ . '/../config/jane/open_api.php'], $command->getDefinition());",
|
|
"$output = new ConsoleOutput();",
|
|
"",
|
|
"try {",
|
|
" exit($command->execute($inputArray, $output));",
|
|
"} catch (\\Throwable $throwable) {",
|
|
" (new Application())->renderThrowable($throwable, $output->getErrorOutput());",
|
|
"",
|
|
" exit(1);",
|
|
"}",
|
|
""
|
|
],
|
|
"executable": true
|
|
},
|
|
"config/jane/open_api.php": {
|
|
"contents": [
|
|
"<?php",
|
|
"",
|
|
"/*",
|
|
" * Jane OpenAPI generator configuration.",
|
|
" *",
|
|
" * - \"openapi-file\": path to your OpenAPI specification (JSON or YAML).",
|
|
" * This file must exist before running bin/jane-open-api-generate:",
|
|
" * either place your specification at config/jane/open-api.yaml,",
|
|
" * or update this path to point to it.",
|
|
" * - \"namespace\": root namespace of the generated code. It must match the",
|
|
" * PSR-4 mapping you add to your composer.json autoload section.",
|
|
" * - \"directory\": target directory for the generated files.",
|
|
" *",
|
|
" * See https://jane.jolicode.com/latest/ for all available options.",
|
|
" */",
|
|
"",
|
|
"return [",
|
|
" 'openapi-file' => __DIR__ . '/open-api.yaml',",
|
|
" 'namespace' => 'MyApp\\Library\\Generated',",
|
|
" 'directory' => __DIR__ . '/../../generated',",
|
|
"];",
|
|
""
|
|
],
|
|
"executable": false
|
|
},
|
|
"config/packages/jane.yaml": {
|
|
"contents": [
|
|
"services:",
|
|
" _defaults:",
|
|
" autowire: true",
|
|
" autoconfigure: true",
|
|
"",
|
|
" # Uncomment the line below once you have generated your code to autowire",
|
|
" # the generated normalizers (and the client using them). The namespace",
|
|
" # must match the \"namespace\" key of your config/jane/*.php config file.",
|
|
"# MyApp\\Library\\Generated\\Normalizer\\JaneObjectNormalizer: null",
|
|
""
|
|
],
|
|
"executable": false
|
|
}
|
|
},
|
|
"ref": "61604294a2cc2d636fe0b7933bb967c4a9a1b680"
|
|
}
|
|
}
|
|
}
|