1385 Commits

Author SHA1 Message Date
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
William Cheng
119370079a update spec template, samples 2021-09-25 18:14:26 +08:00
romanblack1
7384a1e513
Define content type only if the body is not empty (#9766)
* define content type iff the body is not empty

* update samples
2021-09-25 15:05:38 +08:00
romanblack1
622a936358
Define content type if and only if the body is not empty (#9910)
* rubypatch

* moving change to api.must

* fix content_type to content-type

* added end to if
2021-09-25 14:53:58 +08:00
Bodo Graumann
be3bd2e6c7
[Typescript] Improve exception for unknown responses (#10361)
* Clean up tests

* Change pets to async-await

* Use different pets for each test

* Workaround multiple petstore server instances

* Add test for unknown error response code

* Remove call duplication

Running the petstore server locally fixes all issues.

* Make body of unexpected error responses available

* Regenerate all consolidated typescript samples

* Remove json heuristic for unknown error responses
2021-09-24 23:53:37 +02:00
William Cheng
acd747ca6d Merge remote-tracking branch 'origin/master' into 6.0.x 2021-09-22 12:13:44 +08:00
William Cheng
acdf357b76
Revert "Accept header forces application/json type even if server (#10337)" (#10440)
This reverts commit 18301d00112e064d80d94f1ca5d6ca6032808ddd.
2021-09-21 18:17:05 +08:00
Wojciech Trocki
18301d0011
Accept header forces application/json type even if server (#10337)
* fix!: accept should not force application JSON 

Generated code offen provides range of accept methods.
This method improperly takes JSON as preferred

Example:
	localVarHTTPHeaderAccepts := []string{"application/zip", "application/json"}

* chore: generated changes
2021-09-21 12:04:00 +08:00
Wojciech Trocki
a939676c0d
fix: expose allowed values of the enum (#10386)
* fix: expose allowed values of the enum

Fixes #10385

* chore: update examples
2021-09-21 11:58:38 +08:00
William Cheng
1947f130c0 update doc, samples 2021-09-21 11:52:33 +08:00
adessoDpd
1a48c5f19f
[Wsdl] Handle schema property of type array with oneOf items and other minor updates/fixes (#10434)
* add handling of array of oneOfs

* handle res model-type lowercase name +shorten code

* remove unnecessary vendor-extension model enum

* handle openapi lowercase schema name for array res

* change xs:anytype to string for file responses

* update checkstyles

* remove not needed imports again

* update samples

* upper/lowercase use local getdefault

* update  samples again
2021-09-21 11:46:05 +08:00
Thomas Leplus
80fb9e9889
Use 'this' to assign to class field. (#10417) 2021-09-19 11:42:34 +08:00
bflaton
9479d35081
Python client docstring (#10339)
* Updated template so that generated code now renders docstrings and function parameters nicely in IDE.

Endpoints are still accessible in generated code, mainly to satisfy some test cases.

* fixed manual tests
2021-09-14 09:38:48 -07:00
Noor Dawod
495f6eb30c
Dart2 template linting (#10263)
* Bump jimschubert/query-tag-action from 1 to 2

Bumps [jimschubert/query-tag-action](https://github.com/jimschubert/query-tag-action) from 1 to 2.
- [Release notes](https://github.com/jimschubert/query-tag-action/releases)
- [Commits](https://github.com/jimschubert/query-tag-action/compare/v1...v2)

Signed-off-by: dependabot[bot] <support@github.com>

* Updated Dart2 template to fix linting errors when using recommended rules.

* Updated Petstore code.

* Revert to having no EOF marker at end of few files.

* Fix a call on null value.

* Updated Petstore code.

* Add more checks for nulls.

* Updated Petstore code.

* Updated Petstore code.

* Revert back decoding an enum value.

* Revert back decoding an enum value.

* Updated Petstore code.

* Revert to older version of _convertParametersForCollectionFormat method.

* Updated Petstore code.

* Updated template and Petstore files.

* Adjust doc for analysis_options file.

* Updated Petstore sources.

* Shorten command to replace path parameters.

* Updated Petstore code.

* Add a space for readability.

* Adjust template per feedback.

* Remove unneeded break statements.

* Updated Petstore code.

* Keep a new line character when replacing parameter names (like before).

* Remove string interpolation.

* Updated Petstore code.

* Remove commented code.

* Regenerate Petstore code.

* Regenerated Petstore code.

* Use another parameter name to stop variable shadowing.

* Regenerated Petstore code.

* Put description adjacent to the class.

* Add another global ignore for all files: constant_identifier_names

* Use const for contentTypes and authNames.

* Regenerate Petstore code.

* Use shorter code to check for an empty array.

* Regenerate Petstore code.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-13 09:40:15 +08:00
Mike Marchetti
9464999d9c
fix: handle deepcopy of openapi objects (#9735) (#9735)
- Add __deepcopy__ and __copy__ to OpenApiModel
- pass discriminator inside deepcopy if exists
- add test cases for deepcopy of models
2021-09-09 09:16:59 -07:00
William Cheng
477e2365c7
improve git_push.sh (#10356) 2021-09-09 12:49:03 +08:00
Thomas Hervé
36ae0b9ffe
Handle nullable items in Go arrays (#10268)
If an item in a go array is nullable, we want to represent it as a pointer,
otherwise it will be deserialized with a default value and it will be
impossible to differentiate it from null.
2021-09-09 11:53:23 +08:00
Justin Black
b258bba5dd
Revert "Updated template so that generated code now renders docstrings and function parameters nicely in IDE. (#10331)" (#10338)
This reverts commit ae88cf14dae6404beeb7efb8ba881ea86c12f37c.
2021-09-06 20:20:04 -07:00
bflaton
ae88cf14da
Updated template so that generated code now renders docstrings and function parameters nicely in IDE. (#10331)
Endpoints are still accessible in generated code, mainly to satisfy some test cases.
2021-09-06 15:01:33 -07:00
William Cheng
d8d5709b8b update samples 2021-09-03 20:36:36 +08:00
Jimi Steidl
1da6c223e6
Fix condition bug in dart-dio-next OauthInterceptor (#10317) 2021-09-03 20:27:58 +08:00
Peter Leibiger
a558554961
Add OAS3 allowEmptyValue for query params (#10312)
* add the special case of empty query parameters to the fake API
2021-09-03 16:32:51 +08:00
Artem
d68d65ce00
Fix java examples (#10257)
* TAP-655 fix examples java

* update samples
2021-09-02 11:08:35 +08:00
Oleh Kurpiak
c148539ce3
[Java][Spring] fix imports for nullable helpers (#10234) 2021-09-02 11:01:12 +08:00
William Cheng
0357b80f19 Merge remote-tracking branch 'origin/master' into 6.0.x 2021-09-01 14:16:17 +08:00
Esteban Gehring
7c4d2b87f6
[typescript] fix compilation error for file upload (#10288) 2021-08-31 18:33:09 +08:00
Nathan Baulch
5d68bd6a03
Fix thousands of spelling typos (#10272) 2021-08-28 22:58:24 +08:00
William Cheng
808e6af94d update go petstore samples 2021-08-27 13:37:05 +08:00
Nathan Baulch
9c66d33171
[go] Support for response status code ranges (#10075) 2021-08-25 11:15:23 +08:00
Aanisha Mishra
67fbb1081e
Skip setting readOnly properties with default values in model constructors (#10196)
* skipReadonlyPropertiesInInt flag to go SDK

* minor amendments

* update docs for go
2021-08-25 10:21:02 +08:00
Vikrant Balyan
f2e994271f
[Python] fixes __setitem__ throwing an error for composed instance (#10197)
* adding a test for issues 10083

* commiting the generated files

* fix for the setattr issue

* commit generated files

Co-authored-by: Aanisha Mishra <aanisha.mishra05@gmail.com>
2021-08-22 10:44:19 -07:00
Esteban Gehring
65e9e92282
enable typescript unit tests (#10211)
* enable typescript unit tests

* disable failing isomorphic fetch tests
2021-08-21 10:04:47 +02:00
Kuzma
3fd5e4111f
[Typescript] Add application/x-www-form-urlencoded content support (#9960)
* Add application/x-www-form-urlencoded content support

* cs fix

* cs fix

* add samples

* fix double content type

* fix samples

* fix util.canConsumeForm

* revert unrelated ghanges

* regenerate samples

* change includes to indexof

* regenerate samples

* regenerate samples
2021-08-20 16:07:43 +02:00
Vikrant Balyan
245aec14eb
[python] Fixes a breakage while deserializing the read-only attributes (#10155)
* fixes a breakage while deserializing the read-only attributes

* updating generated samples

* taking care of the PR comments

* updating samples

* protect against cases where _spec_property_naming may not be present

* updating samples

* adding tests for this issue

* other generated files

* taking care of the comments

* updating the generated samples

Co-authored-by: Aanisha Mishra <aanisha.mishra05@gmail.com>
2021-08-18 12:01:58 -07:00
Ahmed Fwela
63562dc2c3
[dart-dio-next] Improve handling nullable objects (#10118)
* handle nullable objects

* reverted java code

* Rewrote type generation to be recursive

* checking for isRequired only makes sense in the model class

* remove comments

* remove whitespaces

* regen samples

* use const once https://dart.dev/guides/language/effective-dart/usage#dont-use-const-redundantly

* remove const from mustache

* added space between comma and type

* fixed formatting

* remove commas

* regen samples

* bad whitespaces
2021-08-18 18:28:06 +08:00
guy-har
50acdcb4a3
Fix python generated markdown documentation for Jekyll (#10111)
* Fix python generated markdown documentation

* Generated `build the project` and upate sample scripts
2021-08-18 16:25:30 +08:00
William Cheng
0204bf4ae2 Squashed commit of the following:
commit c5a0d0f7394aa742fa336fff7e7c1d3049761868
Merge: 8c4991ba3ed f8ff8c87609
Author: William Cheng <wing328hk@gmail.com>
Date:   Tue Aug 17 18:28:12 2021 +0800

    Merge branch 'mustache-linting' of https://github.com/NathanBaulch/openapi-generator into NathanBaulch-mustache-linting

commit f8ff8c87609b1ca36fa26fb8474806999638195e
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Thu Aug 5 14:12:47 2021 +1000

    Reorder tags that handle missing values

commit f5d8a33709d6a3f846a9fe4520b78c3d637051d9
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Thu Aug 5 14:08:59 2021 +1000

    Use dot notation where possible

commit 493d14921e2333f3ae19ef6fc89318b7e263a80c
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Thu Aug 5 14:10:49 2021 +1000

    Remove empty tags

commit 32480dc53f48227d55531b94e307d72671373737
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Thu Aug 5 10:41:58 2021 +1000

    Remove redundant sections

commit a8edabd722c34aa094b4aeb11c22664529c3a219
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Wed Aug 4 22:02:22 2021 +1000

    Trim extra EOF new lines

commit e89bd7458e3594bf0d30e580bc9408e45b018a57
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Wed Aug 4 21:59:26 2021 +1000

    Trim trailing whitespace
2021-08-17 18:37:51 +08:00
agilob
7edddb6531
Add map property in url params (#10154)
* Add map property in request params

* Regenerate samples to include map in url property
2021-08-17 18:31:53 +08:00
William Cheng
eaa76f8e1f Merge remote-tracking branch 'origin/master' into 6.0.x 2021-08-17 18:10:59 +08:00
William Cheng
764a462711 Merge remote-tracking branch 'origin/5.3.x' 2021-08-16 21:38:34 +08:00
William Cheng
8403e59aa0
Prepare 5.2.1 release (#10161)
* prepare for 5.2.1 release

* update samples
2021-08-16 19:08:29 +08:00
Peter Leibiger
5fe76c2453
[dart][dio] Nullable parameters & defaults for header/query parameters (#10147)
* respect the nullable flag for all parameters (except path params where this is not allowed)
* generate default values for header and query parameters that are not collections
* we can not handle default values for collection with built_value atm. (not const)
* we can not handle default values for form/body parameters atm. as those can be enums which we can not construct easily
2021-08-15 13:49:32 +08:00
Peter Leibiger
c72e69f28a
[dart][dio] Update built_value to =>8.1.0 (#10122) 2021-08-13 12:57:30 +08:00
Tino Fuhrmann
ccccb6aa67 Add missing samples for #9857 2021-08-07 23:48:41 +02:00
NouemanKHAL
74e28a7709
[typescript] FIX: Generate documentation and examples #9413 (#9857)
* generate docs for typescript

* commit changed files

* Fix NullPointerException on ComposedSchema

* Fix merge issues
2021-08-07 23:27:13 +02:00
Justin Black
cb71ae95a6
Feat adds has discriminator with non empty mapping (#9667)
* Adds hasDiscriminatorWithNonEmptyMapping getter and setter

* Removes venv

* Adds hasDiscriminatorWithNonEmptyMapping to CodegenModel

* Removes python-experimental folder

* Adds hasDiscriminatorWithNonEmptyMapping to CodegenProperty

* Adds hasDiscriminatorWithNonEmptyMapping to CodegenParameter

* Adds hasDiscriminatorWithNonEmptyMapping to CodegenResponse

* Sets hasDiscriminatorWithNonEmptyMapping in codegenModels

* Samples updated

* Adds getHasDiscriminatorWithNonEmptyMappin checks in existing discriminator tests
2021-08-07 07:52:10 -07:00
Ahmed Fwela
dbd80fbf8a
[dart-dio-next] improve encodeCollectionQueryParameter to handle cases where collectionFormat is null (#10105)
* improve encodeCollectionQueryParameter to handle cases where collectionFormat is null

* updated samples
2021-08-07 21:53:36 +08:00
Yorick Holkamp
189b44b191
[dart2] Include request body on DELETE call (#10100)
* Include request body on DELETE call

This change updates the generated `ApiClient` to include the request body on DELETE calls. [Per the RFC on page 2][1], DELETE calls are allowed to have a request body, even though the behavior may be undefined. I've not come across many APIs that use this behavior but there are a few, in particular the [Ory Kratos API][2] does so, not forwarding the body prevents such an API from being used. An API spec that does not define a request body should continue to function as expected.

[1] https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.5
[2] https://www.ory.sh/kratos/docs/reference/api/#operation/submitSelfServiceLogoutFlowWithoutBrowser

* Samples generated with dart2 template change
2021-08-07 21:11:03 +08:00
Peter Leibiger
75181210d5
Add tests for enum query encoding (#10054) 2021-08-05 18:16:59 +08:00
Nathan Baulch
dc23267580
[csharp] Obsolete attribute on deprecated operations and properties (#10084) 2021-08-04 17:28:45 +08:00