Code Monkey home page Code Monkey logo

swagger-api / swagger-codegen Goto Github PK

View Code? Open in Web Editor NEW
16.6K 415.0 6.0K 102.8 MB

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.

Home Page: http://swagger.io

License: Apache License 2.0

Shell 5.06% Java 37.78% HTML 0.10% Scala 0.26% ActionScript 0.25% CSS 0.06% JavaScript 0.09% Ruby 0.29% Batchfile 0.56% PHP 0.15% TypeScript 1.34% Apex 0.32% PowerShell 0.01% Rust 0.01% C# 0.31% Perl 0.02% Dockerfile 0.02% Mustache 53.39%
swagger swagger-codegen rest rest-api openapi-specification openapi3 open-source swagger-oss

swagger-codegen's Issues

Ruby client should use lowercase file names

Line 39 from BasicRubyGenerator.scala:

  // template used for models
  modelTemplateFiles += "model.mustache" -> ".rb"

EDIT: I guess the change should come from https://github.com/wordnik/swagger-codegen/blob/master/src/main/scala/com/wordnik/swagger/codegen/BasicGenerator.scala

This should ensure the first character is lowercase. I wouldn't mind trying to fix this...it would be a fun bug to squash. I just have to learn some Scala first.

Suggested fix:

  1. Create BasicGenerator#modelFiles that returns an array of the model files (I have no idea what the scala appropriate data structure is here).
  2. In BasicRubyGenerator, override the method, call super on it, whatever way scala lets you do this, call map on the result and lowercase all the filenames.

NoClassDefFoundError when running ./bin/scala-petstore.sh

Full output of error:
java.lang.NoClassDefFoundError: com/wordnik/swagger/model/ModelProperty
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getMethod0(Class.java:2670)
at java.lang.Class.getMethod(Class.java:1603)
at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:67)
at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:139)
at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:28)
at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:45)
at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:35)
at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:45)
at scala.tools.nsc.ScriptRunner.scala$tools$nsc$ScriptRunner$$runCompiled(ScriptRunner.scala:171)
at scala.tools.nsc.ScriptRunner$$anonfun$runScript$1.apply(ScriptRunner.scala:188)
at scala.tools.nsc.ScriptRunner$$anonfun$runScript$1.apply(ScriptRunner.scala:188)
at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply$mcZ$sp(ScriptRunner.scala:157)
at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply(ScriptRunner.scala:131)
at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply(ScriptRunner.scala:131)
at scala.tools.nsc.util.package$.trackingThreads(package.scala:51)
at scala.tools.nsc.util.package$.waitingForThreads(package.scala:35)
at scala.tools.nsc.ScriptRunner.withCompiledScript(ScriptRunner.scala:130)
at scala.tools.nsc.ScriptRunner.runScript(ScriptRunner.scala:188)
at scala.tools.nsc.ScriptRunner.runScriptAndCatch(ScriptRunner.scala:201)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:76)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
Caused by: java.lang.ClassNotFoundException: com.wordnik.swagger.model.ModelProperty
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 25 more

Any ideas? No idea with this one myself...
Here are the various versions of software I'm using in relation to this:
uname -a
Darwin P21277.local 12.2.1 Darwin Kernel Version 12.2.1: Thu Oct 18 16:32:48 PDT 2012; root:xnu-2050.20.9~2/RELEASE_X86_64 x86_64

java -version
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)

mvn -version:
Apache Maven 3.0.3 (r1075438; 2011-03-01 02:31:09+0900)

Thanks!

Commit 885cd36165f50ed26ddc2c30a34d784fc525e615 breaks the test

Hi!

I found out that the latest commit (885cd36) breaks the test suite and doesn't let to compile the whole project.

The reason is in

src/main/scala/com/wordnik/swagger/model/SwaggerModelSerializer.scala

You should change the line 201

("method" -> x.httpMethod) ~

to

("hhtpMethod" -> x.httpMethod) ~

Create statis js library

The dynamic ds library is nice, but we need a static one too to avoid calls to the server as well as allow easier introspection.

java required parameter checking should occur prior to parameter use

Looking at api.mustache, note that a pathParam that is required will be used in apiInvoker.escapeString(), which will trigger a NullPointer rather than the expected ApiException

    // create path and map variables
    String path = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{paramName}}" + "\\}", apiInvoker.escapeString({{{paramName}}}.toString())){{/pathParams}};
...
    {{#requiredParamCount}}
    // verify required params are set
    if({{/requiredParamCount}}{{#requiredParams}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/requiredParams}}{{#requiredParamCount}}) {
       throw new ApiException(400, "missing required params");
    }
    {{/requiredParamCount}}

Consider reordering the parameter checking to the top for consistent exception generation.

Note the generated code will show warnings about dead code in various IDEs when checking opaqueId == null.

  public String getOriginalId (String opaqueId) throws ApiException {
    // create path and map variables
    String path = "/originalid/{opaqueId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "opaqueId" + "\\}", apiInvoker.escapeString(opaqueId.toString()));
...
    // verify required params are set
    if(opaqueId == null ) {
       throw new ApiException(400, "missing required params");
    }

Added support for generate Javadoc

Hi.

It seems the generation of Javadoc is not supported so far. I think it will be a great feature to add. The description of parameters can be taken from the JSON spec so it should be straightforward.

Problem with Model containing an `Array` property

I came across this while testing my api resourses.json with the validator

./bin/validate.sh http://localhost/restler3.dev/raw/swagger/resources.json "arul" ./swagger-errors.html

is throwing the following exception when my Author model contains a property called books of type Array

api.path: /resources/authors.{format}
calling: http://localhost/restler3.dev/raw/swagger/resources/authors.json?api_key=arul
swagger version: 1.1
basePath: http://localhost/restler3.dev/raw/swagger
api version: 1
java.lang.NullPointerException
    at com.wordnik.swagger.codegen.util.CoreUtils$$anonfun$extractModels$4$$anonfun$apply$11.apply(CoreUtils.scala:138)
    at com.wordnik.swagger.codegen.util.CoreUtils$$anonfun$extractModels$4$$anonfun$apply$11.apply(CoreUtils.scala:135)
    at scala.collection.Iterator$class.foreach(Iterator.scala:660)
    at scala.collection.JavaConversions$JMapWrapperLike$$anon$2.foreach(JavaConversions.scala:781)
    at scala.collection.IterableLike$class.foreach(IterableLike.scala:73)
    at scala.collection.JavaConversions$JMapWrapper.foreach(JavaConversions.scala:792)
    at com.wordnik.swagger.codegen.util.CoreUtils$$anonfun$extractModels$4.apply(CoreUtils.scala:135)
    at com.wordnik.swagger.codegen.util.CoreUtils$$anonfun$extractModels$4.apply(CoreUtils.scala:134)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:93)
    at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:93)
    at scala.collection.Iterator$class.foreach(Iterator.scala:660)
    at scala.collection.mutable.HashTable$$anon$1.foreach(HashTable.scala:157)
    at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:190)
    at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:43)
    at scala.collection.mutable.HashMap.foreach(HashMap.scala:93)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
    at scala.collection.mutable.HashMap.map(HashMap.scala:43)
    at com.wordnik.swagger.codegen.util.CoreUtils$.extractModels(CoreUtils.scala:134)
    at com.wordnik.swagger.codegen.util.CoreUtils$$anonfun$extractAllModels$1.apply(CoreUtils.scala:45)
    at com.wordnik.swagger.codegen.util.CoreUtils$$anonfun$extractAllModels$1.apply(CoreUtils.scala:44)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at com.wordnik.swagger.codegen.util.CoreUtils$.extractAllModels(CoreUtils.scala:44)
    at com.wordnik.swagger.codegen.spec.SwaggerSpecValidator.validateResponseModels(SwaggerSpecValidator.scala:63)
    at com.wordnik.swagger.codegen.spec.SwaggerSpecValidator.validate(SwaggerSpecValidator.scala:57)
    at com.wordnik.swagger.codegen.spec.Validator$.main(Validator.scala:54)
    at com.wordnik.swagger.codegen.spec.Validator.main(Validator.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:78)
    at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:24)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:88)
    at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:78)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:101)
    at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:33)
    at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:40)
    at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:56)
    at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:80)
    at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:89)
    at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

Here is the /resources/authors.json for your reference

