69 Commits

Author SHA1 Message Date
William Cheng
48ef91acc4
[python] Add test for nullable property with pattern (#15625)
* add test for nullable property with pattern

* update samples
2023-05-24 15:13:53 +08:00
William Cheng
01ed5975e1
rename python-nextgen to python (#15504) 2023-05-16 13:54:07 +08:00
William Cheng
780d266fe1
Decommission python client generator (#15486)
* decomission python client generator

* udpate

* update doc
2023-05-14 16:33:13 +08:00
Tiffany Marrel
c251202869
[Python] cleanup documentation (#15301)
* [Python] fix documentation of API authorization in README files

fix hierarchy level + add internal links + align wording across generators

* [Python] fix anchor links in documentation
2023-05-09 16:24:56 +00:00
Beppe Catanese
68b944e6e6
Preserve order of securitySchemes (#14536)
* Remove alphabetical sort

* Update integration testing expectations

* Regenerate files
2023-02-10 22:20:19 +08:00
Justin Black
45b1f91807
[python] Fixes Response TypeError (#14299)
* Fix and sample regen

* Response with only header added, sample regnerated
2022-12-20 12:42:10 -08:00
Justin Black
28ae689615
[python] Fixes Configuration w/ access_token at initialization (#14153)
* Fixes templates

* Samples regenerated

* Adds discard_unknown_keys back in, regenerates samples
2022-11-30 11:09:31 -08:00
Justin Black
871eda2731
[python] exposes deserialized bodies for non-2XX responses (#14095)
* Template update and sample update

* Samples regenerated

* Adds verification test

* Template update

* Samples regen, fixes exception instantiation
2022-11-22 09:35:26 -08:00
Mustansir Soni
4667b7e471
[#13954] Allows args and arg as schema properties in python client (#13955)
* Add args to reserved words

* arg and args to _arg and _args in templates

* Corrections

* Test added

* Corrections

* Use arg and args as defined properties

* Removed unnecessary assertion

* Suggested change
2022-11-09 11:10:29 -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
Justin Black
ac3bb6830a
[python] Fixes endpoint overload type hint + required property not in properties (#13790)
* Adds endpoint overload type hint fix to template

* Samples regenerated

* Adds fix for required property not in properties

* Regenerates samples
2022-10-21 18:50:30 -07:00
Justin Black
ef8e55ca21
[python] client bug fixes + type hint improvements (#13665)
* Adds python client, template, and spec updates for query param content type json

* Samples regenerated

* Finishes adding test cases for query param json content type

* Uses newest templates

* Templates replaced, spec replaces, sample replaced

* Samples updated
2022-10-10 20:13:31 -07:00
Justin Black
57f5cc4000
[python] fixes bugs (#13581)
* Adds bug fixes

* Samples and docs regenerated

* Samples regenerated
2022-10-03 11:15:16 -07:00
Justin Black
7e73645303
Switches python-experimental in as the primary python client (#13501)
* Changes python to python-prior

* python -> python-prior, python-experimental->python

* Renames sample spec directories

* Samples regnerated

* Regenerates docs

* Fixes test

* Samples regenerated

* Updates renerators list

* Fixes made to python paths in pom.xml

* Fixes node4 sh file paths
2022-09-24 16:19:38 +08:00
antssilva96
7e5ee2142c
Fixed regular expression in python client codegen that was removing any trailing chars instead of only expected ones (#13164)
* Fixed regular expression in python client codegen

The previous regular expression was too loose, including any last character in the second group. This commit fixes that, making sure we only remove leading forward slashes, trailing forward slashes or trailing `\i`.

This commit closes 13069.

* Added generated files

* Edit comment

* Add test cases

Co-authored-by: antonio.silva <antonio.silva@feedzai.com>
2022-08-16 09:06:53 -07:00
Akhil Nair
e823290c8f
[PYTHON] GetItem not working for Client generated allOf model and broken since 5.2.0 (#12239)
* I feel the issue is due to the creation of self._var_name_to_model_instances while doing the deserialization of the data.

Earlier the Python SDK code was using get_var_name_to_model_instances function which was adding var name to model instances that contain it. So <class 'openapi_client.model.stream_options_all_of'> will not part of mapping in self._var_name_to_model_instances for variable name stream_options.

Now with the latest Python SDK code following is the way through which var_name_to_model_instances is created:

    for prop_name in model_args:
        if prop_name not in discarded_args:
            var_name_to_model_instances[prop_name] = [self] + composed_instances
Now as we can see that the var_name_to_model_instances is populated with self and composed_instance which will also contain stream_options_all_of as a composed instance and there will be no check that if stream_options is present in composed_instances or not.

As there is no attribute_mapping found for stream_options in stream_options_all_of, the type for stream_options will be treated as dict for mapping stream_options_all_of as mentioned by @Chekov2k.

So what I suggest is the following code:

    for prop_name in model_args:
        if prop_name not in discarded_args:
           var_name_to_model_instances[prop_name] = [self] + list(
                filter(
                    lambda x: prop_name in x.openapi_types, composed_instances))
This way we can check if the property name is present in that composed instance or not. If it's okay for @spacether I can raise a PR for this.

* [get_item_all_of_bug]
Added samples, test cases to validate all_of schema.

* [getiem_all_of_bug]

Updated docs and samples.

* [getiem_all_of_bug]

Updated test cases, docs and samples.
2022-05-27 21:09:48 -07:00
William Cheng
12cdacabbf
[Inline model resolver] better handling of inline responses and bug fixes (#12353)
* better handling of inline response schemas, bug fixes

* update samples

* add new files

* better code format

* remove unused ruby files

* fix java test

* remove unused js spec files

* remove inline_response_default_test.dart

* fix webclient tests

* fix spring tests
2022-05-13 10:17:59 +08:00
William Cheng
ad3b5f7045
[Inline model resolver] various improvements (#12293)
* better handling of requestbody in the inline resolver

* remove commented code

* better request body naming

* fix unique naming

* minor code format change

* removed additional underscore from names, fix test

* more fixes, update tests

* fix all tests

* undo changes to default codegen

* update samples

* update python tests

* add new files

* update samples
2022-05-10 17:13:57 +08:00
Daniel Qian
41451ff5ee
fix #11958 [BUG] python generates wrong model name and model file name (#11959)
* fix #11958 [BUG] python generates wrong model name and model file name

Modify AbstractPythonCodegen.toModelName just like AbstractJavaCodegen.toModelName

* add unit test

* update samples and docs
by
./bin/generate-samples.sh
./bin/utils/export_docs_generators.sh

* fix AbstractPythonCodegen#toModelName logic, remove underscore

* update samples and docs
by
./bin/generate-samples.sh
./bin/utils/export_docs_generators.sh
2022-04-01 19:43:08 -07:00
William Cheng
df05e6f4bc
Update parser to 2.0.29 (#11388)
* update parser to 2.0.29

* better handling of null in dereferencing

* update parser to 2.0.30

* update core to newer version

* add new files

* rollback to previous stable version

* remove files

* Fixes for python-experimental NullableShape component

Co-authored-by: Justin Black <justin.a.black@gmail.com>
2022-02-21 18:37:52 +08:00
jiangyuan
dce8b80af7
[Python] fix api file name & api var name (#11051)
* fix api filename

* fix PythonCodeGen toApiVarName

* add samples change
2022-02-14 11:27:13 +08:00
jiangyuan
8b3cad0692
[Python] fix model to dict (#11234)
* fix model to dict

* add unit test

* add unit test

* update sample files
2022-01-25 09:50:59 -08:00
Justin Black
7559b53370
Feat adds python AnyOf send and receive example (#10754)
* Samples regenerated

* Adds AnyOf tx/rx example to python

* Updates samples
2021-11-01 12:15:45 -07:00
Justin Black
638a2faa3d
Updated model generation, addProps handling moved into type object and anyType handling (#10505)
* Updates fromModel helpers

* Samples regenerated

* updateModelForComposedSchema made protected so it can be overridden
2021-10-01 13:09:32 -07: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
Nathan Baulch
5d68bd6a03
Fix thousands of spelling typos (#10272) 2021-08-28 22:58:24 +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
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
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
Justin Black
11515da053
Python client - fixes boolean enum use case (#9926)
* Adds boolean enum component and object property and tests of it

* Regenerates samples

* Passes needed locale argument to toUpperCase

* Regenerates samples
2021-07-09 18:55:22 -07:00
Justin Black
fb3aed6dc4
Fixes python test_fake_api tests (#9483)
* Fixes test_upload_download_file

* Fixes test_string

* Fixes test_string_enum

* Fixes test_number_with_validations test_composed_one_of_number_with_validations

* Fixes two more tests

* Fixes test_array_of_enums

* Fixes two tests

* Removes comment

* Fixes serializationf of composed schema object models, fixes test

* Samples regenerated

* Removes pdb
2021-05-17 20:15:53 -07:00
gbmarc1
c966b5fe1f
[python] readonly constructors (#9409)
* readonly

* other tests

* doc

* python samples

* model utils
2021-05-10 18:41:26 -07:00
William Cheng
73564bc046 update samples 2021-04-28 17:57:26 +08:00
William Cheng
37eaf70755 Merge remote-tracking branch 'origin/master' into 5.2.x 2021-04-28 17:48:21 +08:00
Thomas Hervé
60dcf8613f
Don't include read-only properties in Python examples. (#9252)
* Don't include read-only properties in Python examples.

When using a schema with read-only fields as API inputs, Python
generates examples for those: this excludes them.

* Fix tests
2021-04-14 11:43:28 -07:00
gbmarc1
8e0955fd3c
Bug - python client deserialization when attribute named self (#9006)
* fix by mapping outside of class

* tests

* regeneration and tests

* server

* INDENT

* a

* enable mapping

* Revert "server"

This reverts commit 6fc9712fb550d258d0332df243ea5080565c6770.

* Samples regenerated

Co-authored-by: Justin Black <justin.a.black@gmail.com>
2021-04-10 19:00:32 -07:00
Justin Black
fc58adee31
Fixes serialization of array items in model_to_dict [python] (#9153)
* Adds tests of endpoint with inline and refed model

* Regen samples

* Samples regenerated
2021-04-01 13:34:19 -07:00
William Cheng
917b358e27 Merge remote-tracking branch 'origin/master' into 5.2.x 2021-04-01 09:25:19 +08:00
Justin Black
6cc270633b
[python] Fixes additional_properties_type for models (#8802)
* Fixes additionalProperties values for models, updates docs, adds tag test of it, fixes frit and gmfruit tests

* Moves this.setDisallowAdditionalPropertiesIfNotPresent higher

* Makes setting additional_properties_model_instances contingent on the presence of addprosp in schema, updates sample spec composed schemas to remove addprops False form two

* Fixes oneOf anyOf allOf instantiation logic

* Removes Address from Cat definition

* Adds required vars for apple and banana, removes required vars from composed schema init sig

* Updates composed schema vars to be set on self and all composed instances

* Removes get_unused_args, get_var_name_to_model_instances, and get_additional_properties_model_instances

* Fixes fruit + deserilization tests, creates ComposedSchemaWithPropsAndNoAddProps

* Fixes FruitReq tests

* Fixes GmFruit tests

* Fixes discard_unknown_keys tests

* Samples updated

* Removes additionalproperties False in Child

* Samples updated

* Improves handling of v2 and v3 specs for isFreeFormObject, v2 sample spec updated with link to bug

* Adds cli option disallowAdditionalPropertiesIfNotPresent to python

* Adds getAdditionalProperties method so the value for addProps will be correct

* Reverts file

* Reverts file

* Updates python doc

* Reverted anytype_3 definition

* Updates test_deserialize_lizard

* Updates test_deserialize_dict_str_dog

* Updates testDog

* Updates testChild

* Adds v2 python_composition sample

* Adds needed files for python testing

* Adds existing tests into the new python sample

* Fixes test_dog

* Removes addProps false form Dog

* Fixes testChild

* Updates how additionalProperties are set

* Fixes empty_map type

* Type generation fixed for v2 and v3 specs

* Refactors getTypeString, updates artifactids in pom.xml files

* Adds new python sample to CI testing I think

* Fixes artifactId collision, regenrates docs
2021-03-31 08:48:12 -07:00
Justin Black
ae099330b9
Feature fixed, samples regenerated (#9131) 2021-03-29 23:42:14 -07: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
Justin Black
2553d056dc
Removes nulltype from python, updates samples (#8555)
* Removes nulltype from python, updates samples

* Removes nulltype from the python requirements

* Removes nulltype import in models, moves requiredVars to optionalVars when approprieate
2021-01-28 09:30:36 -08:00
Justin Black
c4dbd2cfa3
[python] Fixes file upload + download, adds tests (#8437)
* Adds tests for file upload and files upload

* Adds test_download_attachment

* Fixes test_upload_file

* Adds download_attachment endpoint

* Adds test_download_attachment

* Updates assert_request_called_with signature

* Samples regen

* Adds upload download file spec route and sample gen

* Fixes file upload for application/octet-stream, writes test_upload_download_file

* Changes if into elif

* Improves python code in api_client
2021-01-15 13:27:33 -08:00
Justin Black
ce893a84ff
Fixes object serialization when there is an inline array property which contains a refed enum (#8387)
* Fixes object inline enum defintion with refed enum item

* Adds refed array model example w/ serialization + deserialization
2021-01-08 13:15:55 -08:00
Thomas Hervé
634c4c09e4
Fix generation of map model examples (#8063)
When generation examples of objects with additional properties, we use
the map syntax inside a model instantiation, which is incorrect. This
fixes it by checking for model at the right place.
2020-12-01 19:04:23 -08:00
Thomas Hervé
3f75691da2
Fix list examples in Python (for real) (#8034)
The patch in #7967 forgot the prefix, this fixes it, and change the
sampels so that we can see the effect this time.
2020-11-26 14:28:27 -08:00
William Cheng
3bf8ca7484
[python] Renames python generators (#7965)
* python->python-legacy, python-experimental->python

* test with openjdk8

* test with openjdk11

* comment out rm

* move kotlin tests to circleci

* move kotlin tests

* move tests to circleci

* fix circleci

* rearrange test

* move tests

* use wrapper

Co-authored-by: Justin Black <justin.a.black@gmail.com>
2020-11-18 14:34:00 +08:00
William Cheng
9377dbca56
Add "decimal" support (#7808)
* rename BigDecimal to decimal

* add isDecimal

* fix tests

* minor fixes

* fix mapping, update doc

* update test spec

* update c# samples
2020-11-02 21:31:32 +08:00
Nicholas Muesch
32c591d9a7
Support multiple api keys in python example documentation (#7417)
* Support multiple api keys in config option

* Regenerate samples

* Update rest of examples
2020-09-15 13:40:48 -07:00
William Cheng
588023686a
Add HTTP signature authentication support to Java (jersey2-experimental) (#6058)
* add fmt-maven-plugin to jersey2 exp

* update samples

* add http signature auth template

* minor fix

* fix http beaer auth, update sample

* fix http signature auth

* fix http signature auth

* header support

* add query string to path

* undo changes in default codegen

* ignore fake test

* add serialize to string method

* add serialzie to string method

* add get mapper

* auto format java source code

* remove plugin

* update pom.xml

* change back AbstractOpenApiSchema to T

* skip mvn code formatter in bin script

* undo changes to spec

* update samples

* add back HttpSignatureAuth.java
2020-04-28 00:09:30 +08:00