9299 Commits

Author SHA1 Message Date
Thomas Hansen
e2b9f39b19
[PHP] ObjectSerializer::deserialize() associative arrays bugfix (#12849)
* [PHP] ObjectSerializer::deserialize(): fix bug with json_encode

* [AUTOGENERATED] update samples
2022-07-16 17:21:42 +08:00
Sascha Peilicke
bf604a08ab
Java: Add toString method to ApiException (#12851)
Previously, only the class name appeared in stacktrace whereas now
relevant details are added. This applies to most Java-related
generators.
2022-07-16 17:20:30 +08:00
William Cheng
40c87e125c
fix stream_callback doc (#12879) 2022-07-16 16:33:41 +08:00
William Cheng
ed6280b0f7
add roxygen2 to workflow (#12880) 2022-07-16 16:33:23 +08:00
stropho
87aab5a1f3
[typescript-axios] discriminator type in template (#12878)
* feat(typescript-axios) discriminator type

* add samples
2022-07-15 11:39:26 +02:00
Ruben Fiszel
810a8b5937
[Typescript] Support text/plain by ObjectSerializer.stringify (#12799)
* [Typescript] Support text/plain by ObjectSerializer.stringify

* Update ObjectSerializer.mustache

* Update ObjectSerializer.mustache

* Update ObjectSerializer.ts

* generate samples

* generate samples

* update samples, remove trailing spaces

* Update modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache

Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>

* regenerate samples

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>
Co-authored-by: Esteban Gehring <esteban.gehring@bithost.ch>
2022-07-15 11:35:34 +02:00
William Cheng
a3269a0569
Add R GitHub action file (#12868)
* fix travis, update rbuildignore

* add comment
2022-07-15 15:31:22 +08:00
Justin Black
ca4a86ea55
Turns on json-schema python-exp anyOf + oneOf unit tests (#12864)
* Spec updated to anyof only

* All tests turned on

* Revert version file

* Adds oneOf tests also
2022-07-14 09:57:43 -07:00
William Cheng
28b74d79cb
remove unused import in r package (#12867) 2022-07-14 16:23:02 +08:00
William Cheng
4dfac192f8
fix warning in rdoc due to missing @param (#12865) 2022-07-14 15:41:56 +08:00
Justin Black
01afbaecd8
[python-experimental] turns on allOf unit test cases (#12826)
* Spec regenerated with only allOf on

Sample regnerated

Fixes a bug where AnyType composed schemas omitted validations, Fixes a bug where properties in AnyType schemas were omitted, Stops storing multipleOf value in a list

Adds required variable info to AnyType classes

Samples regenerated

Turns all unit tests back on

* Samples regenerated

* Docs and models regenerated
2022-07-13 19:27:55 -07:00
Justin Black
c44fe8a04a
Fixes fromProperty when property is required vs optional (#12858)
* Adds required boolean to fromProperty

* Adds required to other method signatures

* pythn-exp sample regenerated

* Samples regenerated

* Adds java test of fix
2022-07-13 18:17:33 -07:00
William Cheng
5aa0e0a456 update samples 2022-07-13 17:32:31 +08:00
justM4D
464da4a10f
[csharp-netcore] Generic Host: Added port definion to the uriBuilder in API template (#12795)
* Added port definition to uriBuilder, since it was ignored before and couldn't be set even by supplying a custom client

* generated samples

* update samples

Co-authored-by: Matthias Lewen-Rieger | PROSPER X GmbH <matthias.lewen-rieger@prosper-x.de>
Co-authored-by: William Cheng <wing328hk@gmail.com>
2022-07-13 16:49:59 +08:00
devhl-labs
636820b541
Add nonNullableVars to CodegenModel (#12815)
* added nonNullableVars

* build samples
2022-07-13 16:48:23 +08:00
Linus Klöckner
57496ff0b0
[java][okhttp-gson] Complex values in form data get serialized as JSON instead of String (#12779)
* Java: fix complex object serialization in form-data

* Java: update samples
2022-07-13 15:47:39 +08:00
Oleh Kurpiak
2e2da7bc82
[Spring] fix deprecated generation (#12832) 2022-07-13 11:08:28 +08:00
Edward Poot
8025aa3bfa
Fix: Always set jakarta_annotation_version (#12834)
Commit 1735ab9d27656171def2440fa75cfe0c80a510f5 added changes to set the `jakarta_annotation_version`.

I've recently noticed that when using retrofit2 library, the project builds fine with Maven but fails with Gradle.

The build fails due to `Could not get unknown property 'jakarta_annotation_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler`.

Digging into this, in the generated `build.gradle` the `jakarta_annotation_version` is never set.
Upon closer inspection, aforementioned commit seems to indeed set it differently for the Maven build configuration than the Gradle build configuration (same for SBT configuration) for that matter.

The issue is that due to human error the `jakarta_annotation_version` line is added within the `{{#usePlayWS}}` block, meaning it won't be generated when `usePlayWS` is false, even though it should.

This commit changes this to always generate it.
2022-07-13 11:05:35 +08:00
William Cheng
60c5875091
Custom Content type: better message and added tests (#12841)
* add tests for custom mime types

* better message for custom mime type example handling

* minor code format change
2022-07-12 18:32:15 +08:00
William Cheng
244a459836 update samples 2022-07-12 00:15:58 +08:00
Thomas Hansen
cd48db43b4
[PHP] Add support to nullable (based on #3493) (#12794)
* [PHP] Add support to nullable (based on PR 3493)

* [AUTOGENERATED] update samples
2022-07-12 00:00:39 +08:00
William Cheng
20420e5e14
[R] add streaming support (#12821)
* add streaming option to r client

* support callback function to process data stream

* add stream test, minor bug fixes

* fix api client

* return void earlier if streaming, add tests
2022-07-11 00:19:07 +08:00
William Cheng
574f6f3192
fix tests (#12820) 2022-07-10 17:16:45 +08:00
William Cheng
bf2083c22f add new rust test files 2022-07-10 16:14:44 +08:00
William Cheng
e93be506da upadte samples 2022-07-10 16:00:25 +08:00
William Cheng
82b7859c19
add tests for rust nullable required parameter (#12814) 2022-07-10 15:54:33 +08:00
William Cheng
9d6b12591e
Fix set, map import (#12818)
* fix set, map import

* update samples

* update tests
2022-07-10 14:58:55 +08:00
William Cheng
f242b5e1dd
Skip import of allOf composition schema (#12798)
* skip import of allOf composition schema

* update samples

* allow python generator to keep old behaviour

* update js import
2022-07-10 14:58:22 +08:00
Justin Black
d6b360d47f
[python-experimental] Allow schema instances to be passed in and pass additional schema validations (#12758)
* Converts all schema instances back into primitives in cast_to_allowed_types, fixes test test_deserialize_oneof_reference

* Updates type hint

* Adds validated_path_to_schemas input

* Adds debugging, storess validated schemas in validated_path_to_schemas

* Adds __process_schema_classes

* Simplifies class creation for enums, True/False/None

* Removes unused methods

* Fixes two tests

* Removes unneeded method _enum_by_value

* Adds and uses validation_ran_earlier

* Skips running validation if already ran, base_classes changed to seen_classes

* Adds and uses validation_ran_earlier

* Simplifies __get_simple_class

* Casts None/True/False into NoneClass and BoolClass instances to make tpye checking and unique items checking simpler

* Always cast file input to FileIO, removes __get_simple_class

* Moves type checking to separate class

* Moves validation checking into a _validate method

* Moves enum value checking into SchemaEnumMaker's _validate method

* Fixes test_dict_validate_direct_instantiation_cast_item

* Removes spy_decorator

* Fixed test_dict_validate_direct_instantiation

* Fixes test_list_validate_direct_instantiation_cast_item

* Fixes test_list_validate_direct_instantiation

* Fixes test_list_validate_from_openai_data_instantiation

* Fixes test_dict_validate_from_openapi_data_instantiation

* Fixes test_upload_files

* Samples regenerated

* Reverts version file
2022-07-09 18:06:09 -04:00
Justin Black
35c31c129a
Fixes rust sample so CI test will pass (#12817) 2022-07-09 17:32:11 -04:00
Thomas Hansen
1a44a5284a
[PHP] Fix message for InvalidArgumentException(), when failing to test pattern (#12780)
* [BUGFIX] model_generic.mustache: Display property name instead of its value, when throwing InvalidArgumentExeption() for values not respecting a given pattern

* [AUTOGENERATED] Generated files
2022-07-07 01:17:22 +08:00
Tom Bärwinkel
728c80abea
Add option to use custom a monad (#12618) 2022-07-07 01:13:06 +08:00
William Cheng
f5b5feb58d
remove warnings related to escaping the characters in the md generator (#12774) 2022-07-06 14:19:40 +08:00
William Cheng
1383be4a2e
Fix missing import in jaxrs pojo (#12766)
* fix missing import in jaxrs pojo

* trigger build failure

* Revert "trigger build failure"

This reverts commit 4eed12f850cbc008404b0dc2284245f3d3ce4a15.
2022-07-05 17:12:26 +08:00
Bogdan Ilchyshyn
97daba5c58
fixing error handler interceptor (#12761) 2022-07-04 09:06:34 +02:00
William Cheng
6cae0fbb78 Merge remote-tracking branch 'origin/6.1.x' 2022-07-04 01:22:51 +08:00
William Cheng
9e412edb64
Prepare 6.0.1 release (#12762)
* update to v6.0.1

* update doc

* update samples
2022-07-03 23:36:46 +08:00
Gabriel Mazetto
b97a4ad12a
Generate .gitlab-ci.yml files for Ruby template (#12750) 2022-07-03 17:52:32 +08:00
William Cheng
72b4189f76 add back elixir petstore test-related files 2022-07-03 17:34:11 +08:00
Austin Ziegler
18a07eab37
Improved Elixir Code Generation (#12751)
* Bump the minimum version of Elixir supported

The previous minimum version of Elixir is several years EOL.

The current minimum version of Elixir is also EOL, but is the minimum
version required to support some upcoming changes to the config
templates.

* Bump the minimum version fo Tesla

Keep the dependencies up to date

* Add a default .formatter.exs

* Add two Elixir-specific mustache lambdas

- The `atom` lambda results in the proper quoting of an atom depending
  on the safe contents of the atom text, per the Elixir language
  specification. That is, `{{#atom}}foo{{/atom}}` will be turned into
  `:foo` and `{{#atom}foo.bar{{/atom}}` will be turned into
  `:"foo.bar"`.

- The `env_var` lambda results in the treatment of the identifier
  provided being capitalized as an environment variable would be.
  `{{#env_var}}apiVersion{{/env_var}}` would become `ENV_VAR`.

* Use modern Elixir configuration

- This includes runtime configuration
- It depends on the `env_var` lambda.

* Fix a Language Server Warning

This change is *optional*, but removes a LS warning that was raised.

* Regenerated openapi_petstore for Elixir

* Add ex_doc as a default dependency

Fixes #12484

* Refine the regular expression for atoms

The original regex incorrectly matched `123Number` (unquoted atoms
cannot begin with numbers) and would incorrectly quote atoms ending in
`?` or `!`. Through testing with `iex`, it also turns out that the atom
`:-` is legal.

The following atoms will now not be quoted that would have been
incorrectly quoted:

- `:-`
- `:declawed?`
- `:neutered!`

The following atoms will be quoted that were incorrectly unquoted:

- `:"123Number"`

* Improve regex (again), remove files not generated

- The previous commit resulted in a number of warnings that were still
  present and so I played with the regular expression. This did not
  solve the problem, but the resulting regular expression is *much*
  better than the previous one, so I'm keeping it.

- The problem was that the configuration (`bin/configs/elixir.yaml`) is
  generated using a 3.0 input spec:

  ```yaml
  inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
  ```

  Which means that there were 16 files committed which were no longer
  being generated. When I tested with the 2.0 input spec:

  ```yaml
  inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
  ```

  The files were generated again. I *believe* that the correct change
  here is to switch back to the 2.0 input spec, as it tests more code
  generation, but I wanted to check in before I did this.

  The following files are deleted:

  - `elixir/lib/openapi_petstore/model/additional_properties_any_type.ex`
  - `elixir/lib/openapi_petstore/model/additional_properties_array.ex`
  - `elixir/lib/openapi_petstore/model/additional_properties_boolean.ex`
  - `elixir/lib/openapi_petstore/model/additional_properties_integer.ex`
  - `elixir/lib/openapi_petstore/model/additional_properties_number.ex`
  - `elixir/lib/openapi_petstore/model/additional_properties_object.ex`
  - `elixir/lib/openapi_petstore/model/additional_properties_string.ex`
  - `elixir/lib/openapi_petstore/model/big_cat.ex`
  - `elixir/lib/openapi_petstore/model/big_cat_all_of.ex`
  - `elixir/lib/openapi_petstore/model/inline_response_default.ex`
  - `elixir/lib/openapi_petstore/model/special_model_name.ex`
  - `elixir/lib/openapi_petstore/model/type_holder_default.ex`
  - `elixir/lib/openapi_petstore/model/type_holder_example.ex`
  - `elixir/lib/openapi_petstore/model/xml_item.ex`
  - `elixir/pom.xml`
  - `elixir/test/pet_test.exs`

  In the interim, I have removed those files from the commit.
2022-07-03 17:31:34 +08:00
William Cheng
f1dd44d70c
add tests for item with special characters (#12757) 2022-07-03 17:26:12 +08:00
Justin Black
6158274f65
Adds openapi v3.0.3 unit test spec, includes test cases, autogenerates model tests with them (#12619)
* Adds draft6 tests and python file reader

* Adds processing of multiple files

* Moves test examples into a different component so component schemas can be booleans

* Excludes boolean schema cases and some others that contain patternProperties

* Adds automatic test generation, template not quite working with indentation

* Turns on allOf tests, some failing

* Adds more generated components and tests

* Adds enum tests

* Turns on all of themissing tests

* Adds exclmax and min exclusion reasons

* Adds items test cases

* Adds maximum

* Adds maxItems

* Adds maxLength

* Adds maxProperties

* Adds minimum

* Adds minItems

* Adds minLength

* Adds minProperties

* Adds multipleOf

* Adds not

* Adds oneOf

* Adds pattern

* Adds patternProperties

* Working on properties examples, partial fix for escaped characters

* Further improves example string escaping

* Fixes properties test cases

* Adds draft6 test samples license

* Adds ref

* Finishes ref

* Adds remoteRef

* Adds required

* Improves required testing

* Fixes build error / javadoc warning

* Fixes uniqueItems bug in python-experimental

* Turns all tests back on

* Fixes 2 failing tests, all python tests pass

* Fixes java npe errors

* Fixes formatting of tests, indentation fixed

* Test fase name fixed to toTestCaseName, docstring added to ObjectWithTypeBooleans

* Fixes typo

* Adds test deletion to samples generation, samples regenerated

* Updates python-exp unit test sample, includes new ref examples
2022-07-01 13:46:02 -07:00
William Cheng
4cf58f5886
support enum integers in powershell client (#12752) 2022-07-01 13:52:47 +08:00
William Cheng
d0a0b822d6
[csharp-netcore] Add support for ComVisible, CLSCompliant attributes (#12733)
* add support for ComVisible, CLSCompliant attributes in csharp-netcore clients

* fix import
2022-07-01 13:51:29 +08:00
Anakael
280de38de9
[csharp-netcore] fix: url escaping (#12739)
* fix: url escaping

* doc: add Polly to dependencies

* Revert "doc: add Polly to dependencies"

This reverts commit 29b95ed2c42455e970ac806149c7602980be8f2f.
2022-06-30 23:10:17 +08:00
William Cheng
c982421495
[Go] use EqualFold instead instead of comparing strings in lower case (#12741)
* use EqualFold instead in the go client

* update samples
2022-06-30 23:09:10 +08:00
William Cheng
08108cc4ba
add tests for nested oneOf fromJSONString (#12740) 2022-06-30 23:08:49 +08:00
Bogdan Ilchyshyn
3a2bbbb850
support error handling in middleware (#12716) 2022-06-29 07:59:51 +02:00
William Cheng
0232d1cd00
add toString method to oneOf/anyOf objects (#12727) 2022-06-29 11:01:56 +08:00
William Cheng
3feb11acbb
fix nested oneof, fix toStringJSON (#12723) 2022-06-28 23:43:56 +08:00