{
  "apiVersion": "1",
  "swaggerVersion": "1.1",
  "basePath": "http://localhost/restler3.dev/raw/swagger",
  "apis": [
    {
      "path": "/authors.{format}/{id}",
      "description": "API to list, modify Authors of the Restler",
      "operations": [
        {
          "httpMethod": "GET",
          "nickname": "authorsid",
          "responseClass": "Author",
          "parameters": [
            {
              "name": "id",
              "description": "Author ID . ",
              "paramType": "path",
              "required": true,
              "allowMultiple": false,
              "dataType": "string"
            }
          ],
          "summary": "Get Author for the specified Author ID",
          "notes": "Passing a valid author id, will result in getting details (name, email, author id) of the specific Author.",
          "errorResponses": [
            {
              "reason": "one or more of required fields missing",
              "code": 417
            },
            {
              "reason": "Author not found",
              "code": 404
            }
          ]
        }
      ]
    },
    {
      "path": "/authors.{format}",
      "description": "API to list, modify Authors of the Restler",
      "operations": [
        {
          "httpMethod": "POST",
          "nickname": "authors",
          "responseClass": "Array",
          "parameters": [
            {
              "name": "request_data",
              "description": "",
              "paramType": "path",
              "required": true,
              "allowMultiple": false,
              "dataType": "string"
            }
          ],
          "summary": "Create new Author",
          "notes": "",
          "errorResponses": [
            {
              "reason": "one or more of required fields missing",
              "code": 417
            }
          ]
        }
      ]
    },
    {
      "path": "/authors.{format}/{id}",
      "description": "API to list, modify Authors of the Restler",
      "operations": [
        {
          "httpMethod": "PUT",
          "nickname": "authorsid",
          "responseClass": "Array",
          "parameters": [
            {
              "name": "id",
              "description": "Author ID . ",
              "paramType": "path",
              "required": true,
              "allowMultiple": false,
              "dataType": "string"
            },
            {
              "name": "request_data",
              "description": "",
              "paramType": "path",
              "required": true,
              "allowMultiple": false,
              "dataType": "string"
            }
          ],
          "summary": "Update Author information",
          "notes": "",
          "errorResponses": [

          ]
        }
      ]
    },
    {
      "path": "/authors.{format}/something/{id}",
      "description": "API to list, modify Authors of the Restler",
      "operations": [
        {
          "httpMethod": "DELETE",
          "nickname": "authorssomethingid",
          "responseClass": "Array",
          "parameters": [
            {
              "name": "id",
              "description": "Author ID . ",
              "paramType": "path",
              "required": true,
              "allowMultiple": false,
              "dataType": "string"
            }
          ],
          "summary": "Delete Author by ID",
          "notes": "",
          "errorResponses": [

          ]
        }
      ]
    }
  ],
  "resourcePath": "/authors",
  "models": {
    "Author": {
      "id": "Author",
      "properties": {
        "name": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "age": {
          "type": "int"
        },
        "books": {
          "type": "Array"
        }
      }
    }
  }
}

if I remove , "books":{ "type":"Array"} validator is fine

Issues with running ./bin/scala-petstore.sh (following README)

Hi there,

As a continuation of the issue reported at #64 I am still having problems following the readme as is. Now, upon execution of ./bin/scala-petstore.sh I get the following output at the end of the script running:

[info] Assembly up to date: /Users/william.conroy/Development/swagger-codegen/target/scala-2.9.2/swagger-codegen.jar
[success] Total time: 10 s, completed Jun 27, 2013 10:16:31 AM
/Users/william.conroy/Development/swagger-codegen/samples/client/petstore/scala/ScalaPetstoreCodegen.scala:17: error: object wordnik is not a member of package com
import com.wordnik.swagger.codegen.BasicScalaGenerator
^
/Users/william.conroy/Development/swagger-codegen/samples/client/petstore/scala/ScalaPetstoreCodegen.scala:20: error: not found: value generateClient
def main(args: Array[String]) = generateClient(args)
^
two errors found

It looks like some kind of issue with scala identifying the generators location...

HTTP Request method type not being set correctly in Python 3 generation

In swagger.mustache, the "MethodRequest"'s method get_method wasn't properly being called. I removed this method and it uses urllib's default get_method's and chooses a POST request when the 'data' parameter is set. It works after doing this, but there may be a better solution. Probably the Pyton 2 -> 3 refactor of urllib/urllib2 caused this.

Support for Produces or operation that serves a file download

Hello,

Thanks for your excellent work on swagger-codegen. I am attempting to use it to produce client libraries for an API in which one operation may return a response with a Content-Type of either "application/pdf", "application/csv", or "application/html" depending on a parameter. The response body will contain the bytes of a PDF, CSV, or HTML file.

If it helps, my swagger spec for this operation is more or less the following:

{
    "path":"/jobs/{job_id}/result",
    "description":"Job results",
    "operations":[{
      "httpMethod":"GET",
      "nickname":"getJobResult",
      "produces":["application/pdf","application/csv","application/html"],
      "responseClass":"byte",
      "parameters":[{
        "paramType":"path",
        "name":"job_id",
        "description":"job_id",
        "dataType":"string",
        "required":false,
        "allowMultiple":false,
        "defaultValue":null
      },{
        "paramType":"header",
        "name":"Accept",
        "description":"Accept",
        "dataType":"string",
        "required":false,
        "allowMultiple":false,
        "defaultValue":null
      }],
      "summary":"",
      "notes":"",
      "errorResponses":[]
}]
}

Any advice is greatly appreciated.

Parsing exception with swagger interface generated with grape-swagger gem

I have a Ruby project that defines a REST API using the grape gem. I am generating the swagger definition with the grape-swagger gem. The swagger definition grape-swagger generates works fine with swagger-ui. It's able to parse the display the API with no errors.

However, when I try to run the same swagger definition through the swagger-codegen validate.sh script, it throws the following exception:

