Commit Graph

8300 Commits

Author SHA1 Message Date
Benjamin Douglas
9058099e5b Add alias type definitions for Java
When a spec defines a Model at the top level that is a non-aggretate type (such
as string, number or boolean), it essentially represents an alias for the simple
type. For example, the following spec snippet creates an alias of the boolean
type that for all intents and purposes acts just like a regular boolean.

    definitions:
      JustABoolean:
        type: boolean

This can be modeled in some languages through built-in mechanisms, such as
typedefs in C++. Java, however, just not have a clean way of representing this.

This change introduces an internal mechanism for representing aliases. It
maintains a map in DefaultCodegen that tracks these types of definitions, and
wherever it sees the "JustABoolean" type in the spec, it generates code that
uses the built-in "Boolean" instead.

This functionality currenlty only applies to Java, but could be extended to
other languages later.

The change adds a few examples of this to the fake endpoint spec for testing,
which means all of the samples change as well.
2017-04-17 12:58:31 -07:00
Julien Fouilhé
b1a39ac820 fix(swift3): decoders call parents decoders too (#5369) 2017-04-18 00:03:52 +08:00
wing328
647f3601f9 Merge branch 'LEgregius-spring-resource-file-streams2' 2017-04-17 23:47:02 +08:00
wing328
34a99d6dba update spring petstore samples 2017-04-17 23:32:03 +08:00
wing328
ba32f66714 Merge branch 'spring-resource-file-streams' of https://github.com/LEgregius/swagger-codegen into LEgregius-spring-resource-file-streams2 2017-04-17 23:26:09 +08:00
wing328
a32774c541 update spring boot bean validation script 2017-04-17 23:25:27 +08:00
Eric Bélanger
fd289ac6de [JavaSpring] add support for map minProperties and maxProperties bean validation (#5395) 2017-04-17 22:47:21 +08:00
Tino Fuhrmann
e858f2390b [TypeScript] fix class filename in import/export (#5396)
* Fixed classFilename in typescript-angular and recreated samples

* Changed classname to classFilename in ts-angular2/models.mustache
Also recreated ts-angular2 sample
2017-04-17 22:43:33 +08:00
hossamhossny
e2cd00f905 Update README.md (#5402)
adding company.
2017-04-16 21:35:34 +08:00
Mike Kistler
ca9fcd7db1 Fix copy method of CodegenParameter to copy isPrimitiveType (#5381) 2017-04-13 20:58:55 +08:00
wing328
4e6a342c13 replace tab with 4-space in spring templates (#5389) 2017-04-13 19:03:34 +08:00
wing328
c637157f9e update project identifier for spring boot beanvalidation 2017-04-13 18:38:34 +08:00
wing328
57871d845d update travis ci to cover
samples/server/petstore/springboot-beanvalidation
2017-04-13 17:53:10 +08:00
wing328
0682e41d6d update spring petstore sample 2017-04-13 17:44:38 +08:00
dhuning
8cf0f7046e Adds @Valid to request body for the JavaSpring (#4850)
* Adds Valid annotation for request body (#4847)

If useBeanValidation is active, this change will add Valid annotation to ReqeustBody

* Adds generated samples for bean vaildation in spring boot (#4847)

* Adds Valid import to Controller

* Adds generated code for bean validation change
2017-04-13 17:42:02 +08:00
Benjamin Douglas
ab69ce5dc3 Add null pointer check to add/put methods (#5385) (#5386)
Commit e3d04ee01 (issue #5240) introduced unsafe add/put methods for optional
list/map parameters. This change maintains the spirit of issue #5240 (optional
containers are null by default) while still making add/put calls safe. It does
this by checking for null first and, if so, initializing it with an empty
container.

Also updated the affected samples using the various scripts in bin/.
2017-04-13 17:37:49 +08:00
Jean-Maxime Fillau
df1055fe38 Add float conversion for cpprest api client template. (#5387)
Signed-off-by: FILLAU Jean-Maxime <jean-maxime.fillau@mapotempo.com>
2017-04-13 17:30:20 +08:00
nikitozz
78c4928908 Fixes #5367. Async support is enabled for .NET netstandard API clients (#5368) 2017-04-12 10:39:42 +08:00
wing328
1fdd3e6ffa [Java][Spring] fix enum allowable values in Spring generators (#5364)
* fix enum allowable values in spring generators

* use values instead of enumVars in spring annoation
2017-04-11 22:23:09 +08:00
wing328
e3d04ee01f [Java] remove initialization for optional list property (#5363)
* set list to null in java if not required

* update petstore sample for java server stub

* update sample for msf4j

* add null assignment to new list/map in java
2017-04-11 19:07:48 +08:00
wing328
d3ac4b686a fix CI issue by declaring originalEnvironmentVariables as a protected
member
2017-04-11 00:57:22 +08:00
Simon Marti
1734ac4ed0 Add option to skip Maven plugin execution (#5337)
* Add option to skip Maven plugin execution

The execution is skipped if either the codegen.skip property or the <skip>
configuration parameter is set. This is consistent with how many other Maven
plugins, such as maven-exec-plugin and maven-clean-plugin, handle this.

* Add documentation for Maven `skip` property
2017-04-10 23:31:58 +08:00
Simon Marti
fea8699d8b Fix environment variable support in successive Maven plugin executions (#5351)
* Fix environment variable support in successive Maven plugin executions

System properties were retained across multiple successive executions,
resulting in unpredictable behavior. Property values are now properly reset
to their original value after plugin execution.

Fixes #5350

* Add explanation to environment variable reset mechanism in Maven plugin
2017-04-10 23:25:09 +08:00
Jean-François Côté
2e46bb9b9f Add File support + some fixes to Play generator (#5263)
* First commit of the Java Play Framework server generator. It is highly based on Spring so there might me a couple of things that don't make sense (like options or parameters) for the Play Framework.

* Fix suggestions in the PR discussion + add .bat and .sh file as requested.

* Updated Readme.md file

* Remove unused mustache file + fix baseName vs paramName in all the mustache files.

* Fix the compilation error when we have a body which is a list or map. Doesn't fix the problem with the annotation itself.

* Fix the problem with the Http.MultipartFormData.FilePart

* Return a FileInputStream when the returnType is "file" + Fix a couple of other bugs with boolean + updated sample

* Return an InputStream instead of FileInputStream (except in the instantiation)

* A little cleanup for the form param of type file.
2017-04-10 23:23:28 +08:00
Vincent Giersch
aef98f464e fix(php): should not check enum value if not unspecified and optional (broken since #4886) (#5357)
Signed-off-by: Vincent Giersch <vincent@giersch.fr>
2017-04-10 23:21:14 +08:00
Vincent Giersch
99f0ab496b fix(php): escape reserved words in enum variables names (#5356)
Signed-off-by: Vincent Giersch <vincent@giersch.fr>
2017-04-10 23:19:06 +08:00
Ahmet Taha Sakar
c6959b0d21 Swift3 headers (#5340)
* added headers to makeRequest function for swift3 template

* petstore update
2017-04-10 22:36:22 +08:00
anuthebananu
19d5e74dbd [Spring] Adds serialVersionUID to serializable model POJO's (#5347) 2017-04-07 09:17:29 +08:00
Johannes
e147fdec48 swagger-codegen-maven-plugin: hint added how to generate server code (#5342)
addresses issue #5332
2017-04-07 08:46:42 +08:00
wing328
4aaf3ab353 update reserved word list for swift3 (#5348) 2017-04-07 08:36:02 +08:00
lukoyanov
a7652d508d Updated CallAdapter & CallAdapterFactory for retrofit 2.2.0 (#5345) 2017-04-07 07:35:47 +08:00
wing328
90b14a996a use original value of paramName in akka scala templates (#5339) 2017-04-06 17:01:25 +08:00
weiyang
abffdca441 [Html2] Fix circular references (#5313)
* [html2] Fix circular references

Signed-off-by: weiyang <weiyang.ones@gmail.com>

* [samples][html2] Fix circular references

Signed-off-by: weiyang <weiyang.ones@gmail.com>

* Optimize code format

Signed-off-by: weiyang <weiyang.ones@gmail.com>
2017-04-06 14:39:26 +08:00
wing328
5de04fa612 omitted command line result 2017-04-05 21:49:06 +08:00
wing328
7dc27aaf96 results omitted from command line output 2017-04-05 21:46:15 +08:00
BenjenW
e7a3321b62 Update README.md (#5330)
Added my company (Individual Standard IVS) to the list of Swagger Codegen users
2017-04-05 20:32:43 +08:00
Paŭlo Ebermann
0c1ad9b2ba Update security samples for Scala + typescript-node. (#5325) 2017-04-05 18:05:21 +08:00
Paŭlo Ebermann
be83329946 Update security samples for swift. (#5324) 2017-04-05 18:04:53 +08:00
wing328
5b16694afc add example to use spec in online generator 2017-04-05 16:41:07 +08:00
Yohana Khoury
7ae0bb6e67 Update README.md (#5328)
Added GigaSpaces to Companies Using Swagger Codegen
2017-04-05 14:49:22 +08:00
wing328
22c80588f6 fix retrofit2 rxjava2 script (#5321) 2017-04-04 22:58:03 +08:00
Paŭlo Ebermann
f0b0226e46 [Java][JaxRS][Spring-MVC] Update samples for jaxrs with Jersey 1/2 and for spring-mvc (#5212)
* Update samples for Spring-MVC.

* Update samples for Spring-MVC-Jav8-async.

* Update samples jaxrs/jersey1.

* Update samples jaxrs/jersey2.

* Update samples spring-mvc

* Update samples spring-mvc-j8-async
2017-04-04 21:41:22 +08:00
Paŭlo Ebermann
8bd67c9f7f Fix template directory used by samples script. (#5284) 2017-04-04 14:47:22 +08:00
Paŭlo Ebermann
ffb4d52469 Update security samples: server (#5285) 2017-04-04 14:44:59 +08:00
Paŭlo Ebermann
41b04e0e01 Update security samples for typescript-clients (Angular1/2). (#5288) 2017-04-04 14:44:25 +08:00
Paŭlo Ebermann
ca976c524a Update security samples for ObjectiveC client. (#5286) 2017-04-04 14:44:09 +08:00
Paŭlo Ebermann
35ce3f48b9 Updating security samples for C++/QT5. (#5291) 2017-04-04 14:43:52 +08:00
Paŭlo Ebermann
66bf83e911 Update security samples for Javascript clients (#5289) 2017-04-04 14:43:25 +08:00
Paŭlo Ebermann
0695a58f3c Updating security samples for Python client. (#5294) 2017-04-04 14:42:48 +08:00
Paŭlo Ebermann
7462cf70cf Updating security samples for PHP client. (#5293) 2017-04-04 14:42:01 +08:00