The generation code was ignoring top-level aliases for any language config that
contained "java", which included "javascript", a completely different language.
Changed this to be those configs based on the JavaAbstractGenerator class.
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.
* 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
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/.
* 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
* 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.
This is for the EAP version specifically.
* The JacksonConfig class always used the io.swagger.api package
* The RestApplication class did not import the service implementations
from the correct package
* Added shell script for generating test applications
* Migrate from Swashbuckle to Swashbuckle.AspNetCore
* Fix typo
* Add SwaggerResponse for all responses
* Remove model constructor
* Add required attribute if available
* Improve whitespace and remove some redundant code
* Remove redundant code from Dockerfile
* Add disable warning 1591 pragma for model utility methods for bringing down compiler warnings to zero
* Add proper model state validation before controller is called
* Regenerate AspNetCore PetStore sample
* Updating samples after #5232.
* Fix tests after #5232.
* Fix Javascript client tests.
* JaxRS server: set serverPort only when not given from outside.
* Update JaxRS sample creator scripts to fix serverPort.
* Preliminary test fix for JaxRS server generators.
* Updating samples for JaxRS with Jersey1/2.
* Updating JaxRS samples again.
* JaxRS server: set serverPort only when not given from outside.
* Update JaxRS sample creator scripts to fix serverPort.
* Preliminary test fix for JaxRS server generators.
* Updating samples for JaxRS with Jersey1/2.
* Pretty-print swagger.json.
(This was done via `jq`. In a later commit we'll generate it pretty-printed.)
* Erlang Server: pretty-print generated swagger.json.
* Update samples for Erlang-server.
* Issue #3084: add hideGenerationTimestamp option to Go server generator.
* Issue #3084: use hideGenerationTimestamp in go server sample script.
* Update Go server samples.
* 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
* - Add "wrapCalls" and "useSwaggerUI" CLI Options and updated what handleException does to follow Play Framework lifecycle more closely
- Updated all mustache files accordingly
- Updated the sample
- Updates Play Framework version to the latest 2.5.13
* 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.
* Add an CLI option to generate interface. These interfaces are implemented by the controllerImp and help to generate the code with an IDE like IntelliJ because on updates of the code the controllerImp must follow the contract of the interface. If it don't, IDE will provide support to generate missing functions or parameters. I also did some cleanup of options we don't use in Play Framework.
* 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
* Small fixes
* Remove everything related to swagger-play. No need for annotation anymore because we export the swagger.json directly and show the documentation using swagger-ui with the direct path. Also added the sample.
* Remove/Rename paramsX mustache because there is no more documentation. Remove unused file. updated sample
* Fix the problem with default values that was not set correctly.
* Small fix related to bad merging
* Add handleException CLI options
* Fix default values once and for all!
* Update sample files + fix bug
* Fix bug with body that is required and have a list as a parameter + add bean import for interface to prevent compilation error
* added supporting files for Dockerfile and dockerignore generation for python-flask lang
* documenting how to build the docker image and how to spin up a container
* updating pet store sample
This was previously missing and I don't think it was intentional.
It appears that swagger-codegen is already correctly processing
the yaml and the placeholder in the template was the only thing
missing.
* Update samples for nodejs + nodejs-google-cloud-functions.
* Fix example generator to use deterministic randomness.
This avoids changing results after each generation, and makes diff reviews easier.
* Update NodeJS samples.
This is the last "randomness" update. From now on the samples should only change if either the generator, the input or parameters change.
* Make java spring controller constructor public.
This lets users manually create the controller and inject the delegate in the
spring configuration file, instead of letting spring scan for controllers and
autowire the delegate.
* Ran spring-all-pestore.sh.
* Update samples for Scalatra after 2.2.2.
* [scalatra] Revert changes to build.sbt
Changes were made in conjunction with the new finch generator. This
reverts those changes to Scalatra's previous build.sbt.
* Update scalatra samples again after revert of part of #3905.
* Improved ExampleGenerator:
- Now takes into account enum and uri/url formats for strings.
- Uses example for referenced objects if available.
- Proper examples get generated for specific numeric formats, because more specific formats now get checked before generic format.
- Honors min and max values for numerical properties, if set.
* Ran script `bin/nodejs-petstore-server.sh`.
* Renamed log to logger to conform to coding standard.
* Update spring samples with current code.
This is done so I can see my own changes better.
* Regenerate samples after 2.2.2.
* use baseName instead of paramName for spring annotations.
* update spring petstore samples to show the effects.
* jaxrs-cxf: Re-added usage of contextPath in api.mustache (basePath)
* jaxrs-cxf: Added useAnnotatedBasePath and generateNonSpringApplication flags
* useAnnotatedBasePath=true uses the @Path annotation in the generated interface to set the basePath, default is false
* generateNonSpringApplication=true generates a web.xml with CXFNonSpringJaxrsServlets. If useAnnotatedBasePath=true only one servlet will be created, otherwise one for each API
* jaxrs-cxf generateNonSpringApplication: removed creation of multiple servlets
Multiple servlets were generated if useAnnotatedBasePath was false.
This is not necessary as there is only ONE basePath per contract
* jaxrs-cxf: added sample generation for useAnnotatedBasePath and generateNonSpringApplication
* Issue #4606 (Spring) SubClass annotations are missing from the base class
* Issue #4606 (Spring) SubClass annotations are missing from the base class
* Commit updated samples from ./bin/spring-all-pestore.sh
* [JAXRS-CXF] [issue #4386] add builder-style methods to model classes
before this change, model classes had only a default constructor and
setter methods, resulting in code like this:
myModel = MyModel();
myModel.setFirstField(firstField);
myModel.setSecondField(secondField);
return myModel;
this change adds builder style methods, such that the above code can be
written more compactly:
return MyModel().firstField(firstField).secondField(secondField);
this is consistent with other JAVA generators in swagger-codegen.
* update jaxrs-cxf sample code
* Feature/objc tasks 2.3.0 (#3522)
* change api and ApiClient to return cancellable NSURLSessionTasks instead of NSNumber
* define a configuration protocol for custom configurations, which can be passed to api clients instead of a global configuration, provide a default implementation with a singleton option
* integrate a workaround for a current JSONModel concurrency bug
* update to new ISO8601 pod
* add missing call to super
* integrate new templates into codegen
* updates documentation templates
* updates petstore objc generated code
* fixes objc client tests
* [ObjC] Add version define and share default headers of each client
* add finch generator and resource
* update license, add errros
* Fix problem with multitheard api client
* fix some errors for finch
* [finch] Remove license header
* [finch] Remove finatra stuff, fix a few issues
* WIP: Finch server generator
* [finch] WIP: server generator impl
This puts parameters (input/output) in the right format. Currently, this
is done in the generator class using vendorExtensions, but should be
refactored to imported templates to clean up.
Previous commits of the server generator output to appropriate
models/api directories. I've made no changes to this logic, but code
currently generates to the root scala package directory. This will need
to be fixed.
There's also an issue with circe's and Option[Date] in the Order type.
This issue will need to be resolved. As well, there's some unused
imports to clean up.
Initial implementation lacks support for custom imports, type mappings,
etc.
* [finch] Update api/model package and imports
* [finch] Explicit import/type mappings
* [finch] Regenerate example
* [aspnetcore] Use default rather than null in ctor
See original issue #3608
This adds same model constructor logic to aspnetcore as what was added
to csharp generator by PR #4145.
This doesn't include NancyFX because model construction relies more on
object initialization in that generator.
* [aspnetcore] ctor defaults + enum support
This follows up to #4145, and modifies model constructors to use
default(x) instead of initializing to nulls. default(x) works in all
cases using intuitive default values it is intended to support.
Example:
csharp> public enum Color { RED = -1, BLUE = 0, GREEN }
csharp> var color = default(Color)
csharp> color
BLUE
In the above example, The default of BLUE=0 is expected. For nullable
enums, this would be null as a default.
The aspnetcore generated code is also updated to support enums and
nested enums to account for changed to the petstore.yaml used to
generate the sample.
* [aspnetcore] Regenerate sample
* fixes#4432 Adding support for the modifier within the Jaxb XMLElement annotation. Updated README with JaxbAnnotations configuration option.
* #4432 Running the Petstore files
When a string enumeration has the empty string as one of its available
values, the generated code for many languages is invalid because the
empty string can not be used as an identifier. As with numbers and
symbols, provide a mapping to an English name which can be used as a
replacement. In this case, "empty" for the empty string/empty value.
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
* Another approach: extending NodeJS server to support GCF.
This does not add a new language, but adding some client options
to support Google Cloud Functions (GCF).
* Add URLs for how to deploy the generated code.
Adds the client options help message and the README.md file.
* [JaxRS-CXF][bug #4330] support containers in return types
before this commit if a method returned a container (List or Map) of
THING (i.e. List<THING> or Map<String, THING>) the generated return type would
drop the container and only leave THING.
this commit fixes this issue such that the container type is properly
generated.
* regenerate jaxrs-cxf petstore sample
* add json annotations
* add cli flag to check for jaxb annotations
* add CLI-flag for switching Spring-XML or annotation config #4088
* add cli flag for generating jboss depl. descriptor #4088
* add JbossFeature CLI flag to Resteasy #4088
* update/add tests #4088
* cleanup tabs #4088
* improve api formatting #4088
* refine formatting #4088
* refine formatting again #4088
* add separate CLI-flags for controlling junit test features #4088
* add json annotations
* add cli flag to check for jaxb annotations
* add CLI-flag for switching Spring-XML or annotation config #4088
* add cli flag for generating jboss depl. descriptor #4088
* add JbossFeature CLI flag to Resteasy #4088
* update/add tests #4088
* cleanup tabs #4088
* improve api formatting #4088
* refine formatting #4088
* refine formatting again #4088
* add separate CLI-flags for controlling junit test features #4088
* add check for void methods + assertNotNull(response) #4088
* add spaces for @Produces #4088
* allow build with no web.xml config #4088
* comment invocations of tests #4088
* update petstore sample jaxrs-cxf server with gen/java first #4088
* re-generate jaxrs-cxf with src/gen/java #4088
* add client jaxrs-cxf #4088
* add switch to load SwaggerUI automatically #4088
* update to CXF 3.1.8 including supportSwaggerUi flag #4088
* update to cxf 3.1.8 and swagger-core 1.5.10 #4088
* update generated petstore for jaxrs-cxf #4088
* change Spring Boot urls to root #4088
* fix spring xml config #4088
* fix external enum usage for jaxrs-cxf #4160
* cleanup jaxrs-annotations in impl class
* fix handling of multiparts #4088
* fix @Min/@Max comments in beanValidationQueryParams #4088
* add swagger-codegen-ignore file+add src/test/resources #4088
* add cli-flag for produces/consumes json in api #4088
* add test case for outerEnum #4160
* remove php apache license
* remove license in sample code, update nodejs to use unlicnese
* remove license from jaxrs generator
* remove license from server generator
* update pom.xml for jaxrs resteasy joda server
* [feign] add threetenbp support for feign clients
* [okhttp] add threetenbp support for okhttp clients
* [jersey] add threetenbp support for jersey clients
* [retrofit2] add threetenbp support for retrofit2 clients
* [spring] add threetenbp support for spring generators
* add a workaround in tests for a bug in the petstore
The petstore doesn't manage fractional digits of dates correctly when there are less than 3
* Added switch to config to toggle use of yaml base path as module paths
* NancyFX template updated to return collections as array to allow framework to find views by type name for text/html mime type
* Added some more parser fixes for NancyFX
* Refactored collection parsers in Parameters.cs and changed some to return nullable collections to match the parameter mappings in AbstractCSharpCodegen
* re-ran petstore build
* fix NancyFX string parser
parser needs to access the Value parameter to enable the direct cast at line 102 when handling string parameters
* Updated nancyfx sample
* Added switch to config to toggle use of yaml base path as module paths
* fix NancyFX string parser
parser needs to access the Value parameter to enable the direct cast at line 102 when handling string parameters
* Updated nancyfx sample
This moves previous aspnet5 functionality to aspnetcore, aspnet5 now
derives from the aspnetcore generator and logs a warning that it's
deprecated.
This will help resolve any confusion because ASP.NET 5 is terminology
referring to the project of around a year ago. ASP.NET Core 1.0 is the
new name for the technology, and further enhancements should target .NET
Core 1.0 rather than any old vNext or preview stuff.
* Generate a JAX-RS server that assumes an Apache CXF framework on a Java EE server supporting CDI
* Samples for jaxrs-cxf-cdi
* Don't refer to missing class NotFoundException
* Update samples without missing NotFoundException reference
The AspNet5 generator was originally written to support project.json.
The Project.xproj was implemented without a valid project guid or root
namespace. During the transition period from project.json to
Project.xproj, VS2015 would fallback to project.json. Newer versions of
VS2015 don't seem to do this any longer.
This commit defines the project's guid correctly, and sets the project's
root namespace.
See: #3680
* Update JavaJaxRS/resteasy/api.mustache to have swagger annotations
The annotations should now appear on generated resteasy API classes.
* Re-generate resteasy petstore sample
* Add swagger-annotations to rest-easy samples as a dependency
* Regenerat pom.xml and build.gradle files for resteasy
* fix jaxrs line break
* fix java gradle bat line break
* fix scala gradle line break
* fix undertow crt line break
* fix spring line break
* fix undertow line break in pom
* rollback undertwo petstore to use petstore.yaml
* Issue #3738: extract AbstractScalaCodegen.
This seems to not change anything in the output, at least for the Petstore samples.
* Issue #3738: move languageSpecificPrimitives initialization to the super class
* Issue #3738 move CliOptions to AbstractScalaCodegen.
* Issue #3738 update samples.
Only one change, remove of unnecessary imports.
* uncommented server.port property in application.mustache template and set it to serverPort value parsed from spec file
* update Petstore sample for Spring MVC and Boot
* Amending Path annotation
Changed the Path annotation value from "/" to "/{{baseName}}"
* jaxrs-cxf-petstore-server.sh script was not referencing cxf module directory. Included generated files following script run. Have amended Path annotation value to {{contextPath}} and removed public access modifier from template as this is redundant for Java interface definition.
* add abstractPhpCodegen
* This base class should provide common functions to PHP-related generators so that the same enhancements or bug fixes can be applied to all clients.
Most source be moved from the PhpClientCodegen.
* change Lumen codegen to use the AbstractPhpCodegen
* remove the composerVendorName/composerProjectName. modify the LumenServerOptionsTest for unit test
* add context path
* reserve the apiDocPath and modelDocPath
* add the templateDir for lumen
* use square bucket for C# dictionary
* use packageName for nancyfx generator, update info to debug for log
* use packageName for nancyfx generator, update info to debug for log