forked from loafle/openapi-generator-original
merged
This commit is contained in:
commit
bf93d48ef2
@ -4,7 +4,7 @@
|
||||
|
||||
- Before submitting an issue, search the [open issue](https://github.com/swagger-api/swagger-codegen/issues) and [closed issue](https://github.com/swagger-api/swagger-codegen/issues?q=is%3Aissue+is%3Aclosed) to ensure no one else has reported something similar before.
|
||||
- The issue should contain details on how to repeat the issue, e.g.
|
||||
- the Swagger spec for reproducing the issue (:bulb: use [Gist](https://gist.github.com) to share). If the Swagger spec cannot be shared publicly, it will be hard for the community to help
|
||||
- the OpenAPI Spec for reproducing the issue (:bulb: use [Gist](https://gist.github.com) to share). If the OpenAPI Spec cannot be shared publicly, it will be hard for the community to help
|
||||
- version of Swagger Codegen
|
||||
- language (`-l` in the command line, e.g. java, csharp, php)
|
||||
- You can also make a suggestion or ask a question by opening an "issue"
|
||||
@ -56,7 +56,7 @@ To start the CI tests, you can run `mvn verify -Psamples` (assuming you've all t
|
||||
|
||||
### Tips
|
||||
- Smaller changes are easier to review
|
||||
- [Optional] For bug fixes, provide a Swagger spec to repeat the issue so that the reviewer can use it to confirm the fix
|
||||
- [Optional] For bug fixes, provide a OpenAPI Spec to repeat the issue so that the reviewer can use it to confirm the fix
|
||||
- Add test case(s) to cover the change
|
||||
- Document the fix in the code to make the code more readable
|
||||
- Make sure test cases passed after the change (one way is to leverage https://travis-ci.org/ to run the CI tests)
|
||||
|
16
README.md
16
README.md
@ -8,7 +8,7 @@
|
||||
## Overview
|
||||
This is the swagger codegen project, which allows generation of client libraries automatically from a Swagger-compliant server.
|
||||
|
||||
Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more.
|
||||
Check out [Swagger-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the Swagger project, including additional libraries with support for other languages and more.
|
||||
|
||||
# Table of contents
|
||||
|
||||
@ -32,7 +32,7 @@ Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additi
|
||||
- [Where is Javascript???](#where-is-javascript)
|
||||
- [Generating a client from local files](#generating-a-client-from-local-files)
|
||||
- [Customizing the generator](#customizing-the-generator)
|
||||
- [Validating your swagger spec](#validating-your-swagger-spec)
|
||||
- [Validating your OpenAPI Spec](#validating-your-swagger-spec)
|
||||
- [Generating dynamic html api documentation](#generating-dynamic-html-api-documentation)
|
||||
- [Generating static html api documentation](#generating-static-html-api-documentation)
|
||||
- [To build a server stub](#to-build-a-server-stub)
|
||||
@ -50,9 +50,9 @@ Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additi
|
||||
|
||||
|
||||
## Compatibility
|
||||
The Swagger Specification has undergone 3 revisions since initial creation in 2010. The swagger-codegen project has the following compatibilies with the swagger specification:
|
||||
The OpenAPI Specification has undergone 3 revisions since initial creation in 2010. The swagger-codegen project has the following compatibilies with the OpenAPI Specification:
|
||||
|
||||
Swagger Codegen Version | Release Date | Swagger Spec compatibility | Notes
|
||||
Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes
|
||||
-------------------------- | ------------ | -------------------------- | -----
|
||||
2.1.5-SNAPSHOT | | 1.0, 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-codegen)
|
||||
2.1.4 (**current stable**) | 2015-10-25 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.4](https://github.com/swagger-api/swagger-codegen/tree/v2.1.4)
|
||||
@ -177,7 +177,7 @@ OPTIONS
|
||||
name=value,name=value
|
||||
|
||||
-i <spec file>, --input-spec <spec file>
|
||||
location of the swagger spec, as URL or file (required)
|
||||
location of the OpenAPI Spec, as URL or file (required)
|
||||
|
||||
-l <language>, --lang <language>
|
||||
client language to generate (maybe class name in classpath,
|
||||
@ -248,12 +248,12 @@ java -cp output/myLibrary/target/myClientCodegen-swagger-codegen-1.0.0.jar:modul
|
||||
### Where is Javascript???
|
||||
See our [javascript library](http://github.com/swagger-api/swagger-js)--it's completely dynamic and doesn't require
|
||||
static code generation.
|
||||
There is a third-party component called [swagger-js-codegen](https://github.com/wcandillon/swagger-js-codegen) that can generate angularjs or nodejs source code from a swagger specification.
|
||||
There is a third-party component called [swagger-js-codegen](https://github.com/wcandillon/swagger-js-codegen) that can generate angularjs or nodejs source code from a OpenAPI Specification.
|
||||
|
||||
:exclamation: On Dec 7th 2015, a Javascript API client generator has been added by @jfiala.
|
||||
|
||||
### Generating a client from local files
|
||||
If you don't want to call your server, you can save the swagger spec files into a directory and pass an argument
|
||||
If you don't want to call your server, you can save the OpenAPI Spec files into a directory and pass an argument
|
||||
to the code generator like this:
|
||||
|
||||
```
|
||||
@ -450,7 +450,7 @@ Or for multiple mappings:
|
||||
Pet=my.models.MyPet,Order=my.models.MyOrder
|
||||
```
|
||||
|
||||
### Validating your swagger spec
|
||||
### Validating your OpenAPI Spec
|
||||
|
||||
You have options. The easiest is to use our [online validator](https://github.com/swagger-api/validator-badge) which not only will let you validate your spec, but with the debug flag, you can see what's wrong with your spec. For example:
|
||||
|
||||
|
@ -37,7 +37,7 @@ mvn clean compile
|
||||
|
||||
### General Configuration parameters
|
||||
|
||||
- `inputSpec` - swagger spec file path
|
||||
- `inputSpec` - OpenAPI Spec file path
|
||||
- `language` - target generation language
|
||||
- `output` - target output path (default is `${project.build.directory}/generated-sources/swagger`)
|
||||
- `templateDirectory` - directory with mustache templates
|
||||
|
@ -563,7 +563,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
Map<String, SecuritySchemeDefinition> authMethods = new HashMap<String, SecuritySchemeDefinition>();
|
||||
// NOTE: Use only the first security requirement for now.
|
||||
// See the "security" field of "Swagger Object":
|
||||
// https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#swagger-object
|
||||
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swagger-object
|
||||
// "there is a logical OR between the security requirements"
|
||||
if (securities.size() > 1) {
|
||||
LOGGER.warn("More than 1 security requirements are found, using only the first one");
|
||||
|
@ -76,7 +76,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
String primitives = "'" + StringUtils.join(languageSpecificPrimitives, "', '") + "'";
|
||||
additionalProperties.put("primitives", primitives);
|
||||
|
||||
// ref: https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#data-types
|
||||
// ref: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping.put("integer", "int");
|
||||
typeMapping.put("long", "int");
|
||||
|
@ -65,7 +65,7 @@ public class SilexServerCodegen extends DefaultCodegen implements CodegenConfig
|
||||
instantiationTypes.put("array", "array");
|
||||
instantiationTypes.put("map", "map");
|
||||
|
||||
// ref: https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#data-types
|
||||
// ref: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping.put("integer", "int");
|
||||
typeMapping.put("long", "int");
|
||||
|
@ -67,7 +67,7 @@ public class SlimFrameworkServerCodegen extends DefaultCodegen implements Codege
|
||||
instantiationTypes.put("array", "array");
|
||||
instantiationTypes.put("map", "map");
|
||||
|
||||
// ref: https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#data-types
|
||||
// ref: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping.put("integer", "int");
|
||||
typeMapping.put("long", "int");
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Overview
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
||||
[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
is an example of building a swagger-enabled JAX-RS server.
|
||||
|
||||
This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework.
|
||||
|
@ -4,7 +4,7 @@ Spring MVC Server
|
||||
|
||||
|
||||
## Overview
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. This is an example of building a swagger-enabled server in Java using the Spring MVC framework.
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. This is an example of building a swagger-enabled server in Java using the Spring MVC framework.
|
||||
|
||||
The underlying library integrating swagger to Spring-MVC is [springfox](https://github.com/springfox/springfox)
|
||||
|
||||
|
@ -9,7 +9,7 @@ your changes applied.
|
||||
The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service.
|
||||
|
||||
|
||||
Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more.
|
||||
Check out [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the Swagger project, including additional libraries with support for other languages and more.
|
||||
|
||||
## How do I use this?
|
||||
At this point, you've likely generated a client setup. It will include something along these lines:
|
||||
@ -62,7 +62,7 @@ the object you have available during client generation:
|
||||
|
||||
```
|
||||
# The following additional debug options are available for all codegen targets:
|
||||
# -DdebugSwagger prints the swagger specification as interpreted by the codegen
|
||||
# -DdebugSwagger prints the OpenAPI Specification as interpreted by the codegen
|
||||
# -DdebugModels prints models passed to the template engine
|
||||
# -DdebugOperations prints operations passed to the template engine
|
||||
# -DdebugSupportingFiles prints additional data passed to the template engine
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Overview
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
||||
[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
is an example of building a swagger-enabled flask server.
|
||||
|
||||
This example uses the [connexion](https://github.com/zalando/connexion) library on top of Flask.
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Swagger generated server
|
||||
|
||||
## Overview
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate a server stub. This is an example of building a node.js server.
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. This is an example of building a node.js server.
|
||||
|
||||
This example uses the [expressjs](http://expressjs.com/) framework. To see how to make this your own, look here:
|
||||
|
||||
|
@ -345,7 +345,7 @@ sub update_params_for_auth {
|
||||
|
||||
# The endpoint API class has not found any settings for auth. This may be deliberate,
|
||||
# in which case update_params_for_auth() will be a no-op. But it may also be that the
|
||||
# swagger spec does not describe the intended authorization. So we check in the config for any
|
||||
# OpenAPI Spec does not describe the intended authorization. So we check in the config for any
|
||||
# auth tokens and if we find any, we use them for all endpoints;
|
||||
sub _global_auth_setup {
|
||||
my ($self, $header_params, $query_params) = @_;
|
||||
|
@ -20,7 +20,7 @@ WWW::{{moduleName}}::ApiFactory for non-Moosey usage.
|
||||
# SYNOPSIS
|
||||
|
||||
The Perl Swagger Codegen project builds a library of Perl modules to interact with
|
||||
a web service defined by a Swagger specification. See below for how to build the
|
||||
a web service defined by a OpenAPI Specification. See below for how to build the
|
||||
library.
|
||||
|
||||
This module provides an interface to the generated library. All the classes,
|
||||
@ -56,7 +56,7 @@ For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
|
||||
|
||||
## Configuring authentication
|
||||
|
||||
In the normal case, the Swagger spec will describe what parameters are
|
||||
In the normal case, the OpenAPI Spec will describe what parameters are
|
||||
required and where to put them. You just need to supply the tokens.
|
||||
|
||||
my $tokens = {
|
||||
@ -203,7 +203,7 @@ output formats are supported:
|
||||
The `-c` option allows you to load and inspect your own application. A dummy
|
||||
namespace is used if you don't supply your own class.
|
||||
|
||||
# DOCUMENTATION FROM THE SWAGGER SPEC
|
||||
# DOCUMENTATION FROM THE OpenAPI Spec
|
||||
|
||||
Additional documentation for each class and method may be provided by the Swagger
|
||||
spec. If so, this is available via the `class_documentation()` and
|
||||
|
@ -119,7 +119,7 @@ WWW::{{moduleName}}::ApiFactory for non-Moosey usage.
|
||||
=head1 SYNOPSIS
|
||||
|
||||
The Perl Swagger Codegen project builds a library of Perl modules to interact with
|
||||
a web service defined by a Swagger specification. See below for how to build the
|
||||
a web service defined by a OpenAPI Specification. See below for how to build the
|
||||
library.
|
||||
|
||||
This module provides an interface to the generated library. All the classes,
|
||||
@ -154,7 +154,7 @@ For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
|
||||
|
||||
=head2 Configuring authentication
|
||||
|
||||
In the normal case, the Swagger spec will describe what parameters are
|
||||
In the normal case, the OpenAPI Spec will describe what parameters are
|
||||
required and where to put them. You just need to supply the tokens.
|
||||
|
||||
my $tokens = {
|
||||
@ -304,7 +304,7 @@ output formats are supported:
|
||||
The C<-c> option allows you to load and inspect your own application. A dummy
|
||||
namespace is used if you don't supply your own class.
|
||||
|
||||
=head1 DOCUMENTATION FROM THE SWAGGER SPEC
|
||||
=head1 DOCUMENTATION FROM THE OpenAPI Spec
|
||||
|
||||
Additional documentation for each class and method may be provided by the Swagger
|
||||
spec. If so, this is available via the C<class_documentation()> and
|
||||
|
@ -516,7 +516,7 @@ class Configuration
|
||||
$report = "PHP SDK ({{invokerPackage}}) Debug Report:\n";
|
||||
$report .= " OS: ".php_uname()."\n";
|
||||
$report .= " PHP Version: ".phpversion()."\n";
|
||||
$report .= " Swagger Spec Version: {{version}}\n";
|
||||
$report .= " OpenAPI Spec Version: {{version}}\n";
|
||||
$report .= " SDK Package Version: {{artifactVersion}}\n";
|
||||
$report .= " Temp Folder Path: ".self::getDefaultConfiguration()->getTempFolderPath()."\n";
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Overview
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
||||
[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
is an example of building a swagger-enabled scalatra server.
|
||||
|
||||
This example uses the [scalatra](http://scalatra.org/) framework. To see how to make this your own, look here:
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Overview
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
||||
[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
is an example of building a PHP server.
|
||||
|
||||
This example uses the [Silex](http://silex.sensiolabs.org/) micro-framework. To see how to make this your own, please take a look at the template here:
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Overview
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
||||
[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
is an example of building a PHP server.
|
||||
|
||||
This example uses the [Slim Framework](http://www.slimframework.com/). To see how to make this your own, please take a look at the template here:
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Swagger Spec Validator</title>
|
||||
<title>OpenAPI Spec Validator</title>
|
||||
|
||||
<style>
|
||||
html, body, div, span, applet, object, iframe,
|
||||
@ -207,7 +207,7 @@
|
||||
<div id="header">
|
||||
<div class="container">
|
||||
<h1 id="logo">
|
||||
<a href="http://swagger.io">swagger spec validator</a>
|
||||
<a href="http://swagger.io">OpenAPI Spec validator</a>
|
||||
</h1>
|
||||
<ul id="nav">
|
||||
<li class="first odd"><a href="http://swagger.io/">Home</a></li>
|
||||
|
@ -20,7 +20,7 @@ WWW::SwaggerClient::ApiFactory for non-Moosey usage.
|
||||
# SYNOPSIS
|
||||
|
||||
The Perl Swagger Codegen project builds a library of Perl modules to interact with
|
||||
a web service defined by a Swagger specification. See below for how to build the
|
||||
a web service defined by a OpenAPI Specification. See below for how to build the
|
||||
library.
|
||||
|
||||
This module provides an interface to the generated library. All the classes,
|
||||
@ -56,7 +56,7 @@ For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
|
||||
|
||||
## Configuring authentication
|
||||
|
||||
In the normal case, the Swagger spec will describe what parameters are
|
||||
In the normal case, the OpenAPI Spec will describe what parameters are
|
||||
required and where to put them. You just need to supply the tokens.
|
||||
|
||||
my $tokens = {
|
||||
@ -203,7 +203,7 @@ output formats are supported:
|
||||
The `-c` option allows you to load and inspect your own application. A dummy
|
||||
namespace is used if you don't supply your own class.
|
||||
|
||||
# DOCUMENTATION FROM THE SWAGGER SPEC
|
||||
# DOCUMENTATION FROM THE OpenAPI Spec
|
||||
|
||||
Additional documentation for each class and method may be provided by the Swagger
|
||||
spec. If so, this is available via the `class_documentation()` and
|
||||
|
@ -20,7 +20,7 @@ You first need to build the `swagger-codegen` project--this is done by running t
|
||||
mvn package
|
||||
```
|
||||
|
||||
You can now generate a server from any valid[**](https://github.com/wordnik/swagger-codegen/blob/master/README.md#validating-your-swagger-spec) swagger spec:
|
||||
You can now generate a server from any valid[**](https://github.com/wordnik/swagger-codegen/blob/master/README.md#validating-your-swagger-spec) OpenAPI Spec:
|
||||
|
||||
```
|
||||
./bin/runscala.sh samples/server-generator/node/NodeServerFromSpec.scala http://petstore.swagger.wordnik.com/api/api-docs special-key
|
||||
|
@ -20,7 +20,7 @@ You first need to build the `swagger-codegen` project--this is done by running t
|
||||
mvn package
|
||||
```
|
||||
|
||||
You can now generate a server from any valid[**](https://github.com/swagger-api/swagger-codegen/blob/master/README.md#validating-your-swagger-spec) swagger spec:
|
||||
You can now generate a server from any valid[**](https://github.com/swagger-api/swagger-codegen/blob/master/README.md#validating-your-swagger-spec) OpenAPI Spec:
|
||||
|
||||
```
|
||||
./bin/runscala.sh samples/server-generator/php/PHPServerFromSpec.scala http://petstore.swagger.wordnik.com/api/api-docs special-key
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Overview
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
||||
[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
is an example of building a PHP server.
|
||||
|
||||
This example uses the [Silex](http://silex.sensiolabs.org/) micro-framework. To see how to make this your own, look here:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Swagger generated server
|
||||
|
||||
## Overview
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate a server stub. This is an example of building a node.js server.
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. This is an example of building a node.js server.
|
||||
|
||||
This example uses the [expressjs](http://expressjs.com/) framework. To see how to make this your own, look here:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user