[brian@master swagger-codegen]$ ./bin/validate.sh http://localhost:3000/swagger_doc.json
calling: http://localhost:3000/swagger_doc/users.json
org.json4s.MappingException: Did not find value which can be converted into java.lang.String
    at org.json4s.Extraction$.convert(Extraction.scala:419)
    at org.json4s.Extraction$.build$1(Extraction.scala:325)
    at org.json4s.Extraction$.org$json4s$Extraction$$extract0(Extraction.scala:372)
    at org.json4s.Extraction$.org$json4s$Extraction$$extract0(Extraction.scala:212)
    at org.json4s.Extraction$.extract(Extraction.scala:47)
    at org.json4s.JsonAST$JValue.extract(JsonAST.scala:384)
    at com.wordnik.swagger.model.SwaggerSerializers$OperationSerializer$$anonfun$$init$$6$$anonfun$apply$27.apply(SwaggerModelSerializer.scala:139)
    at com.wordnik.swagger.model.SwaggerSerializers$OperationSerializer$$anonfun$$init$$6$$anonfun$apply$27.apply(SwaggerModelSerializer.scala:132)
    at org.json4s.CustomSerializer$$anonfun$deserialize$2.apply(Formats.scala:273)
    at org.json4s.CustomSerializer$$anonfun$deserialize$2.apply(Formats.scala:271)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:46)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at org.json4s.Extraction$.newInstance$1(Extraction.scala:293)
    at org.json4s.Extraction$.build$1(Extraction.scala:326)
    at org.json4s.Extraction$$anonfun$19.apply(Extraction.scala:316)
    at org.json4s.Extraction$$anonfun$19.apply(Extraction.scala:316)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
    at scala.collection.immutable.List.map(List.scala:45)
    at org.json4s.Extraction$.newCollection$1(Extraction.scala:316)
    at org.json4s.Extraction$.build$1(Extraction.scala:333)
    at org.json4s.Extraction$.org$json4s$Extraction$$extract0(Extraction.scala:372)
    at org.json4s.Extraction$.org$json4s$Extraction$$extract0(Extraction.scala:212)
    at org.json4s.Extraction$.extract(Extraction.scala:47)
    at org.json4s.JsonAST$JValue.extract(JsonAST.scala:384)
    at com.wordnik.swagger.model.SwaggerSerializers$ApiDescriptionSerializer$$anonfun$$init$$4$$anonfun$apply$18.apply(SwaggerModelSerializer.scala:101)
    at com.wordnik.swagger.model.SwaggerSerializers$ApiDescriptionSerializer$$anonfun$$init$$4$$anonfun$apply$18.apply(SwaggerModelSerializer.scala:95)
    at org.json4s.CustomSerializer$$anonfun$deserialize$2.apply(Formats.scala:273)
    at org.json4s.CustomSerializer$$anonfun$deserialize$2.apply(Formats.scala:271)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:46)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at org.json4s.Extraction$.newInstance$1(Extraction.scala:293)
    at org.json4s.Extraction$.build$1(Extraction.scala:326)
    at org.json4s.Extraction$$anonfun$19.apply(Extraction.scala:316)
    at org.json4s.Extraction$$anonfun$19.apply(Extraction.scala:316)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
    at scala.collection.immutable.List.map(List.scala:45)
    at org.json4s.Extraction$.newCollection$1(Extraction.scala:316)
    at org.json4s.Extraction$.build$1(Extraction.scala:333)
    at org.json4s.Extraction$.org$json4s$Extraction$$extract0(Extraction.scala:372)
    at org.json4s.Extraction$.org$json4s$Extraction$$extract0(Extraction.scala:212)
    at org.json4s.Extraction$.extract(Extraction.scala:47)
    at org.json4s.JsonAST$JValue.extract(JsonAST.scala:384)
    at com.wordnik.swagger.model.SwaggerSerializers$ApiListingSerializer$$anonfun$$init$$1$$anonfun$apply$2.apply(SwaggerModelSerializer.scala:32)
    at com.wordnik.swagger.model.SwaggerSerializers$ApiListingSerializer$$anonfun$$init$$1$$anonfun$apply$2.apply(SwaggerModelSerializer.scala:24)
    at org.json4s.CustomSerializer$$anonfun$deserialize$2.apply(Formats.scala:273)
    at org.json4s.CustomSerializer$$anonfun$deserialize$2.apply(Formats.scala:271)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:46)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
    at org.json4s.Extraction$.newInstance$1(Extraction.scala:293)
    at org.json4s.Extraction$.build$1(Extraction.scala:326)
    at org.json4s.Extraction$.org$json4s$Extraction$$extract0(Extraction.scala:372)
    at org.json4s.Extraction$.org$json4s$Extraction$$extract0(Extraction.scala:212)
    at org.json4s.Extraction$.extract(Extraction.scala:47)
    at org.json4s.JsonAST$JValue.extract(JsonAST.scala:384)
    at com.wordnik.swagger.codegen.util.ApiExtractor$$anonfun$fetchApiListings$1.apply(ApiExtractor.scala:42)
    at com.wordnik.swagger.codegen.util.ApiExtractor$$anonfun$fetchApiListings$1.apply(ApiExtractor.scala:34)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
    at scala.collection.immutable.List.map(List.scala:45)
    at com.wordnik.swagger.codegen.util.ApiExtractor$.fetchApiListings(ApiExtractor.scala:34)
    at com.wordnik.swagger.codegen.spec.Validator$.main(Validator.scala:48)
    at com.wordnik.swagger.codegen.spec.Validator.main(Validator.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:78)
    at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:24)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:88)
    at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:78)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:101)
    at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:33)
    at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:40)
    at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:56)
    at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:80)
    at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:89)
    at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

Tracing through the scala code, it appears that the OperationSerializer is expecting a list of keys to be in the json document it's parsing. Specifically, the stack trace seems to be pointing to the missing "responseClass" key in the json document.

Unfortunately, the grape-swagger gem doesn't generate this key. When I curl the api that swagger-codegen is trying to parse (http://localhost:3000/swagger_doc/users.json), it only contains the following keys (notes, summary, nickname, httpMethod, parameters). See below:

[brian@master swagger-codegen]$ curl http://localhost:3000/swagger_doc/users.json
{
    "apiVersion": "v1",
    "swaggerVersion": "1.1",
    "basePath": "http://localhost:3000",
    "resourcePath": "",
    "apis": [
        {
            "path": "/v1/users/lock.{format}",
            "operations": [
                {
                    "notes": null,
                    "summary": "Lock User to ensure no more activity can resume with this users credentials",
                    "nickname": "POST--version-users-lock---format-",
                    "httpMethod": "POST",
                    "parameters": [
                        {
                            "paramType": "body",
                            "name": "auth_token",
                            "description": "Login Token",
                            "dataType": "String",
                            "required": true
                        }
                    ]
                }
            ]
        }
    ]
}

Since I am new to scala, it's difficult for me to understand exactly what is going on in the code. So it's possible I'm mis-reading this stack-trace. It's also possible the grape-swagger gem isn't fully implementing the swagger definition, in which case this is an issue for grape-swagger and not swagger-codegen (however that seems odd since swagger-ui can still parse it).

HTML in "implementation notes" is incorrectly HTML-encoded in comment headers of CSharp generated code.

When generating CSharp code, if swagger implementation notes contains HTML e.g. UL/LI list etc. - it becomes HTML encoded - and additionally the values can end up breaking over multiple lines, with only the first line starting with the "//" designating a comment.

This prevents the output from being compiled - here's an example of what that output looks like:

  /// <summary>
  /// Searches for assignees by partial name match &lt;strong&gt;Expanders:&lt;/strong&gt;&lt;br/&gt;&lt;ul&gt;&lt;li&gt;DisplayName&lt;/li&gt;
&lt;li&gt;Groups&lt;/li&gt;&lt;/ul&gt;
  /// </summary>
  /// <param name="projectId"></param>
  /// <param name="query"></param>
  /// <param name="$expand">Allows the specifying of eager-loading of related data which is returned in-line within the results of the request.</param>
  /// <returns></returns>

Allowable values model range min / max difficulties

