Skip to content

[PHP] Allow for private Composer repository in documentation #3836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dkarlovi opened this issue Sep 20, 2016 · 5 comments
Closed

[PHP] Allow for private Composer repository in documentation #3836

dkarlovi opened this issue Sep 20, 2016 · 5 comments

Comments

@dkarlovi
Copy link
Contributor

Description

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"
    }
]
Swagger-codegen version

@e6049d6d30822c35a13608667637591f6536ad41

Swagger declaration file content or url

config.json

Command line used for generation
swagger-codegen generate -i http://petstore.swagger.io/v2/swagger.json -l php -o . -c ./config.json
Steps to reproduce

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

Suggest a Fix

Allow for specifying Composer package destination.

@wing328
Copy link
Contributor

wing328 commented Sep 20, 2016

@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?

@dkarlovi
Copy link
Contributor Author

@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.

@wing328
Copy link
Contributor

wing328 commented Sep 21, 2016

@dkarlovi #977 may serve as a good reference.

@wing328 wing328 modified the milestones: Future, v2.2.2 Feb 15, 2017
@wing328
Copy link
Contributor

wing328 commented Feb 15, 2017

FYI. Another way to do it is to customized the template composer.mustache and use it with the -t option.

@baartosz
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants