When constructing a PHP client, README.md will include this snippet to add to composer.json:
"repositories": [
{
"type": "git",
"url": "https://github.com/<composerVendorName>/<composerProjectName>.git"
}
]
As we're generating a private API client with a proper private Composer repo (Satis), usage of our package should include:
"repositories": [
{
"type": "composer",
"url": "https://package.example.com"
}
]
@e6049d6d30822c35a13608667637591f6536ad41
swagger-codegen generate -i http://petstore.swagger.io/v2/swagger.json -l php -o . -c ./config.json
There's no way to generate a PHP client without it happening, I don't see a way to provide configuration regarding this. My config.json:
{
"invokerPackage": "Example",
"modelPackage": "Example\\Model",
"apiPackage": "Example\\Api",
"packagePath": ".",
"srcBasePath": "src",
"composerProjectName": "example-php-sdk",
"composerVendorName": "private"
}
Generated with
swagger-codegen generate -i http://petstore.swagger.io/v2/swagger.json -l php -o . -c ./config.json
Open README.md
Allow for specifying Composer package destination.
@dkarlovi thanks for the feedback, which sounds reasonable to me.
May I know if you've time to contribute the enhancement to use CLI option (e.g. composerRepositoriesURL) to specify the URL?
@wing328 I might, but as I don't have professional experience with Java (only did assignments in college), would need a second pair of eyes. Guess a WiP PR would be fine?
I have other PHP client-related ideas too so it might be a good start.
@dkarlovi https://github.com/swagger-api/swagger-codegen/pull/977 may serve as a good reference.
FYI. Another way to do it is to customized the template composer.mustache and use it with the -t option.
Cli option does not looks like good solution after considering how complex structure of repositories config can be: https://getcomposer.org/doc/04-schema.md#repositories.
Most helpful comment
@wing328 I might, but as I don't have professional experience with Java (only did assignments in college), would need a second pair of eyes. Guess a WiP PR would be fine?
I have other PHP client-related ideas too so it might be a good start.