When using a swagger json file with a model that has a range, there are some problems.

  1. SwaggerModelSerializer.scala uses keywords 'min' and 'max', where the spec uses 'minimum' and 'maximum'. See https://github.com/wordnik/swagger-core/wiki/Datatypes
  2. using 'min' and 'max', the AllowableRangeValues object is not created for simple property descriptors
  "properties": {
    "happiness": {
      "type": "integer",
      "format": "int32",
      "description": "how happy the Pet appears to be, where 10 is 'extremely happy'",
      "min": 1,
      "max": 10
    },

The snippet to extract min/max (used several times in different places) fails to pull string, integer, or double values

          val min = (json \ "min") match {
            case e: JObject => e.extract[String]
            case _ => ""
          }
          val max = (json \ "max") match {
            case e: JObject => e.extract[String]
            case _ => ""
          }

using this works

          val min = (json \ "min") match {
            case e: JObject => e.extract[String]
            case e: JString => e.s
            case e: JInt => e.num.toString
            case e: JDouble => e.num.toString          
            case _ => ""
          }
          val max = (json \ "max") match {
            case e: JObject => e.extract[String]
            case e: JString => e.s
            case e: JInt => e.num.toString
            case e: JDouble => e.num.toString          
            case _ => ""
          }
  1. probably this issue will occur in other places that provide min/max constraints, such as parameter handling, etc.

  2. probably should pull extraction into function.

eta. fix updated scala

invalid resource json does not produce error notice

I had an issue because of a json formatting error, but no notice of json error was shown.

Specifically, extra closing braces may not be noticed, leading to silent failures.
example added to petstore example.

The json libraries are not checking for unexpected trailing characters, often from incorrect json braces.

  "models": {
    "Tag": {
      "id": "Tag",
      "properties": {
        "name": {
          "type": "string"
        },
        "id": {
          "type": "integer",
          "format": "int64"
        }
      } }
    },...

running the codegen with this addition shows a missing model warning, but no report of bad json.

base path is src/test/resources/petstore-1.2
version: 1.2 basePath: src/test/resources/petstore-1.2 apiKey: Some(?api_key=special-key)
api.path: /pet
api.path: /store
api.path: /user
swagger version: 1.2
basePath: 
api version: 1.0.0
missing models: Set(Pet)
wrote model samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/User.java
wrote model samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Order.java
wrote api samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/UserApi.java
wrote api samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/PetApi.java
wrote api samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/StoreApi.java
wrote samples/client/petstore/java/src/main/java/com/wordnik/client//ApiInvoker.java
wrote samples/client/petstore/java/src/main/java/com/wordnik/client//JsonUtil.java
wrote samples/client/petstore/java/src/main/java/com/wordnik/client//ApiException.java
wrote samples/client/petstore/java/pom.xml

codegen fails on Windows

Getting an error when executing my runner on Windows. Most likely due to escaping paths and File.separator is different on Windows than it is on POSIX systems.

java.lang.StringIndexOutOfBoundsException: String index out of range: 1
        at java.lang.String.charAt(String.java:686)
        at java.util.regex.Matcher.appendReplacement(Matcher.java:703)
        at java.util.regex.Matcher.replaceAll(Matcher.java:813)
        at java.lang.String.replaceAll(String.java:2189)
        at com.wordnik.swagger.codegen.BasicGenerator$$anonfun$prepareModelMap$2.apply(BasicGenerator.scala:154)
        at com.wordnik.swagger.codegen.BasicGenerator$$anonfun$prepareModelMap$2.apply(BasicGenerator.scala:144)

Unable to read from http://petstore.swagger.wordnik.com/api/api-docs.json

Hi,

I am trying to use the codegen and running in to the below issue when ran against the perstore apis. I got Java 1.7, Scala 2.9.2 and Maven 3.1.0 on CentOS
And cloned the repo and executed the following commands

  • ./sbt assembly
  • ./bin/java-petstore.sh --- Here I got the below exception

Also I tried to use the './bin/java-petstore-filemap.sh -DfileMap=src/test/resources/petstore' and still getting same error.

Thank you for the help in resolving this issue.

[root@localhost swagger-codegen]# ./bin/java-petstore.sh
java.lang.Exception: unable to read from http://petstore.swagger.wordnik.com/api/api-docs.json
at com.wordnik.swagger.codegen.BasicGenerator.generateClient(BasicGenerator.scala:59)
at Main$.main(JavaPetstoreCodegen.scala:20)
at Main.main(JavaPetstoreCodegen.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:78)
at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:24)
at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:88)
at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:78)
at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:101)
at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:33)
at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:40)
at scala.tools.nsc.ScriptRunner.scala$tools$nsc$ScriptRunner$$runCompiled(ScriptRunner.scala:171)
at scala.tools.nsc.ScriptRunner$$anonfun$runScript$1.apply(ScriptRunner.scala:188)
at scala.tools.nsc.ScriptRunner$$anonfun$runScript$1.apply(ScriptRunner.scala:188)
at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply$mcZ$sp(ScriptRunner.scala:157)
at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply(ScriptRunner.scala:131)
at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply(ScriptRunner.scala:131)
at scala.tools.nsc.util.package$.waitingForThreads(package.scala:26)
at scala.tools.nsc.ScriptRunner.withCompiledScript(ScriptRunner.scala:130)
at scala.tools.nsc.ScriptRunner.runScript(ScriptRunner.scala:188)
at scala.tools.nsc.ScriptRunner.runScriptAndCatch(ScriptRunner.scala:201)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:58)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:80)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:89)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
Caused by: java.io.FileNotFoundException: http://petstore.swagger.wordnik.com/api/api-docs.json?api_key=special-key
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1623)
at com.wordnik.swagger.codegen.util.RemoteUrl$class.urlToString(RemoteUrl.scala:13)
at com.wordnik.swagger.codegen.util.ResourceExtractor$.fetchListing(ResourceExtractor.scala:31)
at com.wordnik.swagger.codegen.BasicGenerator.generateClient(BasicGenerator.scala:57)

Build is not working

Hi,

I am trying to run the ./sbt assembly step but it gets "killed" with no specific abort message (that's the last message I see on the output). When I subsequently try to execute one of the examples I get the error:

swagger-codegen# ./bin/java-petstore.sh
/usr/swagger/swagger-codegen/samples/client/petstore/java/JavaPetstoreCodegen.scala:17: error: object wordnik is not a member of package com
import com.wordnik.swagger.codegen.BasicJavaGenerator

My request to you is: could you please go through the steps of the README file? I think you will be able to reproduce it easily (a colleague just got it reproduced in his windows environment as well).

Thanks and regards,

Pieter.

Parameters are assumed (incorrectly) to be valid parameter names in all languages

Parameters appear to be assumed (incorrectly) to be valid parameter names in all languages - so for example for services that may use query parameters that start with a dollar sign ($) - this generates invalid parameters in clients such as CSharp or Ruby.

Query/Form parameters starting with a dollar sign is really common if exposing OData compliant services via swagger.

Here's an example of an invalid method due to parameter that contains a $ sign:

public QueryResultsOfUser searchProjectAssignees (string projectId, string query, string $expand) {

It would be nice if a sanitized version of the parameter name was used in the API method signature for all clients, that then mapped to the correct string parameter name internally when constructing the request.

Execution stuck at wrote samples/client/petstore/java/pom.xml

Hi,

Thanks for fixing the URLs issue. Now I got a little further and checking if what I see is ok to exit by pressing Ctrl + C as its been stuck at "wrote samples/client/petstore/java/pom.xml" for over 20 minutes without getting back to the shell prompt.

[root@localhost swagger-codegen]# ./bin/java-petstore.sh
looking at base path http://petstore.swagger.wordnik.com/api/api-docs
calling: http://petstore.swagger.wordnik.com/api/api-docs/pet?api_key=special-key
calling: http://petstore.swagger.wordnik.com/api/api-docs/user?api_key=special-key
calling: http://petstore.swagger.wordnik.com/api/api-docs/store?api_key=special-key
swagger version: 1.2
basePath:

api version: 1.0.0

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
wrote model samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Pet.java
wrote model samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Category.java
wrote model samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Tag.java
wrote model samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/User.java
wrote model samples/client/petstore/java/src/main/java/com/wordnik/petstore/model/Order.java
wrote api samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/PetApi.java
wrote api samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/StoreApi.java
wrote api samples/client/petstore/java/src/main/java/com/wordnik/petstore/api/UserApi.java
wrote samples/client/petstore/java/src/main/java/com/wordnik/client//ApiInvoker.java
wrote samples/client/petstore/java/src/main/java/com/wordnik/client//JsonUtil.java
wrote samples/client/petstore/java/src/main/java/com/wordnik/client//ApiException.java
wrote samples/client/petstore/java/pom.xml

Nested models generation not working properly

Hello and thank you guys for this great project!

I'm using swagger-codegen to generate a Python library to call our APIs (documented with swagger-ui), but I'm having a problem with nesting models generation. I have something like this:

"models": {
    "A": {
        "id": "A",
        "properties": {
            "id": {
                "type": "int"
            },
            "b": {
                "type": "B"
            }
        }
    },
    "B": {
        "id": "B",
        "properties": {
            "id": {
                "type": "int"
            },
            "c": {
                "type": "C"
            }
        }
    },
    "C": {
        "id": "C",
        "properties": {
            "id": {
                "type": "int"
            },
            "d": {
                "type": "D"
            },
            "e": {
                "type": "E"
            }
        }
    },
    "D": {
        "id": "D",
        "properties": {
            โ€ฆ
        }
    },
    "E": {
        "id": "E",
        "properties": {
            โ€ฆ
        }
    }
}

When generating the code, I get models A, B and C, with C containing in its properties references to D and E, but D and E aren't generated. It's just at the third level of nesting that the problem occurs, all other models are correctly generated.

Any ideas?

allow configurable api_key

Some folks don't use api_key as the key name, it should be configurable. Also, it should be able to be passed as a header param as well.

java.lang.IncompatibleClassChangeError when running examples

I cloned the git repo (a2bff39), ran "mvn package", and then attempted to generate the client for the example petstore with "./bin/scala-petstore.sh". I get the following stack-trace:

[brian@master swagger-codegen]$ ./bin/scala-petstore.sh
java.lang.IncompatibleClassChangeError: Implementing class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at com.wordnik.swagger.model.SwaggerSerializers$ModelSerializer.<init>(SwaggerModelSerializer.scala:207)
    at com.wordnik.swagger.model.SwaggerSerializers$.<init>(SwaggerModelSerializer.scala:12)
    at com.wordnik.swagger.model.SwaggerSerializers$.<clinit>(SwaggerModelSerializer.scala)
    at com.wordnik.swagger.codegen.Codegen.<init>(Codegen.scala:45)
    at com.wordnik.swagger.codegen.BasicGenerator.<init>(BasicGenerator.scala:42)
    at com.wordnik.swagger.codegen.BasicScalaGenerator.<init>(BasicScalaGenerator.scala:25)
    at Main$.<init>(ScalaPetstoreCodegen.scala:19)
    at Main$.<clinit>(ScalaPetstoreCodegen.scala)
    at Main.main(ScalaPetstoreCodegen.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:71)
    at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:31)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:139)
    at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:71)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:139)
    at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:28)
    at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:45)
    at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:35)
    at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:45)
    at scala.tools.nsc.ScriptRunner.scala$tools$nsc$ScriptRunner$$runCompiled(ScriptRunner.scala:171)
    at scala.tools.nsc.ScriptRunner$$anonfun$runScript$1.apply(ScriptRunner.scala:188)
    at scala.tools.nsc.ScriptRunner$$anonfun$runScript$1.apply(ScriptRunner.scala:188)
    at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply$mcZ$sp(ScriptRunner.scala:157)
    at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply(ScriptRunner.scala:131)
    at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply(ScriptRunner.scala:131)
    at scala.tools.nsc.util.package$.trackingThreads(package.scala:51)
    at scala.tools.nsc.util.package$.waitingForThreads(package.scala:35)
    at scala.tools.nsc.ScriptRunner.withCompiledScript(ScriptRunner.scala:130)
    at scala.tools.nsc.ScriptRunner.runScript(ScriptRunner.scala:188)
    at scala.tools.nsc.ScriptRunner.runScriptAndCatch(ScriptRunner.scala:201)
    at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:76)
    at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
    at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
    at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

