Giter VIP home page Giter VIP logo

jane-open-api-autogenerate's Introduction

Jane OpenAPI Autogenerate

Scrutinizer Code Quality Build Status Dependency Status Latest Stable Version License

This project is designed to allow you to add an automatically generated OpenAPI (swagger) client as a dependency via a composer dependency.

This project uses jane/open-api.

Getting Started

Prerequisities

You'll need to install:

  • PHP (Minimum 5.6)

Usage

You have a few options, you could add to the repository you keep your swagger definition define a composer.json that looks something like this.

{
    "name": "swagger/petstore",
    "type": "swagger-api",
    "extra": {
        "namespace": "Swagger\\Petstore",
        "schema-file": "swagger.json"
    },
    "autoload": {
        "psr-4": {
            "Swagger\\Petstore\\": "generated/"
        }
    },
    "require": {
        "purplebooth/jane-open-api-autogenerate": "^0.1.4"
    }
}

and then run

$ composer require swagger/petstore

alternatively you could add the package manually in the composer.json

{
    "require": {
        "swagger/petstore": "0.1.0",
        "purplebooth/jane-open-api-autogenerate": ""
    },
    "repositories": [{
        "type": "package",
        "package": {
            "autoload": {
                "psr-4": {
                    "Swagger\\Petstore\\": "generated/"
                }
            },
            "type": "swagger-api",
            "name": "swagger/petstore",
            "version": "0.1.0",
            "extra": {
                "namespace": "Swagger\\Petstore",
                "schema-file": "/path/to/swagger.json"
            },
            "require": {
                "purplebooth/jane-open-api-autogenerate": "v0.1.4"
            },
            "dist" : {
              "type": "path",
              "url": "/path/to/swagger.json"
            }
        }
    }]
}

You do not need to provide a dist/source directory if we're not checking out your swagger.json from somewhere.

{
    "require": {
        "swagger/petstore": "0.1.0",
        "purplebooth/jane-open-api-autogenerate": ""
    },
    "repositories": [{
        "type": "package",
        "package": {
            "autoload": {
                "psr-4": {
                    "Swagger\\Petstore\\": "generated/"
                }
            },
            "type": "swagger-api",
            "name": "swagger/petstore",
            "version": "0.1.0",
            "extra": {
                "namespace": "Swagger\\Petstore",
                "schema-file": "http://example/path/to/swagger.json"
            },
            "require": {
                "purplebooth/jane-open-api-autogenerate": "v0.1.4"
            }
        }
    }]
}

Another feature of this library is the ability to override the swagger file from a location defined by an environment variable. To do this you simply define an additional key in the package specifies in which environment variable.

"extra": {
    "namespace": "Swagger\\Petstore\\",
    "schema-file": "/path/to/swagger.json",
    "environment-variable": "PETS_SWAGGER_YAML"
},

If it's not set it'll fall back to the value defined in the schema-file attribute.

Coding Style

We follow PSR2, and also enforce PHPDocs on all functions. To run the tests for coding style violations

vendor/bin/phpcs -p --standard=psr2 src/

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

jane-open-api-autogenerate's People

Contributors

purplebooth avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.