Skip to content

Latest commit

 

History

History
67 lines (46 loc) · 2.27 KB

swagger-codegen.md

File metadata and controls

67 lines (46 loc) · 2.27 KB

This section describes how to generate source code which call REST APIs described as spec v2.0 code hosted on a Swagger server.

Swagger-codegen uses Scala 2.9.1 programs to generate server code in Node.js and PHP.

  1. Swagger specs

  2. Install Scala

  3. Install Node.js server

  4. Install Scala

  5. Use swagger-codegen to create server program.


## Swagger specs

Swagger specs can be the product of reverse-engineering, derived by a program analyzing methods, parameters and models within server source code.

The intent of swagger specs is readability by both humans and machines.

It's done by leveraging swagger-codegen, which provides {{moustache}} templates for all major programming languages: for Java, Scala, Goovy, Python, Ruby, Clojur, ObjectiveC, C#, PHP, JavaScript.

Custom ones can also be created. This feature is leveraged by the companion jmeter-codegen library, which provides the template for generating JMeter tests to validate server handling of requests and responses at run-time.

Its objective is to eliminate delays between coding and full testing, just as the overarching goal of Swagger is to update client code at the same pace as the server by means of code generation.

## Alternatives AutoRest generates client libraries for accessing RESTful web services. Input to AutoRest is a spec that describes the REST API using the Swagger format. ## Install Scala
  1. Scala.
  • - Scala 2.9.1 [available here](http://www.scala-lang.org)
    1. Aadd the scala binary to your PATH.
    ## Build using Maven 0. Use a Terminal to position to src: 0. Build:
    ```
    

    mvn package ```

    ## Install Node.js server ## Resources

    https://github.com/swagger-api/swagger-spec/wiki