Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

v3 adds mypy #187

Merged
merged 110 commits into from
Jul 19, 2023
Merged

v3 adds mypy #187

merged 110 commits into from
Jul 19, 2023

Conversation

spacether
Copy link
Contributor

@spacether spacether commented Jul 10, 2023

v3 adds mypy

  • added method get_additional_property_
  • getitem methods removed
    • getitem overloads do not work for additionalproperties in mypy because getitem property inputs are string
      literals which also match the additionalproperty str input, which causes a type error
  • property methods added back in if the identifier is valid, they return unset if the key is not set
  • adds py.typed
  • runs mypy in CI on node4 for the petstore sample

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/python*.
    For Windows users, please run the script in Git BASH.

spacether added 30 commits July 10, 2023 12:39
@spacether spacether merged commit 038d5f8 into 3_0_0 Jul 19, 2023
@spacether spacether deleted the v3_adds_mypy branch July 19, 2023 03:50
spacether added a commit that referenced this pull request Aug 16, 2023
* Adds lib for types

* Fixes type errors in format.py

* Adds query_params_suffix to fix type error

* Fixes unset type

* Fixes type errors in schema_configuration

* Adds needed type info in validation.py

* Fixes more type errors in validation.py

* Adds U+T binding to fix type errors

* Improves return type of _get_new_instance_without_conversion

* Changes some typing.Type to type

* Adds validate_base_ in Schema

* Uses Schema.validate_base in api_client

* Removes clashing validate overloads from schemas classes

* Adds more missing types in schema.py

* Adds needed type hint

* Fixes some api_client types

* Fixes type error in update_params_for_auth

* Fixes type errors with vars write_file and new_file

* FIxes type error with serialize methods for header classes

* Fixes type error with None detection

* Type error another none fix

* Fixes type error by using literal for key_prefix in get_security_requirement_object

* Fixes 2 type errors by using literals in get_server_url

* Adds another validate_base signature to fix type errors in dictschema validate invocations

* Improves type hints for DictSchema

* Fixes type error with tuple detection

* Fixes broken python tests by having composed dict schemas use the Schema base class

* Eliminates incompatible sequence overloads

* Fixes 1 type error

* Fixes another type error

* Fixes tuple type error

* Fixes type error for path_to_schemas

* Updates path_to_schemas to store one schema

* Adds _instances type

* Fixes more type errors

* Fixes another type error

* Removes unneeded overload

* Detects and handles addProps=False and only one property

* Removes one sequence usage in template

* Removes another sequence usage

* Relaces last sequence in templates

* Fixes type errors by fixing get_security_requirement_object literal input

* Adds exception raising for statuses in operation handling code, reduces type errors

* Fixes assertion error, adds storage of error status codes for operation

* Adds error status codes to python

* Fixes operation return type

* Fixes get_server_url invocation, adds literals

* Renames all ApiResponse classes to ApiResponse, uses them in operation response

* Fixes type of headers_schema

* Removes dataclass from OpenApiResponse

* Removes unneeded dataclasses from OpenApiResponse and classes it uses

* Fixes skip_deserialization overload

* Prevents parameter collisions

* Adds array output class tuple generic type

* Removes typeddict from responses

* Adds missing elipses for tuple output type

* Adds validate_base sequence back in

* Removes getitem from list schemas

* Removes typeddict from header classes

* Changes order to int float

* Do not generate validate with number schema + enum

* Controls when composed schema validate methods are written, fixes type errors

* Adds type(None) to types definition, fixes type errors

* Turns off getitem, adds optional props

* Writes property methods

* Changes additional_properties to get_additional_property

* Adds get_property method implementation

* Changes template mode to get_property

* Changes property to overloads

* Has overloads use elipses

* Handles the case where there is one required or optional property

* Adds get_additional_property casting

* Only cast individual property outputs

* Ignores pyright reportWildcardImportFromLibrary

* Fixes array self ref type hint

* Makes T param bound to sequences, fixes type errors

* Adds required and optional keys

* Adds unset return for optional property values when there is only one property

* Changes name variable to key

* Removes unused templates

* Adds required property returns in get_property

* Fixes get_property implementation

* Improves get_property implementation

* Changes method name to get_additional_property_

* Adds @Property back

* Convers ref properties back into getters

* Converts get_property back into get_x methods

* Fixes python tests

* Adds unset returning in get_additional_property_

* Adds unset output for many cases

* Adds unset types on all except for array and object models

* Adds array unset return value

* Adds unset types for optional map

* Writes properties with unmodifed names, only writes them if they are valid

* Fixes python tests

* Adds mypy to petstore test

* Fixes type error

* FIxes last mypy errors

* Adds py.typed, improves server imports

* Adds __all__ definitions

* Fixes unset type setting on optional returns

* Fixes additiona prperties return type

* Adds unset case for binary output

* Fixes validate return types

* Adds mapValueSchema

* Refines types of SchemaDict values, supresses mypy response body type error

* Adds get_response method in OpenApiResponse classes

* Fixes java test

* Samples regenerated

* Fixes unit test sample, samples regenerated
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REQ] Run static checker on generated python code
1 participant