43 Commits

Author SHA1 Message Date
karzang
e299382a42
[Java][Client] Fix handling of 'number' types in oneOf (#16202) 2023-08-06 11:16:50 +08:00
karzang
e9d98666a1
[Java][Client] Fix #12556 Support primitives and arrays in oneOf (#13897)
* [Java][Client] Fix #12556 Support primitives and arrays in oneOf

* Regenerate petstore samples

* Regenerate petstore test samples

* Treat 'BigDecimal' as primtive datatype

* Fix integration tests
2023-06-29 16:46:55 +08:00
Nathan Baulch
9f1fa0e440
Fix another batch of spelling typos (#13915)
* Fix typos

* Remove repeated words

* Minor grammar fixes
2022-11-07 21:30:24 +08:00
William Cheng
7370c4d3f8 update java samples 2022-03-25 00:42:07 +08:00
Justin Black
d4b8ff60a1
[Java] Fixes schema class type booleans for composed schemas (#10334)
* Adds get/setIsString interface to IJsonSchemaValidationProperties

* Adds get/set isNumber interface in IJsonSchemaValidationProperties

* Adds get/set isAnyType in IJsonSchemaValidationProperties

* Adds and uses ModelUtils.isAnyType, adds setTypeProperties

* Adds missing descriptions of isAnyType parameters

* Uses ModelUtils.isAnyType

* Samples regenerated

* Moves isArray handling higher up in fromProperty

* Moves isAnyTypeSchema handling higher up in fromProperty

* Moves isFreeFormObject handling higher up in fromProperty

* Refactors fromProperties, updates tests

* Fixes the fromProperty refactor, tests now pass

* Uses setTypeProperties to set isNumber, isNull, isArray, and isUnboundedInteger

* Sets isAnyType in setTypeProperties

* Sets isMap in setTypeProperties

* Sets property.isPrimitiveType in isFreeFormObject, tweaks if condition order

* Adds fix for JavaClientCodegenTest.testJdkHttpClientWithAndWithoutDiscriminator

* Refactors fromProperty

* Adds updatePropertyForObject updatePropertyForAnyType

* Sets binary and file types to not be strings

* Updates samples

* Adds updatePropertyForString

* Adds testComposedPropertyTypes

* Fixes python test

* Samples updated

* Switches all isAnyTypeSchema usages to ModelUtils.isAnyType

* Refactors model enum handling higher up

* Moves m.dataType assignent higher into fromModel

* Moves m.isNullable setting higher into isModel

* Adds updateModelForComposedSchema

* Further fromModel refactoring, all schema checks are now at the same indentation level

* Further refactors fromModel, adds isTypeObjectSchema block

* Moves addVars into anyType or objectType blocks in fromModel

* Turns off isNullable n isAnyType array

* Fixes typescript CodegenParameers

* Adds updatePropertyForAnyType to typescript-axios so property.isNullable will be false for AnyType

* Adds testComposedModelTypes

* Updates ComposedAnyType schema

* Fixes tests for JavaJAXRSCXF by adding updateModelForObject method

* Updates go and csharp to handle object model differently

* Adds updateModelForAnyType

* Fixes name reference

* Adds testComposedResponseTypes

* Refactoring fromResponse

* Further refactoring of fromResponse

* Uses setTypeProperties in fromResponse

* Tests now pass for testComposedResponseTypes

* Sets COdegenResponse dataType using getTypeDeclaration

* Begins refactoring of fromRequestBody

* Adds updateResponseBodyForPrimitiveType

* Adds all needed type if else blocks in fromRequestBody

* Fixes JavaJAXRSCXFExtServerCodegenTests

* Fixes RubyClientCodegenTests

* Adds fixes for clients that need custom isMap for body parameters

* Ruby broken, samples regened, debugging

* Adds updateRequestBodyForArray, renames updateRequest.. methods

* Samples regenerated

* Removes changes from Ruby generator

* Reverts RubyClientCodegen.java

* Reverts changes to GoClientCodegen.java

* Reverts PowerShellClientCodegen.java

* Reverts CrystalClientCodegen.java

* Removes updateRequestBodyForObject from JavaCXFServerCodegen.java

* Adds comment about refed models

* Tweaks made to fromProperties to add an explanatory comment

* Updates RustServer to have ByteArray request bodies not be strings

* Sets types in fromFormProperty

* Adds testComposedRequestBodyTypes

* Fixes when validation syncing is done in syncValidationProperties

* Removes redundant validation code from fromParameter

* Moves parameter inX setting higher up before schema logic in fromParameter

* More refactoring in fromParameter, uses early return to reduce levels of indentation

* Removes setParameterBooleanFlagWithCodegenProperty from updateRequestBodyForArray

* Removes setParameterBooleanFlagWithCodegenProperty from updateRequestBodyForObject

* Removes setParameterBooleanFlagWithCodegenProperty from  updateRequestBodyForPrimitiveType

* Removes setParameterBooleanFlagWithCodegenProperty from updateRequestBodyForMap

* Removes setParameterBooleanFlagWithCodegenProperty from addBodyModelSchema

* Removes setParameterBooleanFlagWithCodegenProperty from fromFormProperty

* Refactors parameter array handling code into fromFormProperty

* Simplifies fromRequestBodyToFormParameters

* Removes setParameterBooleanFlagWithCodegenProperty from fromParameter

* Adds deprecated docstring to setParameterBooleanFlagWithCodegenProperty

* Refactors ModelUtils.isFileSchema out of string schema check

* Removes ModelUtils.isFileSchema from RustServer updateRequestBodyForString

* Improves comment text

* Fixes RustServer uuid type setting for CodegenParameter

* Removes unneeded parens

* Fixes array property examples

* Removes unused code

* Renames variable to itemsProperty

* Adds testComposedRequestQueryParamTypes

* Adds updatePropertyForAnyType to rustserver will not have changed model properties

* Hoists arrayInnerProperty._enum into parameter for html2 generator

* Moves turning string type off into the codegen files

* Adds two more missing locations in rustserver

* Moves addVarsRequiredVarsAdditionalProps into anytype and objecttype handling

* More refactoring of where addVarsRequiredVarsAdditionalProps is used

* Samples regenerated
2021-09-27 16:12:40 -07:00
Artem
d68d65ce00
Fix java examples (#10257)
* TAP-655 fix examples java

* update samples
2021-09-02 11:08:35 +08:00
Nathan Baulch
5d68bd6a03
Fix thousands of spelling typos (#10272) 2021-08-28 22:58:24 +08:00
Tyler Ballast
f5151de9fc
Add whitespace to SDK documentation where necessary (#8919)
* Add a space between table title and the line above it to resolve issues when translating markdown to asciidoc

* Regenerate Samples

Co-authored-by: Tyler Ballast <tyler.ballast@reportix.com>
Co-authored-by: tballast <tyler.ballast@gmail.com>
2021-03-08 21:40:54 +08:00
Thomas Hervé
616b44f3b1
Improve generated Java examples (#8012)
* Add basic types imports to generated examples

This adds an extension to include basic types imports to generated Java
examples.

* Make some fixes to example generation

* Generate OffsetDatetime correctly

* Create a useful sample for enums, regenerate samples

* Fix BigDecimal as well
2020-11-26 18:14:26 +08:00
Jim Schubert
78bf3adc4a
[core] Initial FeatureSet structures and definitions (#3614)
[core] Initial FeatureSet structures and definitions
Add default feature set to DefaultCodegen
Initial FeatureSet definitions for:

*  ada 
*  android 
*  apache2 
*  asciidoc 
*  aspnetcore 
*  avro 
*  bash 
*  c 
*  clojure 
*  cpp-pistache-server 
*  cpp-qt5-client 
*  cpp-qt5-qhttpengine-server 
*  cpp-restbed-server 
*  cpp-restsdk 
*  cpp-tizen 
*  csharp 
*  csharp-nancyfx 
*  csharp-netcore 
*  cwiki 
*  dart 
*  eiffel 
*  elixir 
*  elm 
*  erlang 
*  flash 
*  fsharp-functions 
*  go  Client/Server
*  graphql-nodejs-express-server 
*  graphql-schema 
*  groovy 
*  haskell 
*  haskell-http-client 
*  java 
*  jmeter 
*  kotlin 
*  kotlin vertx 
*  kotlin-server 
*  kotlin-spring 
*  lua 
*  mysql 
*  nim 
*  nodejs 
*  nodejs-express 
*  objc 
*  ocaml 
*  openapi 
*  openapi-yaml 
*  perl 
*  php 
*  php-laravel 
*  php-lumen 
*  php-silex 
*  php-slim 
*  php-symfony 
*  php-ze-ph 
*  powershell 
*  protobuf 
*  protobuf-schema 
*  python 
*  python-aiohttp 
*  python-blueplanet 
*  python-experimental 
*  r 
*  ror 
*  ruby 
*  ruby 
*  ruby-sinatra 
*  rust 
*  scala-akka 
*  scala-finch 
*  scala-gatling 
*  scala-http-client 
*  scala-lagom 
*  scala-play 
*  scalatra 
*  scalaz 
*  spring 
*  static docs 
*  swift 
*  typescript
2020-01-11 16:20:47 -05:00
William Cheng
c3535cf9ca
Add test cases to cover different collection formats (#3640)
* add test cases to cover different collection format

* add space params to retrofit 1.x

* add space params to retrofit 2.x

* rename url to localVarUrl

* fix exception in haskell servant
2019-08-15 11:09:12 +08:00
Sai Giridhar P
6ff0512b31 [Java][jersey2]: Documentation changes and making example snippet compilable (#3056)
* feat(java-jersey2): Adding http response headers and making example compilable

* feat(java-jersey2): Updating pet project

* feat(java-jersey2): Removing uncessary lines from Readme

* feat(java-jersey2): Updating pet projects

* feat(java-jersey2): Updating pet projects
2019-06-03 15:42:41 +08:00
William Cheng
f015363dbd update samples 2019-03-25 22:44:05 +08:00
Justin Black
9ec594eec5 [Spec] adds XmlItem model and route for xml testing (#1883)
* Adds xmlitem model and route, rest-assured Api suffix fix, updates pytest and pytest-cov versions

* Adds python client sample files

* Adds samples update

* Adds rest-assured sample client update

* Adds sample updates in ensure-up-to-date

* Changes rest-assured files back to master version, removes fix for issue #13

* Updates samples
2019-01-26 17:26:38 +08:00
Jérémie Bresson
a7dfc650b6 Swagger parser update: 2.0.8-OpenAPITools.org-1 (#1721)
* Update Swagger-Parser Version

* Update samples

* surpress javadoc warning

* fix TS tests

* Set version to 2.0.8-OpenAPITools.org-1
2018-12-22 18:12:08 +08:00
William Cheng
c7349c7f88
Add top level x-group-parameters support (#1405)
* add top level x-group-parameters support

* update petstore samples
2018-11-12 14:25:32 +08:00
William Cheng
aced89ff8b
Add group parameter support to PHP client (#1337)
* add group parameter support to php template

* more update for group parameter

* fix call to protect function

* fix missing $

* update based on feedback

* create fake endpoint to test group parameters

* sync fake petstore spec v2, v3

* fix php doc for group parameters

* update petstore samples

* update fake petstore spec v2

* update petstore samples

* fix spec and update samples
2018-10-29 15:42:32 +08:00
William Cheng
999f472e4b
Refactor default and example values in Java generators (#1045)
* fix default, example for java okhttp

* update java feign samples

* update samples, doc

* add new doc for dart-jaguar

* update model template

* update jaxrs spec model

* update resteasy sample

* update java samples
2018-10-07 03:56:16 +08:00
John Wang
0bffdf2463 [Golang][client] fix for schema definition name file (#433)
* fix schema/definition name as 'file'

* update samples

* Trigger CI due to previous Shippable race condition

* add fix with toModelName(openAPIType)

* update tests for file schema/definition name

* Update 3.0 test spec

* update samples

* update samples for jaxrs-cxf

* Trigger CI due to previous Shippable race condition

* add back explode
2018-07-05 20:32:24 +08:00
Jérémie Bresson
673f2bc469
Add CodegenProperty.nameInSnakeCase (#42) 2018-05-15 13:17:04 +02:00
Jérémie Bresson
059a3efe46 Regenerate samples (#367) 2018-05-08 16:44:51 +08:00
Jérémie Bresson
e0b0248c38
Rename default package in java clients (#218) 2018-04-24 16:26:20 +02:00
Jérémie Bresson
c8c316e41e
Update java client samples OAS2 (#140)
* Update java client examples
* Rename artifactId in json config files
* Add imports in api.mustache for play24 and play25
2018-04-24 09:51:50 +02:00
wing328
cf5eba87bd update circleci to cover java google-api client, update Java petstore
samples
2017-11-03 18:49:32 +08:00
Brian Kim
044bfdac39 Fix #6166 by adding @Deprecated annotations in Java jersey2, okhttp-gson, resteasy libraries (#6801) 2017-10-25 11:10:03 +08:00
wing328
9269dac6cf Merge remote-tracking branch 'origin/master' into 2.3.0 2017-07-01 15:47:27 +08:00
Jordan Zimmerman
40369bb819 Add java8 option 2.3.0 (#5955)
* Closes #5863

The "dateLibrary" option for java, sadly, sets a mustache value "java8". This change updates this so that "java" in the mustache
libraries means what it should mean - use all java8 classes. In this case, there's no need for the third party Base64 library
as java8's JDK has this built in. In my view, the "dateLibrary" should be deprecated but that should be a separate PR.

* Closes #5954

built and ran tests/samples
2017-07-01 15:04:18 +08:00
wing328
8015744212 update java petstore samples 2017-06-29 13:53:37 +08:00
wing328
87bbbc1a1b Merge remote-tracking branch 'origin/master' into 230_merge_master 2017-06-05 23:27:11 +08:00
wing328
e1e5ac4d37 Merge remote-tracking branch 'origin/master' into 2.3.0 2017-05-17 22:00:06 +08:00
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
wing328
ad4de91d92 Merge remote-tracking branch 'origin/master' into 2.3.0 2017-03-30 09:57:07 +08:00
Paŭlo Ebermann
db71d97370 Updating samples after #5232. (#5243)
* 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.
2017-03-30 01:28:53 +08:00
Paul Ebermann
aba5abd15e Update samples again after swagger-parser bump. 2017-03-14 12:54:11 +01:00
Tony Tam
0dcd91adbf null out the string null in examples. Rebuilt java clients and made a whole bunch of changes 2017-03-10 11:07:30 -08:00
William Cheng
ce899e3776 Merge remote-tracking branch 'origin/master' into 2.3.0
Conflicts:
	appveyor.yml
	modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java
	modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java
	modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java
	modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringCodegen.java
	modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java
	modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache
	modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache
	modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache
	modules/swagger-codegen/src/main/resources/go/api.mustache
	modules/swagger-codegen/src/main/resources/objc/api-body.mustache
	modules/swagger-codegen/src/main/resources/objc/api-header.mustache
	modules/swagger-codegen/src/main/resources/typescript-angular2/configuration.mustache
	modules/swagger-codegen/src/main/resources/typescript-angular2/tsconfig.mustache
	modules/swagger-codegen/src/test/java/io/swagger/codegen/swift/SwiftModelTest.java
	modules/swagger-codegen/src/test/java/io/swagger/codegen/swift3/Swift3ModelTest.java
	modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular2/TypeScriptAngular2ModelTest.java
	samples/client/petstore-security-test/typescript-angular2/configuration.ts
	samples/client/petstore/go/go-petstore/docs/FakeApi.md
	samples/client/petstore/go/go-petstore/fake_api.go
	samples/client/petstore/go/go-petstore/pet_api.go
	samples/client/petstore/java/feign/pom.xml
	samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java
	samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java
	samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/FakeApi.java
	samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/RFC3339DateFormat.java
	samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/model/Animal.java
	samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/model/EnumTest.java
	samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/model/FormatTest.java
	samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java
	samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java
	samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/JSON.java
	samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java
	samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java
	samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java
	samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java
	samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java
	samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java
	samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java
	samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGPetApi.h
	samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGPetApi.m
	samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGStoreApi.h
	samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGStoreApi.m
	samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGUserApi.h
	samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGUserApi.m
	samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGApiClient.h
	samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGConfiguration.h
	samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.h
	samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.m
	samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.h
	samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.m
	samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.h
	samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.m
	samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.h
	samples/client/petstore/objc/default/SwaggerClient/Core/SWGConfiguration.h
	samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONResponseSerializer.h
	samples/client/petstore/qt5cpp/client/SWGPetApi.h
	samples/client/petstore/qt5cpp/client/SWGStoreApi.h
	samples/client/petstore/qt5cpp/client/SWGUserApi.h
	samples/client/petstore/typescript-angular2/default/configuration.ts
	samples/client/petstore/typescript-angular2/npm/README.md
	samples/client/petstore/typescript-angular2/npm/configuration.ts
	samples/client/petstore/typescript-angular2/npm/package.json
	samples/client/petstore/typescript-angular2/npm/tsconfig.json
	samples/client/petstore/typescript-fetch/builds/default/api.ts
	samples/client/petstore/typescript-fetch/builds/es6-target/api.ts
	samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts
	samples/client/petstore/typescript-fetch/tests/default/test/PetApiFactory.ts
	samples/client/petstore/typescript-fetch/tests/default/test/StoreApiFactory.ts
	samples/server/petstore/jaxrs-resteasy/default/src/gen/java/io/swagger/api/PetApi.java
	samples/server/petstore/jaxrs-resteasy/default/src/gen/java/io/swagger/api/PetApiService.java
	samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/io/swagger/model/User.java
	samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java
	samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java
	samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java
	samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java
2017-01-05 17:44:39 +08:00
wing328
131cbeb350 remove generation timestamp 2016-12-15 19:34:15 +08:00
wing328
90512e6326 Remove Apache license from API client generators (#4197)
* remove php apache license

* remove apache license from C#

* remove apache license in objc code

* remove license from swift 3 code

* remove apache license from perl code

* remove license from scala code

* remove license from ts, go, android, cpp, scala

* remove license from java api client

* restore clojure petstore files

* remove license from travis file

* clean up apache-related terms in php, ruby, python mustache tempaltes

* remove license from JS API cilent
2016-11-16 21:44:49 +08:00
Christophe Bornet
70d93883cf [Java] Threetenbp dates support (#4029)
* [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
2016-11-04 17:55:16 +08:00
Oliver Vidovic
da6e829c8e issue-890 correct fix for deprecated Jersey method
additionally
- fixed EnumValueTest to the directory structure based on the declared package
- regenerated samples/client/java/jersey1
2016-10-11 11:43:54 -04:00
Ville Skyttä
0363858672 java: Javadoc fixes 2016-09-01 18:07:35 +03:00
wing328
9e0c865c08 update java petstore sample 2016-07-15 17:45:06 +08:00
wing328
3b780e30d8 change java default lib to okhttp-gson 2016-07-07 15:53:16 +08:00