* Split up model template into partials
* Change models from class to struct.
This fixes issue https://github.com/swagger-api/swagger-codegen/issues/6941.
In this change, we make our Swift4 generated model objects struct instead of class. However, in order to do this, we needed to handle the following edge cases:
* Inheritance and polymorphism (allOf)
* With classes, we use inheritance. So therefore, the parent properties are ONLY on the parent generated class, and the model object which derives from the parent class picks up those properties through inheritance.
* However, structs do not support inheritance. So we simply duplicate the parent allOf properties in the child struct.
* We have to handle the case where the property name on the struct may be different than the property name in the JSON. By default, the Codable protocol assumes that the JSON property name is the same as the struct property name. If they need to be different, then we generate a CodingKeys string enum, which contains the mapping between struct property name and JSON property name.
* additionalProperties. We cannot use the default Codable implementation for the additionalProperties, since it will look for an actual dictionary called "additionalProperties" in the JSON. Therefore, for model objects which have additionalProperties, we must generate our own implementation for the Decodable and Encodable protocols.
I have run ./bin/swift4-all.sh and ./bin/swift4-test.sh to re-generate all of the sources, and I have verified that the generated code in samples/clients/test/swift4/default builds and the unit tests pass.
* Update VERSION in .swagger-codegen
* Update generated code for swift4-test schema
* #7365: use enums string / number literals for request parameter if it is an enum
* #7365: use enums string / number literals for request parameter if it is an enum
* #7365: use enums string / number literals for request parameter if it is an enum
* #7365: improve docs
* #7365: move code to AbstractTypeScriptClientCodegen, remove redundant code in TypeScriptAngularClientCodegen, change type Object to Number in numericEnumValuesToEnumTypeUnion()
* #7365: move code to AbstractTypeScriptClientCodegen, remove redundant code in TypeScriptAngularClientCodegen, change type Object to Number in numericEnumValuesToEnumTypeUnion()
* #7365: allow parameter data type customizations
* #7365: re-enable disabled unit test assertions
* #7365: remove enum handling from type declaration generation
* #7365: generate all typescript samples
* #7365: re-enable disabled unit test assertion
* copy mustache templates from dart generator
* Start with generator by copying the DartClientCodegen for now
* at least we know this is not for a browser..
* First working version for a simple swagger configuration
* remove browserClient parameter, since it doesn't make sense for flutter
* Take care of complex types to support object hierarchies
* add null safety
* add small test for options
* add flutter-petstore scripts
* generate flutter petstore output
* Add new flutter test project
* move generated client to make it usable
* use generated swagger petstore plugin
* add support for lists of objects
* add DateTime support
* fix listFromJson implementation
* fix NPEs in DateTime operations + place order in sample
* Small readme changes
* bugfixes
* Use flutter-compatible implementation as default dart implementation
* fix generated samples
* Make lists serializable, now all dart test cases are working again
* better list implementation
* use StringBuffer
* removed FlutterClientCodegen
* fix browser client
* fix dependencies
* swagger-browser-client for browserClient testcases
* fix scripts
* removed flutter scripts
* add map support and simplify code via using .toJson contract
* remove unneeded devDependencies
* Regenerated samples
* fix call to mapFromJson, it is not a constructor
* remove pointless string serialization
* regenerated dart samples
* update for ze-ph generator stub to support Zend Expressive 2.1 and Path Handler 0.3
* ze-ph: for each operation generator creates special DTO model from its query parameters
* ze-ph: generation of extra TODO's for complex container type and update for samples
* Ada generator generates "=>" (correct syntax) instead of "->". Fixes#7450
* Updated the Ada petstore samples
* Committing "VERSION" file and the rest of the petstore samples
* [csharp] Support composition on toJson
Previous implementation assumed specification only supports polymorphic
associations (via discrimator), although the code didn't seem to be
setup correctly for that in the first place. That is, the parent object
must define the discriminator (see
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#models-with-polymorphism-support),
so NOT HAS parent AND HAS discriminator doesn't make sense.
From a C# perspective, base classes should have the method marked
virtual and derived classes should override the method. This supports
both composition and polymorphic definitions.
* [csharp] this.Configuration in api template
Unprefixed Configuration property access leads to ambiguous references
when spec defines a Configuration model.
* [csharp] Models/properties support nested arrays
Previous implementation didn't support multiple levels of array with
array items as OpenAPI spec supports. This means an object defined as
type: array with items = type: array|items=double (which is common in
GIS) would not be possible.
This implementation assumes generics in the nested type definitions, so
the above would generate List<List<double?>> for model parent types as
well as property type declarations.
* [csharp] Regenerate integration test sample
* [csharp] Set "Client" case sensitive as reserved
* [csharp] Regenerate security sample
* [csharp] Regenerate samples
* [csharp] Support composition on toJson
Previous implementation assumed specification only supports polymorphic
associations (via discrimator), although the code didn't seem to be
setup correctly for that in the first place. That is, the parent object
must define the discriminator (see
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#models-with-polymorphism-support),
so NOT HAS parent AND HAS discriminator doesn't make sense.
From a C# perspective, base classes should have the method marked
virtual and derived classes should override the method. This supports
both composition and polymorphic definitions.
* [csharp] Regenerate integration test files
* [csharp] Regenerate samples
* [csharp] Regenerate security sample
* [csharp] this.Configuration in api template
Unprefixed Configuration property access leads to ambiguous references
when spec defines a Configuration model.
* [csharp] Regenerate samples
* Fix the comparison between two model types to compare them recursively
and make sure we sort the model types according to their dependencies
* Run bin/ada-petstore.sh to update the generated Ada client samples
* Fix Ada client generated code to avoid having a spurious body name for parameters passed in the body
* Run bin/ada-petstore.sh to update the generated Ada client samples
* [erlang-client] fix body param from being included path and base path to remove host
* [erlang-client] move request logic out of api functions to utils module
* [erlang-client] add support for passing http client configuration to requests
* [erlang-client] update auth handling
* [erlang-client] remove underscore2, replacing with original underscore + replaceAll
* Add default value and required parameter support to vertx server templates. Fix for #7409.
* Added missing serviceId declaration to workaround #allParams section clearing the vendorExtensions map
* [Rust] Consider error statuscodes to be errors
* [Rust] Introduce 'ApiError' type for 4xx/5xx resp
This updates the previous commit which added an 'ErrorStatus' variant to
an 'ApiError' variant.
It does not specialize the error to the specific possible error
responses yet, rather returning a 'serde_json::Value' for any case.
This will lose any error messages which cannot be parsed as json and
instead return a json-parse error.
A future change should update the generated signatures such that the
returned future's error type is specialized to the specific errors that
may be returned by that api (and possibly a catchall json::Value still).
* [Rust] Regenerate petstore samples
* [Rust] Add error example to petstore sample
* [Java] #3024 - Add build-helper-maven-plugin version to retrofit client template
* [Java] #3024 - Add build-helper-maven-plugin version to feign client template
* [Java] #3024 - Add build-helper-maven-plugin version to jersey client template
* [Java] #3024 - Add build-helper-maven-plugin version to resteasy client template
* Updated the version of Scalatra to the latest (2.6.2)
- Updated Scalatra 2.6.2 (latest)
- Updated Scala 2.12.4
- Updated sbt 1.1.0
- Reduced dependent artifacts to a minimum
- Cleaned up build.sbt
- Changed the package name from client to server
- Set log output (logback)
- Updated web.xml for servlet 3.1
* rename package 'com.wordnik' -> 'io.swagger'
* Added rolling file appender to logback.xml
* Disable creation of empty json fields and fields for primitives which were not set, but using default values
modelnamePrefix will be the one passed from command line or SWG if none
* Updates after review
Also common http files are splitted
Update Petstore examples
* Small Fixes for cleaning up arrays of arrays/maps
* Changes
- Api Body pass by Reference, avoid seg fault due to deletion of auto constructed object passed as parameter.
- Support Maps and Arrays upto a depth of 2
- Refactor Helpers to handle Maps and simplify code
* Remove size check due to possible incorrect type
* Update PetStore Examples for Qt5 C++ and small fixes for QDate/QDateTime
* Updates after review. Fixes typo and remove usage of auto keyword.
* Restored usage of auto keyword.
* #7359 Fix - use reflection to instantiate non-generated class (#7360)
* add tests for java vertx petstore
* add swagger example to README.md (#7368)
* Fix assignment of new object instance to variable
Fixes `Error in foobar$fromJSONString(s) : object 'CategoryObject' not found`
Discussion in https://github.com/swagger-api/swagger-codegen/issues/6520#issuecomment-357132746 ,
thanks @wing328 for encouraging.
* [scala] Escape reserved words, support Array[Byte]
Previously, Array[Byte] was compiling to ArrayByte. This provides a type
mapping to output the correct type.
This also escapes reserved words with grave accents, as is most common
in Scala. Escaping with an underscore prefix breaks serialization (in
Jackson, for example) unless templates are modified manually. Escaping
using grave accent should unblock most serializers from requiring
template modifications.
* [scala] Regenerate integration test outputs
* [scala] Regenerate samples
* [scala] Remove unused imports in related codegen files
* [Scala] Fix async helper methods when body is optional (#7274)
* [Scala] Fix async helper methods when body is optional
Closes#7272
* Update petstore sample
* Standardize all isRestfulxxx methods.
Change 'equals' method to 'equalsIgnoreCase' for isRestfulIndex method in Operations. This matches isRestfulCreate, isRestfulShow, isRestfulDestroy
* [scala] Fix default values in scala client
This uses consistent logic for optional types with default values in the
scala client. Also, uses Option(default) instead of Some(default) to
guard against people defining defaultValue = null. Option(null) becomes
None while Some(null) defines a null value explicitly and will break
maplike operations.
* [scala] Regenerate client sample
* [scala] Add missing json4s import, which will be added by another PR but allows current samples to generate
* [scala] Include integration tests for required attributes support
* [scala] Support string types with formats
This adds support for better support of type=string and
format={date,date-time,binary,byte}. Previously, binary and byte were
inconsistently defined as strings rather than byte arrays, while
date/date-time were parsing default values into formats that did not
match OpenAPI/Swagger 2.0 specifications for full-date and date-time.
We may want to consider pulling in json4s-ext to support wider date
formats and moving to date=LocalDate and date-time=ZonedDateTime.
This will have breaking changes for consumers expecting binary/byte to
be strings rather than byte arrays.
* [scala] Unique parameter names in integration test, to avoid seemingly conflicting names
* [scala] Regenerate client sample
* Sort file listings in AssertFile.java
Per File#list() javadocs:
There is no guarantee that the name strings in the resulting array
will appear in any specific order; they are not, in particular,
guaranteed to appear in alphabetical order.
I'm unable to repro directory listing failures on OS X High Sierra or
Ubuntu 16.04 under Parallels, so it's not clear to me if listing order
is indeterminate per-platform or the behavior is just not defined and
up to the platform's installed runtime. Sorting the array of strings
prior to comparison should resolve this issue on every platform/runtime.
* [scala] exclude api tests for integration test gen script
Script should match options in the integration test class
* [scala] Temporarily disable client integration tests
CI doesn't seem to pick up template changes in integration tests.
Disabling scala client integration tests, pending investigation of the
issue.
* [scala] Remove redundant json4s import
* [scala] Regenerate integration test
* [scala] Regenerate sample
* Initialize router in init method and re-use router member to create SwaggerRouter
* Added generated samples for 7320 fix
* Fixed alignment to 4 spaces for 7320 fix
* Make stripPackage name configurable via property
- Needed because some APIs (e.g. Kubernetes) include version information in packages. Stripping causes many generated API and model classes to be named the same, causing a last-one-wins situation which is unacceptable.
* Per PR review, ensure stripPackageName Boolean property and log warning
* Add Ada client petstore samples
- Add script to generate Ada client support with swagger-codegen
- Add files to build the Ada sample
- Add main program to use the generated client samples API
and connect to the server to perform some operations
* Add some description for the samples
* Update the documentation to explain how to build, how to use the generated Ada client code
* Add server support for path parameters
- Update postProcessOperations to scan each path parameter and emit a x-path-index
vendor attribute to tell the index of the path parameter
* Add and fix Ada server code package declaration
- fix declaration of operations
- generate a generic package that must be instantiated with the target server implementation
and which provides the skeleton (deserialization and serialization of data)
* Implement the Ada server side operations
- extract body, query parameters, path parameters
- serialize the result
- register operations to the server according to the path/routes
* Update the code generation to generate server Ada implementation code
* Improvement of Ada server support: generate the swagger.json template file
* Define toModelName operation to the creation of a model identifier
* Add support for server permission generation
- collect the security scopes in postProcessAuthMethod() method and make sure
these scopes have unique identifiers. Some scopes correspond to URLs
but others correspond to pseudo identifiers.
* Use the #lambdaAdaComment filter to indent correctly a multi-line description
* Fix model generation to support arrays
* Update the generated GNAT project file
* Refactoring and improvement of server code generation
- Change the server generated code to pass a Context_Type object
to allow the server implementation to get/set headers in the request/response
and control what is put in some responses
- Generate the security permissions based on the scopes that have been collected
* Server code generation improvement
- Fix generation of GNAT project
- Generate the intermediate Ada packages if necessary
- Generate the server main
* Ada server main template
* Ada server code improvement
- Add support to generate server permission verification
- Fix the GNAT project definition
- Templates for Ada intermediate packages
* Skeleton for the server side implementation
* Generate an empty Ada server implementation
* Templates for the Ada server implementation
* Add a README.md file and a GNAT config.gpr file
* New templates to document the generated Ada server
* Add server configuration file for the Ada server
* Fix the log message in the Ada server to report the correct URI to connect to
* Generate the Ada server configuration file
* Improvement of Ada code model to support nullable types
* Update the Ada server templates
* Refactor the Ada code generator
- separate the Ada client and Ada server code generators
- register the Ada server code generator under the name 'ada-server'
keep 'ada' for the client Ada code generator
- moved the common Ada code operation supports to the AbstractAdaCodegen
* Improvement and cleanup of Ada client and server code
- new template for the client main program
- fix the GNAT project template for client or server programs
- remove unused options to better use the --model-package option
* Fix the GNAT project file name to use a lower case name
Fix the default GNAT config
Fix the headers of intermediate Ada package files
* Regenerate the model and client Ada files
* Update the Ada client sample to take into account the Nullable types
* Regenerate some files with Ada Swagger Codegen
* Ignore generation of petstore.gpr
* Disable creation of empty json fields and fields for primitives which were not set, but using default values
modelnamePrefix will be the one passed from command line or SWG if none
* Updates after review
Also common http files are splitted
Update Petstore examples
* Initial commit, Generates everything necessary to run a performnace test against a swagger api. Just have to fill out the CSV feeder files with your data.
* adding samples and gatling-petstore.sh file
* Extending the AbstractScalaCodeGen
* Checking in the CodegenConfig file as it is needed to generate
* removing escaped reserved words
* Changed model to be able to make all variables utilize an underscore while json fields are still just the variable name
* Changing underscore to var as interpolation can not start with a _ in scala
* Fixing path params
* allow you to pass in a system property to define which config to use as a workload profile, use rate and instance multipliers to scale up and down your test, added ramp down after the test is completed, added global assertions.
* Addressing PR feedback
* missed semi-colon
* Bringing everything up to date with the renames that were suggested
* [haskell-http-client] handle */* mimetype correctly
* [haskell-http-client] generate separate api modules, for each child api
* [haskell-http-client] add cliOption "allowNonUniqueOperationIds"
When cli option "allowNonUniqueOperationIds" is true,
allows *different* API modules to contain the same operationId,
and then each API must be imported qualified.
* Fix some go client formatting issues
* Fix go client go imports
* Run `goimports -w .` on examples directory
* Sort imports in api
* Add new line between each property
Before secret feature was used to add new line using two property
declaration in the same line. There should be no new line before
first property. The easiest way is to use `-first` special
property
https://github.com/samskivert/jmustache#-first-and--last
New line are required so `goimports` won't reformat whitespaces between
property name and type.
* Change whitespaces to tabs
* Fix whitespaces in api_client
There is a new line between each service to prevent `goimports` from
adding whitespaces between types and names
* Fix more whitespaces
There was a need to set special delimeter for formatting in the commit.
Go slices use curly braces and `jmustache` got confused when found
triple curly braces.
* Fix whitespaces in configuration.mustache
* Fix whitespaces for api response
* Support for optional description
Do not add whitespace if description is missing
* Add new lines between enum values to prevent formatting
* Generate go code from current code
- imports are not sorted :(
- there are extra whitespaces for different languages. I don't know why
* Run generate for security tests
This is the initial Codegen for Elm 0.18.
Please try it out and provide feedback.
Not yet supported:
* path variables;
* additionalProperties;
* authentication;
* recursive types.
* Commit leftover snapshot changes
* Add logic to deal with non-JSON body params
If the spec specifies a list of consumes MIME types, default to the
first MIME type in the list instead of "application/json" (the user may
still override this by passing "Content-Type" in options.headers).
Additionally, only perform explicit JSON serialization if the data type
of the body parameter is not "string", or if it is string, only when the
content type is "application/json".
* Update snapshots
* Added pkmst-microservice toolkit
* formatted
* replaces tab with blank spaces
* adding documentation folder
* adding documentation folder
* Update readme.mustache
Added feature set offered by pkmst
* updated readme
* Update io.swagger.codegen.CodegenConfig
Arranged pkmstServerCodeGen and SymfonyServerCodegen in aphabatical order
* Update readme.mustache
* renamed according to convention and added typeinfoannotation
* removed tabs
* updated codegen which extends abstractjavacodegen
* Added the script files and rectified the errors
* folder name changed and commons -lang3 version upgraded
* updated readme.mustache
* updated logging filter
* Added petstore to samples and updated the pom for the same
* Added java-pkmst sample to pom.xml.circleci
* updated readme.mustache
* use status codes in the variants of the responses instead of message
* samples
* add missing {{code}}
* use human friendly idents if possible
* generate samples
* salvage an oversight
* java 8 interface only delegate method mode
* typo correction
* Update samples with ./bin/spring-all-petstore.sh
* change delegate prefix to "do" and make delegate method a default method that returns an OK status code
* remove temp debug printout
* prefix spring annotated method with "_" to indicate that is private
* resolve merge issues from Merge of remote-tracking branch 'upstream/master'
* tuned whitespace in api.mustache and re-ran spring-all-petstore.sh
* removed special spring cloud library check as it was no longer being referenced in api.mustache
re-ran spring-all-petstore.sh
* [akka-scala] template upgrade dependency version and refactor #7171
* update sbt dependencies version and add enforce plugin
* delete new to the case class
* Prevent usage of reserved keyword for model fields
* Changes from code review to follow JS convention of using toParamName and toVarName
* Another small change from code review. Removing from postProcess because it is already called from somewhere else.
* Ran bin/aspnetcore-petstore-server.sh
* Added contact information to startup.cs
* updated to support NAME as well
* updated samples
* updated NAME default
* Updated Codegenerator as well as added new swagger-original mustache template
* updated Startup.cs template to provide guidance for original Swagger file
* Updated Sample
* Added support for VERSION and APPNAME from Swagger file into Startup.cs for Swashbuckle SwaggerGen
* Ran bin/aspnetcore-petstore-server.sh
* Added contact information
* Added contact information to startup.cs
* MMORCH-428: Export the Authorization struct
This is needed so that code can check that the version of Authorization
in the auto-generated code is the same as the version it is using. If
the versions are not exactly the same then the lookup into the TypeMap
will not work.
* Add Rust as a supported language for client and server.
Clarify that there are two Rust client implementations, and one Rust server implementation.
* Percent-encode path and query parameters in client URLs
Fixes#122
Also don't include a question mark at the end of the path when there are no query paramters.
Fixes#121
* Rust2 client: add --host and --port parameters to example client.
Allows the example command-line client to override the default host and port.
* Extract default host and port from Swagger file.
* Derive 'Eq' and 'Ord' on enums
* Rust2: improve server code structure.
server.rs (main.rs) - main entry point for binary; starts the web server and points it at the server code within the library.
server_lib/mod.rs (lib.rs) - root of library; creates the server.
server_lib/server.rs (server.rs) - actual server code
The old server_lib/mod.rs is now server_lib/server.rs; server_lib/mod.rs is new.
This structure is easy to map onto a server implementation; unfortunately we can't get it exactly right here because of the limitations of cargo's examples/ folder.
* Rust2: Explain fully how to use the example code in your project.
* Added plaintext support
* Linting
* MGJ Markups
* Move errant file to 'rust-server'
Rust2 was the old name
* Add license and description to Cargo.toml
For rust-server, getting them from the swagger
* Valid Java doesn't have uninitialised variables...
* Default license to "Unlicense"
* Set license to "Unlicense" for generated crates
* Updated to .NET Core 2.0
* Fixed issue with IConfiguration vs. IConfigurationRoot
* Ran bin/aspnetcore-petstore-server.sh
* Updated to .NET Core 2.0
* Fixed issue with IConfiguration vs. IConfigurationRoot
* Ran bin/aspnetcore-petstore-server.sh
* Add README.md to the typescript jquery client generator
* Fix from code reviews about the addition of README.md. Made the fix in fetch too since it was a copy paste
* Operation now returns StatusCode Stubs as well
* Updated mustache file to use comments
return StatusCode(..) is now commented out.
* Change default(..) to not escape the type
default(dataType) --> default(&dataType)
* Return IActionResult no matter what..
* Updated formatting
* Ran bin/aspnetcore-petstore-server.sh
* Do not apply content-type header if no request body
* Set content-type header if there are form params
* Add tests
* Run update script
* Regenerated sample clients
* add support for async routes/endpoints
you can now set --optional-properties async=true to generate
a nancyfx server stub that uses asynchronous programming.
(cherry picked from commit 126869cb0b967e8063417e11993cf6326ce8ffd4)
* add nancyfx-petstore-server-async.sh to generate sample of async nancyfx.
* Rename async => asyncServer
* update bin/nancyfx-petstore-server-async.sh
* rename async => asyncServer in api.mustache + small bugfix
* run ./bin/nancyfx-petstore-server.sh and ./bin/nancyfx-petstore-server-async.sh
* remove additional new line in api.mustache + add space after if
* run ./bin/nancyfx-petstore-server.sh and ./bin/nancyfx-petstore-server-async.sh
* Map `date` fields to LocalDate c# type + add a JsonConverter for LocalDate.
* #6818: support for security definitions and some refactoring
* adding support for Either
* adding dates with TimeZone (date-time) and Local (date)
* cleanup
* generating code
* Updated swagger-ui wget url to https
* Issue #6902 Add Observe/ReportProgress pass through variables to the response for each api call for angular 4.3 and above
* Issue #6902 Fixed problem where extra comma as generated and should
not have been.
* Issue #6902 Fixed compiltion issue for Angular 4.3
* Objects are represented by `ModelBase.h`, not `Object.h` which does not exist.
* Use correct relative imports for files in the `model` and `api` folders.
* [CppRest] Update cpprest petstore client sample.
* Implement `Object` class to support arbitrary types.
* [CppRest] Update cpprest petstore client sample.
* [CppRest] Add newly generated files to petstore client sample.
* [CppRest] Add `Object` to CMakeLists.
* Initial Commit
* Removed unneeded class, Updated names as per naming conventions, Removed licensing info from generated code
* Moved samples from client folder to server
* Fixed naming issue with scripts in the bin
* improved code format for api
* fixed compile issue and improved formatting
* fixed compile issue and improved formatting
* update versions of dependencies on swift4 and swift3
* change syntax for swift4
* run petstore script
* change enum case from UpperCamel to lowerCamel
* remove unneeded break statements
* avoid wrapping conditionals in parentheses
* avoid force casting
* run pod update on petstore/swift4/rxswift
* update project for swift 4
* run swift4-petstore-all.sh
* fix compile error
* avoid use iso8601 date strategy for encoder / decoder
* resolve file references
* the result I want to obtain
* add csharp-petstore-net-40.bat for windows
* just ran bin\windows\csharp-petstore-all.bat
* Removed those directories:
- samples\client\petstore\csharp
- samples\client\petstore\csharp-dotnet2
then ran :
bin\windows\csharp-petstore-all.bat
* - update JsonSubTypes to 1.1.3 by using nuget dependency (the package is compatible with net40)
- allign all version of Newtonsoft.Json to 10.0.3
* the result of bin\windows\csharp-petstore-all.bat
* ran bin\security\windows\csharp-petstore.bat