I tried this with both JDK 1.6 and 1.7 and get the same results.

I am running maven version 3.0.4.

Trying to add a new template

When I add a new template I get an error message as seen below. I did compile it and I can see that in the JAR file.

/swagger-codegen/samples/client/summon/csharp/CSharpSummonCodegen.scala:17: error: BasicCsharpGenerator is not a member of com.wordnik.swagger.codegen import com.wordnik.swagger.codegen.BasicCsharpGenerator ^ /swagger-codegen/samples/client/summon/csharp/CSharpSummonCodegen.scala:19: error: not found: type BasicCsharpGenerator object CSharpSummonCodegen extends BasicCsharpGenerator { ^ /swagger-codegen/samples/client/summon/csharp/CSharpSummonCodegen.scala:20: error: not found: value generateClient def main(args: Array[String]) = generateClient(args) ^ three errors found

Sinatra example not working

Hi,

Nice work with Swagger!

I'm having a bit of a problem getting the Sinatra example working though.

If I follow the instructions as then attempt to start the server as follows:

rackup -p 4567 config.ru

I get the following stack trace!

/Users/CarlBourne/Documents/GitHub/swagger-codegen/samples/server-generator/sinatra/templates/config.ru:1:in require': cannot load such file -- ./my_app (LoadError) from /Users/CarlBourne/Documents/GitHub/swagger-codegen/samples/server-generator/sinatra/templates/config.ru:1:inblock in

'
from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:55:in instance_eval' from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:55:ininitialize'
from /Users/CarlBourne/Documents/GitHub/swagger-codegen/samples/server-generator/sinatra/templates/config.ru:in new' from /Users/CarlBourne/Documents/GitHub/swagger-codegen/samples/server-generator/sinatra/templates/config.ru:in'
from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:49:in eval' from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:49:innew_from_string'
from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:40:in parse_file' from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:277:inbuild_app_and_options_from_config'
from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:199:in app' from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:314:inwrapped_app'
from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:250:in start' from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:141:instart'
from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/bin/rackup:4:in <top (required)>' from /usr/local/rvm/gems/ruby-2.0.0-p0/bin/rackup:23:inload'
from /usr/local/rvm/gems/ruby-2.0.0-p0/bin/rackup:23:in <main>' from /usr/local/rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:ineval'
from /usr/local/rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `'

I then tried running the app directly from my IDE and edited the config.ru file to:

require './lib/swaggering'
run Swaggering

This started the server OK but when I tried make a request directly to "http://localhost:4567/resources.json" in a browser, Sinatra returns it famous "Sinatra doesnโ€™t know this ditty"

When I try with Swagger-UI it just complains about the cross-domain configuration.
"Can't read from server. It may not have the appropriate access-control-origin settings"

Any pointers would be much appreciated.

Best Regards

samples out of sync with current code generation output

When I clone the project and run the tools, run scala-petstore.sh, java-petstore.sh (and others?), the output files in the samples/ directory do not match the versions from the repo. I find this confusing - I don't know if I incorrectly ran the tools.
I also then worry that the generated code might not compile.

Especially when the output for the java code includes:

public array<Pet> findPetsByTags (String tags) throws ApiException {

As of commit [feb6c18] using scala-2.9.1-1

java headers with dash characters generate non-functional code

When the swagger json contains headers with -, the java codegen takes the header name as is, and uses it as a local variable name. This creates non-functional code.
Suggested fix is to have a 'codeParamName' paired with 'paramName', and map - to _

{
  "apiVersion": "1.0",
  "swaggerVersion": "1.2",
  "basePath": "http:/www.sample.com/mapi/v1",
  "resourcePath": "/content/",
  "apis": [ {
      "path": "/content/user-agreement",
      "operations": [ {
          "httpMethod": "GET",
          "summary": "Get localized user-agreement",
          "notes": "User Agreement based on the user's locale.",
          "responseClass": "string",
          "nickname": "userAgreement",
          "produces": ["text/html;charset=UTF-8"],
          "parameters": [ {
              "name": "Accept-Language",
              "description": "ISO code of language accepted",
              "paramType": "header",
              "required": false,
              "allowMultiple": false,
              "dataType": "string"
            }
          ]
        }
      ]
    }
  ],
  "models": {
  }
}

Generated code: note "String Accept-Language" which won't work.

  public String userAgreement (String Accept-Language) throws ApiException {
    // create path and map variables
    String path = "/content/user-agreement".replaceAll("\\{format\\}","json");

    // query params
    Map<String, String> queryParams = new HashMap<String, String>();
    Map<String, String> headerParams = new HashMap<String, String>();

    headerParams.put("Accept-Language", Accept-Language);
    try {
      String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
      if(response != null){
        return (String) ApiInvoker.deserialize(response, "", String.class);
      }
      else {
        return null;
      }
    } catch (ApiException ex) {
      if(ex.getCode() == 404) {
        return null;
      }
      else {
        throw ex;
      }
    }
  }

A null item in JSON breaks python client when int is expected

I kept running into this error:

Traceback (most recent call last): File "testLocationsApi.py", line 6, in <module> L.getLocation(448, 'QVorMkxG') File "/Users/gsibble/Source/generated-code/sd_python/LocationsApi.py", line 178, in getLocation responseObject = self.apiClient.deserialize(response, 'Location') File "/Users/gsibble/Source/generated-code/sd_python/swagger.py", line 166, in deserialize value = attrType(value) TypeError: int() argument must be a string or a number, not 'NoneType'

When using the python generated client libraries. It appears that a null is being sent for a setting that a user has not established (it would usually be an integer). This is expected behavior for the API since it has not yet been set.

I would suggest checking for the None type before converting the value in that manner. I'm attempting to adjust it with my own fork right now, but don't really know Scala! Thanks in advance.

Form post support in generated clients

Thank you for the great work on this project. I was implementing this on our api earlier today and I noticed a discrepancy in the swagger-ui and swagger-codegen projects. Support for defining and posting HTML forms was recently added to swagger-core and swagger-ui. I'm wondering if it was just a matter of time before post form support makes its way into swagger-codegen or if it is not on the roadmap. If there are not plans to add it anytime soon, I'm happy to send a pull request with the changes I made to support form submission in php and java. I'm afraid someone with other language expertise would need to check out the mustache templates in other languages. There's also the chance that I'm completely missing something conceptually. If so, please let me know. Thanks again for the great work.

swaggerSpec1_2.OperationSerializersTest failing during ./sbt assembly

swaggerSpec1_2.OperationSerializersTest has been failing for me when I run ./sbt assembly

Here's the output I'm getting from ./sbt assembly โ€” https://gist.github.com/rlord/6372182

And here's my version info:

$ java -version
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)
$ scala -version
Scala code runner version 2.9.3 -- Copyright 2002-2011, LAMP/EPFL
$ mvn -version
Apache Maven 3.0.4 (r1232337; 2012-01-17 00:44:56-0800)
Maven home: /usr/share/maven
Java version: 1.6.0_51, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac"

I also tested this on a fresh, Ubuntu virtual machine, and got the same failing test, so I don't think it's a problem with OS X.

Am I doing something wrong?

iOS Framework & UUID

Apps submitted to the App Store are no longer permitted to use the UUID methods. They are now part of the protected API. This means apps built with Wordnik.framework won't successfully submit to the App Store. Just something to think about.

"As of May 1st, Apple began enforcing this deprecation on all new app submissions, even for apps targeting earlier versions of iOS. Any use of uniqueIdentifier is grounds for immediate rejection of new binaries." http://nshipster.com/uuid-udid-unique-identifier/

Error when generating static docs

running ./static-docs.sh returns this, noticed the scala error at the bottom, which may or may not be the main problem,but my docs only list the available operations on the left, clicking on one goes to the server root.

Detected sbt version 0.12.3
[info] Loading project definition from /Users/jasonsykes/Downloads/swagger-codegen-master/project
[info] Set current project to swagger-codegen (in build file:/Users/jasonsykes/Downloads/swagger-codegen-master/)
[warn] Credentials file /Users/jasonsykes/.ivy2/.credentials does not exist
[info] Running SwaggerDocGenerator http://localhost/rest/app/_.json
looking at base path http://localhost/rest
calling: http://localhost/rest/app
calling: http://localhost/rest/app/{container}/
WARNING! Unable to read API http://localhost/rest/app/{container}/
calling: http://localhost/rest/app/{container}/{file_path}
WARNING! Unable to read API http://localhost/rest/app/{container}/{file_path}
calling: http://localhost/rest/app/{container}/{folder_path}/
WARNING! Unable to read API http://localhost/rest/app/{container}/{folder_path}/
swagger version: 1.1
basePath: http://localhost/rest

api version: 1.0

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
wrote model samples/docs/swagger-static-docs/src/main/webapp/models/Containers.html
wrote model samples/docs/swagger-static-docs/src/main/webapp/models/Folder.html
wrote model samples/docs/swagger-static-docs/src/main/webapp/models/File.html
wrote model samples/docs/swagger-static-docs/src/main/webapp/models/Container.html
wrote model samples/docs/swagger-static-docs/src/main/webapp/models/FoldersAndFiles.html
wrote api samples/docs/swagger-static-docs/src/main/webapp/operations/AppApi.html
copied samples/docs/swagger-static-docs/pom.xml
copied samples/docs/swagger-static-docs/src/main/webapp/assets/css/bootstrap-responsive.css
copied samples/docs/swagger-static-docs/src/main/webapp/assets/css/bootstrap.css
copied samples/docs/swagger-static-docs/src/main/webapp/assets/css/style.css
copied samples/docs/swagger-static-docs/src/main/webapp/assets/images/logo.png
copied samples/docs/swagger-static-docs/src/main/webapp/assets/js/bootstrap.js
copied samples/docs/swagger-static-docs/src/main/webapp/assets/js/jquery-1.8.3.min.js
copied samples/docs/swagger-static-docs/src/main/webapp/assets/js/main.js
wrote samples/docs/swagger-static-docs/src/main/webapp/index.html
java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at scala.tools.nsc.util.WorkScheduler.waitForMoreWork(WorkScheduler.scala:16)
at scala.tools.nsc.interactive.PresentationCompilerThread$$anonfun$run$1.apply$mcZ$sp(PresentationCompilerThread.scala:21)
at scala.tools.nsc.io.NullLogger$.logreplay(Replayer.scala:38)
at scala.tools.nsc.interactive.PresentationCompilerThread.run(PresentationCompilerThread.scala:21)

here is the json:

{
    "basePath": "http://localhost/rest",
    "swaggerVersion": "1.1",
    "apiVersion": "1.0",
    "resourcePath": "/app",
    "apis": [
        {
            "path": "/app",
            "operations": [
                {
                    "httpMethod": "GET",
                    "summary": "List all containers.",
                    "nickname": "getContainers",
                    "responseClass": "Containers",
                    "parameters": [
                        {
                            "name": "include_properties",
                            "description": "Return all properties of the container, if any.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "List the names of the available containers in this storage. Use 'include_properties' to include any properties of the containers."
                },
                {
                    "httpMethod": "POST",
                    "summary": "Create one or more containers.",
                    "nickname": "createContainers",
                    "responseClass": "Containers",
                    "parameters": [
                        {
                            "name": "data",
                            "description": "Array of containers to create.",
                            "allowMultiple": false,
                            "dataType": "Containers",
                            "paramType": "body",
                            "required": true
                        },
                        {
                            "name": "check_exist",
                            "description": "If true, the request fails when the container to create already exists.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Post data should be a single container definition or an array of container definitions."
                },
                {
                    "httpMethod": "DELETE",
                    "summary": "Delete one or more containers.",
                    "nickname": "deleteContainers",
                    "responseClass": "Containers",
                    "parameters": [
                        {
                            "name": "data",
                            "description": "Array of containers to delete.",
                            "allowMultiple": false,
                            "dataType": "Containers",
                            "paramType": "body",
                            "required": true
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Post data should be a single container definition or an array of container definitions."
                }
            ],
            "description": "Operations available for File Storage Service."
        },
        {
            "path": "/app/{container}/",
            "operations": [
                {
                    "httpMethod": "GET",
                    "summary": "List the container's properties, including folders and files.",
                    "nickname": "getContainer",
                    "responseClass": "FoldersAndFiles",
                    "parameters": [
                        {
                            "name": "container",
                            "description": "The name of the container you want to retrieve the contents.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "include_properties",
                            "description": "Return all properties of the container, if any.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        },
                        {
                            "name": "include_folders",
                            "description": "Include folders in the returned listing.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": true
                        },
                        {
                            "name": "include_files",
                            "description": "Include files in the returned listing.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": true
                        },
                        {
                            "name": "full_tree",
                            "description": "List the contents of all sub-folders as well.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        },
                        {
                            "name": "zip",
                            "description": "Return the zipped content of the folder.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "Not Found - Requested container does not exist.",
                            "code": 404
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Use 'include_properties' to get properties of the container. Use the 'include_folders' and/or 'include_files' to return a listing."
                },
                {
                    "httpMethod": "POST",
                    "summary": "Add folders and/or files to the container.",
                    "nickname": "createContainer",
                    "responseClass": "FoldersAndFiles",
                    "parameters": [
                        {
                            "name": "container",
                            "description": "The name of the container you want to put the contents.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "url",
                            "description": "The full URL of the file to upload.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "query",
                            "required": false
                        },
                        {
                            "name": "extract",
                            "description": "Extract an uploaded zip file into the container.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        },
                        {
                            "name": "clean",
                            "description": "Option when 'extract' is true, clean the current folder before extracting files and folders.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        },
                        {
                            "name": "check_exist",
                            "description": "If true, the request fails when the file or folder to create already exists.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        },
                        {
                            "name": "data",
                            "description": "Array of folders and/or files.",
                            "allowMultiple": false,
                            "dataType": "FoldersAndFiles",
                            "paramType": "body",
                            "required": false
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "Not Found - Requested container does not exist.",
                            "code": 404
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Post data as an array of folders and/or files."
                },
                {
                    "httpMethod": "PATCH",
                    "summary": "Update properties of the container.",
                    "nickname": "updateContainerProperties",
                    "responseClass": "Container",
                    "parameters": [
                        {
                            "name": "container",
                            "description": "The name of the container you want to put the contents.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "data",
                            "description": "An array of container properties.",
                            "allowMultiple": false,
                            "dataType": "Container",
                            "paramType": "body",
                            "required": true
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "Not Found - Requested container does not exist.",
                            "code": 404
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Post data as an array of container properties."
                },
                {
                    "httpMethod": "DELETE",
                    "summary": "Delete the container or folders and/or files from the container.",
                    "nickname": "deleteContainer",
                    "responseClass": "FoldersAndFiles",
                    "parameters": [
                        {
                            "name": "container",
                            "description": "The name of the container you want to delete from.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "data",
                            "description": "An array of folders and/or files to delete from the container.",
                            "allowMultiple": false,
                            "dataType": "FoldersAndFiles",
                            "paramType": "body",
                            "required": true
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "Not Found - Requested container does not exist.",
                            "code": 404
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Careful, this deletes the requested container and all of its contents, unless there are posted specific folders and/or files."
                }
            ],
            "description": "Operations on containers."
        },
        {
            "path": "/app/{container}/{file_path}",
            "operations": [
                {
                    "httpMethod": "GET",
                    "summary": "Download the file contents and/or its properties.",
                    "nickname": "getFile",
                    "responseClass": "File",
                    "parameters": [
                        {
                            "name": "container",
                            "description": "Name of the container where the file exists.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "file_path",
                            "description": "Path and name of the file to retrieve.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "include_properties",
                            "description": "Return properties of the file.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        },
                        {
                            "name": "content",
                            "description": "Return the content as base64 of the file, only applies when 'include_properties' is true.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        },
                        {
                            "name": "download",
                            "description": "Prompt the user to download the file from the browser.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "Not Found - Requested container, folder, or file does not exist.",
                            "code": 404
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "By default, the file is streamed to the browser. Use the 'download' parameter to prompt for download.\n             Use the 'include_properties' parameter (optionally add 'content' to include base64 content) to list properties of the file."
                },
                {
                    "httpMethod": "POST",
                    "summary": "Create a new file.",
                    "nickname": "createFile",
                    "responseClass": "File",
                    "parameters": [
                        {
                            "name": "container",
                            "description": "Name of the container where the file exists.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "file_path",
                            "description": "Path and name of the file to create.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "check_exist",
                            "description": "If true, the request fails when the file to create already exists.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false
                        },
                        {
                            "name": "properties",
                            "description": "Properties of the file.",
                            "allowMultiple": false,
                            "dataType": "File",
                            "paramType": "body",
                            "required": false
                        },
                        {
                            "name": "content",
                            "description": "The content of the file.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "body",
                            "required": false
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "Not Found - Requested container or folder does not exist.",
                            "code": 404
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Post data should be the contents of the file or an object with file properties."
                },
                {
                    "httpMethod": "PUT",
                    "summary": "Update content of the file.",
                    "nickname": "updateFile",
                    "responseClass": "File",
                    "parameters": [
                        {
                            "name": "container",
                            "description": "Name of the container where the file exists.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "file_path",
                            "description": "Path and name of the file to update.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "content",
                            "description": "The content of the file.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "body",
                            "required": false
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "Not Found - Requested container, folder, or file does not exist.",
                            "code": 404
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Post data should be the contents of the file."
                },
                {
                    "httpMethod": "PATCH",
                    "summary": "Update properties of the file.",
                    "nickname": "updateFileProperties",
                    "responseClass": "File",
                    "parameters": [
                        {
                            "name": "container",
                            "description": "Name of the container where the file exists.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "file_path",
                            "description": "Path and name of the file to update.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "properties",
                            "description": "Properties of the file.",
                            "allowMultiple": false,
                            "dataType": "File",
                            "paramType": "body",
                            "required": false
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "Not Found - Requested container, folder, or file does not exist.",
                            "code": 404
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Post data should be the file properties."
                },
                {
                    "httpMethod": "DELETE",
                    "summary": "Delete the file.",
                    "nickname": "deleteFile",
                    "responseClass": "File",
                    "parameters": [
                        {
                            "name": "container",
                            "description": "Name of the container where the file exists.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "file_path",
                            "description": "Path and name of the file to delete.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "Not Found - Requested container, folder, or file does not exist.",
                            "code": 404
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Careful, this removes the given file from the storage."
                }
            ],
            "description": "Operations on individual files."
        },
        {
            "path": "/app/{container}/{folder_path}/",
            "operations": [
                {
                    "httpMethod": "GET",
                    "summary": "List the folder's properties, or sub-folders and files.",
                    "nickname": "getFolder",
                    "responseClass": "FoldersAndFiles",
                    "parameters": [
                        {
                            "name": "container",
                            "description": "The name of the container from which you want to retrieve contents.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "folder_path",
                            "description": "The path of the folder you want to retrieve. This can be a sub-folder, with each level separated by a '/'",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "include_properties",
                            "description": "Return all properties of the folder, if any.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        },
                        {
                            "name": "include_folders",
                            "description": "Include folders in the returned listing.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": true
                        },
                        {
                            "name": "include_files",
                            "description": "Include files in the returned listing.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": true
                        },
                        {
                            "name": "full_tree",
                            "description": "List the contents of all sub-folders as well.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        },
                        {
                            "name": "zip",
                            "description": "Return the zipped content of the folder.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "Not Found - Requested container or folder does not exist.",
                            "code": 404
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Use with no parameters to get properties of the folder or use the 'include_folders' and/or 'include_files' to return a listing."
                },
                {
                    "httpMethod": "POST",
                    "summary": "Create one or more sub-folders and/or files.",
                    "nickname": "createFolder",
                    "responseClass": "FoldersAndFiles",
                    "parameters": [
                        {
                            "name": "container",
                            "description": "The name of the container where you want to put the contents.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "folder_path",
                            "description": "The path of the folder where you want to put the contents. This can be a sub-folder, with each level separated by a '/'",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "url",
                            "description": "The full URL of the file to upload.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "query",
                            "required": false
                        },
                        {
                            "name": "extract",
                            "description": "Extract an uploaded zip file into the folder.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        },
                        {
                            "name": "clean",
                            "description": "Option when 'extract' is true, clean the current folder before extracting files and folders.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        },
                        {
                            "name": "check_exist",
                            "description": "If true, the request fails when the file or folder to create already exists.",
                            "allowMultiple": false,
                            "dataType": "boolean",
                            "paramType": "query",
                            "required": false,
                            "defaultValue": false
                        },
                        {
                            "name": "data",
                            "description": "Array of folders and/or files.",
                            "allowMultiple": false,
                            "dataType": "FoldersAndFiles",
                            "paramType": "body",
                            "required": false
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "Not Found - Requested container does not exist.",
                            "code": 404
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Post data as an array of folders and/or files. Folders are created if they do not exist"
                },
                {
                    "httpMethod": "PATCH",
                    "summary": "Update folder properties.",
                    "nickname": "updateFolderProperties",
                    "responseClass": "Folder",
                    "parameters": [
                        {
                            "name": "container",
                            "description": "The name of the container where you want to put the contents.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "folder_path",
                            "description": "The path of the folder you want to update. This can be a sub-folder, with each level separated by a '/'",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "data",
                            "description": "Array of folder properties.",
                            "allowMultiple": false,
                            "dataType": "FoldersAndFiles",
                            "paramType": "body",
                            "required": false
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "Not Found - Requested container or folder does not exist.",
                            "code": 404
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Post data as an array of folder properties."
                },
                {
                    "httpMethod": "DELETE",
                    "summary": "Delete one or more sub-folders and/or files.",
                    "nickname": "deleteFolder",
                    "responseClass": "FoldersAndFiles",
                    "parameters": [
                        {
                            "name": "container",
                            "description": "The name of the container where the folder exists.",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "folder_path",
                            "description": "The path of the folder where you want to delete contents. This can be a sub-folder, with each level separated by a '/'",
                            "allowMultiple": false,
                            "dataType": "string",
                            "paramType": "path",
                            "required": true
                        },
                        {
                            "name": "data",
                            "description": "Array of folder and files to delete.",
                            "allowMultiple": false,
                            "dataType": "FoldersAndFiles",
                            "paramType": "body",
                            "required": false
                        }
                    ],
                    "errorResponses": [
                        {
                            "reason": "Bad Request - Request does not have a valid format, all required parameters, etc.",
                            "code": 400
                        },
                        {
                            "reason": "Unauthorized Access - No currently valid session available.",
                            "code": 401
                        },
                        {
                            "reason": "Not Found - Requested container does not exist.",
                            "code": 404
                        },
                        {
                            "reason": "System Error - Specific reason is included in the error message.",
                            "code": 500
                        }
                    ],
                    "notes": "Careful, this deletes the requested folder and all of its contents, unless there are posted specific sub-folders and/or files."
                }
            ],
            "description": "Operations on folders."
        }
    ],
    "models": {
        "Containers": {
            "id": "Containers",
            "properties": {
                "container": {
                    "type": "Array",
                    "description": "An array of containers.",
                    "items": {
                        "$ref": "Container"
                    }
                }
            }
        },
        "Container": {
            "id": "Container",
            "properties": {
                "name": {
                    "type": "string",
                    "description": "Identifier/Name for the container."
                },
                "path": {
                    "type": "string",
                    "description": "Same as name for the container."
                },
                "last_modified": {
                    "type": "string",
                    "description": "A GMT date timestamp of when the container was last modified."
                },
                "_property_": {
                    "type": "string",
                    "description": "Storage type specific properties."
                },
                "metadata": {
                    "type": "Array",
                    "description": "An array of name-value pairs.",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "FoldersAndFiles": {
            "id": "FoldersAndFiles",
            "properties": {
                "name": {
                    "type": "string",
                    "description": "Identifier/Name for the current folder, localized to requested folder resource."
                },
                "path": {
                    "type": "string",
                    "description": "Full path of the folder, from the service including container."
                },
                "container": {
                    "type": "string",
                    "description": "Container for the current folder."
                },
                "last_modified": {
                    "type": "string",
                    "description": "A GMT date timestamp of when the folder was last modified."
                },
                "_property_": {
                    "type": "string",
                    "description": "Storage type specific properties."
                },
                "metadata": {
                    "type": "Array",
                    "description": "An array of name-value pairs.",
                    "items": {
                        "type": "string"
                    }
                },
                "folder": {
                    "type": "Array",
                    "description": "An array of contained folders.",
                    "items": {
                        "$ref": "Folder"
                    }
                },
                "file": {
                    "type": "Array",
                    "description": "An array of contained files.",
                    "items": {
                        "$ref": "File"
                    }
                }
            }
        },
        "Folder": {
            "id": "Folder",
            "properties": {
                "name": {
                    "type": "string",
                    "description": "Identifier/Name for the folder, localized to requested folder resource."
                },
                "path": {
                    "type": "string",
                    "description": "Full path of the folder, from the service including container."
                },
                "last_modified": {
                    "type": "string",
                    "description": "A GMT date timestamp of when the folder was last modified."
                },
                "_property_": {
                    "type": "string",
                    "description": "Storage type specific properties."
                },
                "metadata": {
                    "type": "Array",
                    "description": "An array of name-value pairs.",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "File": {
            "id": "File",
            "properties": {
                "name": {
                    "type": "string",
                    "description": "Identifier/Name for the file, localized to requested folder resource."
                },
                "path": {
                    "type": "string",
                    "description": "Full path of the file, from the service including container."
                },
                "content_type": {
                    "type": "string",
                    "description": "The media type of the content of the file."
                },
                "content_length": {
                    "type": "string",
                    "description": "Size of the file in bytes."
                },
                "last_modified": {
                    "type": "string",
                    "description": "A GMT date timestamp of when the file was last modified."
                },
                "_property_": {
                    "type": "string",
                    "description": "Storage type specific properties."
                },
                "metadata": {
                    "type": "Array",
                    "description": "An array of name-value pairs.",
                    "items": {
                        "type": "string"
                    }
                }
            }
        }
    }
}```

It is presumptous to stick a format placeholder into the path without reason

generated swagger.rb code does:

# Stick a .{format} placeholder into the path if there isn't # one already or an actual format like json or xml # e.g. /words/blah => /words.{format}/blah unless ['.json', '.xml', '{format}'].any? {|s| p.downcase.include? s } p = p.sub(/^(\/?\w+)/, "\1.#{format}") end

which basicly forces a swagger API to parse URL for a format string, whereas the format could be perfectly determined by the Content-Type/Accept headers. It is also a buggy practice if the URL has a xml string for whatever other reason

Error when doing anything

I just cloned the repo and I can't run any of the examples. I get this error

java.lang.NoSuchMethodError: scala.Predef$.any2ArrowAssoc(Ljava/lang/Object;)Lscala/Predef$ArrowAssoc;
    at com.wordnik.swagger.model.SwaggerSerializers$.<init>(SwaggerModelSerializer.scala:18)
    at com.wordnik.swagger.model.SwaggerSerializers$.<clinit>(SwaggerModelSerializer.scala)
    at com.wordnik.swagger.codegen.Codegen.<init>(Codegen.scala:45)
    at com.wordnik.swagger.codegen.BasicGenerator.<init>(BasicGenerator.scala:44)
    at com.wordnik.swagger.codegen.BasicScalaGenerator.<init>(BasicScalaGenerator.scala:25)
    at Main$.<init>(ScalaPetstoreCodegen.scala:19)
    at Main$.<clinit>(ScalaPetstoreCodegen.scala)
    at Main.main(ScalaPetstoreCodegen.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:71)
    at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:31)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:139)
    at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:71)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:139)
    at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:28)
    at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:45)
    at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:35)
    at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:45)
    at scala.tools.nsc.ScriptRunner.scala$tools$nsc$ScriptRunner$$runCompiled(ScriptRunner.scala:171)
    at scala.tools.nsc.ScriptRunner$$anonfun$runScript$1.apply(ScriptRunner.scala:188)
    at scala.tools.nsc.ScriptRunner$$anonfun$runScript$1.apply(ScriptRunner.scala:188)
    at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply$mcZ$sp(ScriptRunner.scala:157)
    at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply(ScriptRunner.scala:131)
    at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply(ScriptRunner.scala:131)
    at scala.tools.nsc.util.package$.trackingThreads(package.scala:51)
    at scala.tools.nsc.util.package$.waitingForThreads(package.scala:35)
    at scala.tools.nsc.ScriptRunner.withCompiledScript(ScriptRunner.scala:130)
    at scala.tools.nsc.ScriptRunner.runScript(ScriptRunner.scala:188)
    at scala.tools.nsc.ScriptRunner.runScriptAndCatch(ScriptRunner.scala:201)
    at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:76)
    at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
    at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
    at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

