forked from loafle/openapi-generator-original
Merge branch 'master' of https://github.com/swagger-api/swagger-codegen
This commit is contained in:
commit
ec38afde0a
@ -729,6 +729,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
|
||||
- [Activehours](https://www.activehours.com/)
|
||||
- [Acunetix](https://www.acunetix.com/)
|
||||
- [Atlassian](https://www.atlassian.com/)
|
||||
- [beemo](http://www.beemo.eu)
|
||||
- [CloudBoost](https://www.CloudBoost.io/)
|
||||
- [Cupix](http://www.cupix.com)
|
||||
- [DocuSign](https://www.docusign.com)
|
||||
@ -736,8 +737,10 @@ Here are some companies/projects using Swagger Codegen in production. To add you
|
||||
- [eureka](http://eure.jp/)
|
||||
- [everystory.us](http://everystory.us)
|
||||
- [Expected Behavior](http://www.expectedbehavior.com/)
|
||||
- [FH Münster - University of Applied Sciences](http://www.fh-muenster.de)
|
||||
- [LANDR Audio](https://www.landr.com/)
|
||||
- [LiveAgent](https://www.ladesk.com/)
|
||||
- [Kuary](https://kuary.com/)
|
||||
- [nViso](http://www.nviso.ch/)
|
||||
- [Okiok](https://www.okiok.com)
|
||||
- [OSDN](https://osdn.jp)
|
||||
|
@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l nodejs -o samples/server/petstore/nodejs"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l nodejs-server -o samples/server/petstore/nodejs"
|
||||
|
||||
java $JAVA_OPTS -Dservice -jar $executable $ags
|
||||
|
@ -123,7 +123,7 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "nodejs";
|
||||
return "nodejs-server";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -12,7 +12,7 @@ public class NodeJSServerOptionsProvider implements OptionsProvider {
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "nodejs";
|
||||
return "nodejs-server";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,11 +1,11 @@
|
||||
# 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/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 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:
|
||||
|
||||
[README](https://github.com/swagger-api/swagger-codegen/README.md)
|
||||
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)
|
||||
|
||||
### Running the server
|
||||
To run the server, follow these simple steps:
|
||||
@ -21,4 +21,4 @@ To view the Swagger UI interface:
|
||||
open http://localhost:8080/docs
|
||||
```
|
||||
|
||||
This project leverages the mega-awesome [swagger-tools](https://github.com/apigee-127/swagger-tools) middleware which does most all the work.
|
||||
This project leverages the mega-awesome [swagger-tools](https://github.com/apigee-127/swagger-tools) middleware which does most all the work.
|
||||
|
@ -271,6 +271,68 @@ paths:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
/pet/{petId}?testing_byte_array=true:
|
||||
get:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "Fake endpoint to test byte array return by 'Find pet by ID'"
|
||||
description: "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate\
|
||||
\ API error conditions"
|
||||
operationId: "getPetByIdWithByteArray"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
description: "ID of pet that needs to be fetched"
|
||||
required: true
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
type: "string"
|
||||
format: "binary"
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
404:
|
||||
description: "Pet not found"
|
||||
security:
|
||||
- api_key: []
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
/pet?testing_byte_array=true:
|
||||
post:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "Fake endpoint to test byte array in body parameter for adding a new\
|
||||
\ pet to the store"
|
||||
description: ""
|
||||
operationId: "addPetUsingByteArray"
|
||||
consumes:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Pet object in the form of byte array"
|
||||
required: false
|
||||
schema:
|
||||
type: "string"
|
||||
format: "binary"
|
||||
responses:
|
||||
405:
|
||||
description: "Invalid input"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
/store/inventory:
|
||||
get:
|
||||
tags:
|
||||
|
@ -37,3 +37,11 @@ module.exports.deletePet = function deletePet (req, res, next) {
|
||||
module.exports.uploadFile = function uploadFile (req, res, next) {
|
||||
Pet.uploadFile(req.swagger.params, res, next);
|
||||
};
|
||||
|
||||
module.exports.getPetByIdWithByteArray = function getPetByIdWithByteArray (req, res, next) {
|
||||
Pet.getPetByIdWithByteArray(req.swagger.params, res, next);
|
||||
};
|
||||
|
||||
module.exports.addPetUsingByteArray = function addPetUsingByteArray (req, res, next) {
|
||||
Pet.addPetUsingByteArray(req.swagger.params, res, next);
|
||||
};
|
||||
|
@ -168,5 +168,39 @@ var examples = {};
|
||||
|
||||
|
||||
|
||||
res.end();
|
||||
}
|
||||
exports.getPetByIdWithByteArray = function(args, res, next) {
|
||||
/**
|
||||
* parameters expected in the args:
|
||||
* petId (Long)
|
||||
**/
|
||||
|
||||
var examples = {};
|
||||
|
||||
examples['application/json'] = "";
|
||||
|
||||
|
||||
|
||||
if(Object.keys(examples).length > 0) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
|
||||
}
|
||||
else {
|
||||
res.end();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
exports.addPetUsingByteArray = function(args, res, next) {
|
||||
/**
|
||||
* parameters expected in the args:
|
||||
* body (byte[])
|
||||
**/
|
||||
|
||||
var examples = {};
|
||||
|
||||
|
||||
|
||||
res.end();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ var examples = {};
|
||||
"complete" : true,
|
||||
"status" : "aeiou",
|
||||
"quantity" : 123,
|
||||
"shipDate" : "2015-11-18T02:43:54.540+0000"
|
||||
"shipDate" : "2016-01-24T14:07:57.768+0000"
|
||||
};
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ var examples = {};
|
||||
"complete" : true,
|
||||
"status" : "aeiou",
|
||||
"quantity" : 123,
|
||||
"shipDate" : "2015-11-18T02:43:54.544+0000"
|
||||
"shipDate" : "2016-01-24T14:07:57.780+0000"
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "",
|
||||
"name": "swagger-petstore",
|
||||
"version": "1.0.0",
|
||||
"description": "This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters",
|
||||
"main": "index.js",
|
||||
|
Loading…
x
Reference in New Issue
Block a user