I compiled with ./sbt assembly and ran ./bin/scala-petstore.sh on OSX

model properties written in random order

The arguments in a model can be reordered in codegen which makes the generated models really painful to use. They should maintain their order with the spec file.

Missing License Info

I have noticed that the other swagger-* projects provide license information (ASL 2.0), which seems to be missing from this project.

For example:
https://github.com/wordnik/swagger-ui/blob/master/README.md#license
https://github.com/wordnik/swagger-core/blob/master/README.md#license

In order for us to use this specific library, we need to know what license is being used for swagger-codegen. If you could please update the docs to provide this information, the community would appreciate it.

Thanks!

/jd

csharp template maps parameters named 'date' to DateTime

The csharp codegen template incorrectly maps parameters named 'date' to 'DateTime'. Note that this bug refers to the parameter name, not the data type which is correctly mapped.

eg
"apis": [
{
...
"operations": [
{
"....
"parameters": [
{
"paramType": "query",
"name": "date",
"description": "Some description",
"dataType": "Date",
"required": true,
"allowMultiple": false,
},
....

Gets converted by codegen template to:
public SomeResultType SomeMethod (DateTime DateTime);

This expected result is
public SomeResultType SomeMethod (DateTime date);

./bin/validate.sh causes java.lang.IncompatibleClassChangeError: Implementing class

Hi there.

I'm trying to validate a swagger JSON file using the validate.sh file. Running the command yields:

java.lang.IncompatibleClassChangeError: Implementing class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at com.wordnik.swagger.model.SwaggerSerializers$ModelSerializer.<init>(SwaggerModelSerializer.scala:272)
    at com.wordnik.swagger.model.SwaggerSerializers$.<init>(SwaggerModelSerializer.scala:16)
    at com.wordnik.swagger.model.SwaggerSerializers$.<clinit>(SwaggerModelSerializer.scala)
    at com.wordnik.swagger.codegen.util.ResourceExtractor$.<init>(ResourceExtractor.scala:27)
    at com.wordnik.swagger.codegen.util.ResourceExtractor$.<clinit>(ResourceExtractor.scala)
    at com.wordnik.swagger.codegen.spec.Validator$.main(Validator.scala:41)
    at com.wordnik.swagger.codegen.spec.Validator.main(Validator.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:71)
    at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:31)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:139)
    at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:71)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:139)
    at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:28)
    at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:45)
    at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:35)
    at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:45)
    at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:74)
    at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
    at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
    at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

My JSON file can be found here: http://stash.socialvi.be/api-docs.json

Any tips would be appreciated. I am surprised that the swagger project doesn't have an online validator.

Cheers.

Organize commands using 37signals/sub

Check out https://github.com/37signals/sub.

Because swagger-codegen is heavily a command line tool, it would make sense that the commands would be organized in a predictable and well-documented manner sub looks like just the tool for this.

Instead of running $ ./bin/scala-petstore.sh from the root of swagger-codegen, package it as a sub command-line tool and you could run this (from anywhere):

$ swagger ruby http://petstore.swagger.wordnik.com/api/resources.json

This would likely require some reorganization of the file structure of this repo, but if anyone is interested, I could come up with a proposal and go on from there.

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.