Rewrite some old methods to increase the extensibility of the corresponding modules
- 1 Add a user-friendly doc ui
- 2 Plugin Panel
- 3 SSE support
- 4 WebSocket support
Feat Change List:
- Tag support label
- Tag support openapi include
- Pait g module add func
get_ctx
- Response model support generic pydantic model
- Optimise code related to field and param handler
- Support use pydantic model in pait response
- APIRoute
- [Field] Field/request_resource support PEP612
- [Pait] @pait support extra_openapi_model_list param
- [Pait] Add
sync-to-thread
param to solve sync route or func - [Pait] No longer restricting key parameters of routing (#40)
- [Plugin] unified plugin support pydantic.BaseModel return value
Fix:
- Body must not be None for method POST
- Fix pre-depend not support class depend
- fix starlette include aiofile pkg
Refactor:
- refactor app and move attr & exception module to adapter
- Pait param sign use Unpack TypedDict
- Change tip_exception_class param
Improve Open API related functions and refactor some APIs that affect performance
Note: This version will have syntax changes that are not backward compatible, and the library api status will change from alpha to beta
Function Changes List:
get_app_attribute
support werkzeug LocalProxy- 'sniffing' and 'framework_location' support customization
- [Field] Depend enhances support for class instances.
- [Field] Depend support parse depend.pait_handler method.
- [Field] Adds the parameter
not_authenticated_exc
, which allows developers to specify that the error value cannot be found. - [Field] Adds the parameter
openapi_include
, determines whether the field can be resolved to the Open API. - [Field] Add _check_init_param method
- [OpenAPI] Support OpenAPI Security.
- [Pait] Modify the generation of Pait id to ensure that the Pait id is always the same.
- [Pait] Imported ParamHandler migration from PaitCoreModel to Pait.
- [Pait] Improving the speed of dependencyinjection.
- [Pait] Pait core model support extra param.
- [Pait] Pait core model support listen change callback.
- [Plugin] Optimize the internal implementation of the plug-in mechanism to speed up the execution of the plug-in.
- [Plugin] Refactor the Mock plugin's API to reduce duplicate code.
- [Plugin] The Mock plugin adds a new parameter example_column_name to specify the value of the Field from which the mock data is to be retrieved.
- [Plugin] No longer distinguish between front or back plugins by is_core, but by different classes to facilitate Type Hint checking.
- [Plugin] Response Plugin add get_pait_response_model param
- [Pydantic] Support Pydantic V1 and V2
- [Pydantic] support pydantic json_schema_extra type maybe callable
- [Route] Support for adding simple routing to web frameworks (experimental).
- [TestHelper] Ddd diff response data output and modify test helper exc msg style
- [WebFramework] support sanic 23.3.0 and support flask 2.2.2 test client
Fix:
- [Plugin] Fix param plugin`check_field_type method not support pydantic.Field
- [Pait] Fix sub pait cannot over parent pait value
- [TestHelper] Fix test helper not support response data is {}.
- [Util] Fix
get_parameter_list_from_pydantic_basemodel
not auto set request key and cache bug - [Util] Fix
gen_example_dict_from_pydantic_base_model
acn not parse sub pydantic model - [Util] Fix 'value._evaluate' in python3.9
- [Util] Fix parse TypedDict error(py310)
- [Util] Fix Lazy property bug
Refactor:
- [gRPC Gateway] this feature has been migrated to grpc-gateway
API Changes:
@pait
: The tag parameter type no longer supports String, only supportTag
class. e.g:from pait.app.starlette import pait from pait.model.tag import Tag @pait(tag=Tag("Demo")) def demo() -> None: pass
pait.model.response
:pait.model.response.PaitBaseResponseModel
change name toBaseResponseModel
from pait.model.response import BaseResponseModel
- The
ResponseModel.header
parameter type no longer supports dict, only supportpydantic.BaseModel
. e.g:from pait.model.response import HtmlResponseModel from pydantic import BaseModel, Field class HtmlRespModel(HtmlResponseModel): class HeaderModel(BaseModel): x_example_type: str = Field(default="html", alias="X-Example-Type") header: BaseModel = HeaderModel description: str = "html response"
- All DocRoute and gRPC Gateway APIs of the module have undergone drastic changes, please refer to the document changes
Rewrite part of the implementation of gRPC Gateway, and transfer some functions to protobuf_to_pydantic
- Feature, Support for unregulated typing usage
- Fix, fix auto complete json bug
- Feature, gRPC Gateway route param support custom pait.field
- Feature, add rapidoc and rapipdf api doc html
- Fix, gRpc Gateway generates a schema of the same name
- Feature, support custom custom grpc route response model
- Feature, support custom Redoc and Swagger url
- Feature, cache response support cache exc
- Feature, GrpcGateWay add gen route method
- Feature, Change self logic
- Fix, fix pydantic.BaseModel schema required is True, when default factory is not None
- Fix, fix tornado cache response bug and add cache response test
- Fix, fix auto complete not support dict in list
- Test, merge app route unitest
- Test, add customer grpc gateway route example&test
- Test, Split out to improve the speed of test cases
- Style, add typed file
Add grpc gateway route, Automatically generate corresponding API requests based on Stub
- Fix, fix not support cbv route attribute
- Feature, support param_handle param
- Feature, add cache response
- Feature, PaitMd support i18n_lang param
- Refactor, merger plugin async and sync invoke
Add some auxiliary functions and optimize the parsing speed
-
Feature, config support apply function feature and add PaitCoreModel match logic
-
Feature, add_doc_route func support projrct_name
-
Feature, add AddDocRoute class
-
Feature, add auto load Pait&AddDocRoute class feature(magic feature)
-
Feature, add i18n context feature
-
Feature, add_doc_route support template var feature
-
Feature, plugin's clas_hook refactor pre_check_hook and pre_load_hook
-
Feature, add func md5, pait status color, extra func, create_factory func
-
Fix, fix starlette's load_app func not support Mount route
-
Optimize, optimize ParamHandler parsing speed[by plugin's pre_load_hook], include
asyncio call
,pydantic call
-
Optimize, optimize open json route response
-
Optimize, optimize pait exc tip
-
Style, util pkg design like python asyncio
- Future: check_json_resp_plugin check typedict
- Fix: netsed tipexception
- Refactor: refactor ParamPlugin check param after start
- Refactor: api_doc.base_parse._parse_base_model_to_field_dict
- Fix: fix example not support method and modify mock plugin is_pre_core=True
- Feature: plugin add build method
- Fix: api doc not support raw_return is False
- Fix: pydantic not check default value
NOTE: Skip 0.7.4.4 and 0.7.4.5
- Fix: gen BaseModel param
- Fix: OpenAPI _field_list_2_request_body not use _replace_pydantic_definitions method
- Fix: config.init_config i18n param not enable
- Feature: Support Enum Type in response
- Refactor: check_field_type core func is_type -> create_pydantic_model
Improve the interaction of md documents and increase the functionality of existing plug-ins
- Style: Change md doc style
- Feature: Md Support i18n and Request Param table support display example and other column
- Feature: Friendly exc design
- Feature: Check Field's default,example and default_factory value type when program start
- Refactor: Refactor mock response plugin
- Feature: Add auto complete json plugin
Core architecture modification, support for plug-in mechanism
- Feature: Support create sub pait
- Feature: Support tag model
- Feature: Core support plugin and change param_handle to plugin
- Feature: mock response plugin and response model add is_core flag
- Feature: check json response plugin
- Feature:
required
&at most one of
plugin - Fix: fix not support default_factory
Improve openapi support (except for the security part); Improve Response type; Improve TestHelper; Improve parsing speed
- Fix: fix openapi init check and fix can not found real field property in basemodel
- Fix: fix sanic load app bug
- Feature: Api Doc support schema param
- Feature: TestHelper add json method and limit auto select http method
- Feature: remove PaitBaseModel and support parse BaseModel pait.field
- Feature: openapi support all pait.field
- Feature: openapi schema support same model name(auto gen long name)
- Feature: add more response model and mock support mutil response model
- Feature: support openapi links
- Feature: Change param handler and improve parsing speed
- Refactor: TestHelper access_response
- Refactor: pait.app.base
- Refactor: pait func to pait obj
- Refactor: example and test
Emergency fix version
- Fix: fix ignore field.Depends parse in get_parameter_list_from_class
Simplify and optimize code logic and reduce code coupling. Support for closure scenarios and the addition of several parameters to @pait()
- Fix: Fix, Resolve the key mismatch between Field.alias and request value
- Fix: fix incompatibility with different fields having the same alias
- Feature: Refactor model.config and model.core, @pait() add param
enable_mock_response
- Feature: Laze property support auto use class
- Feature: Support closure cbv
- Feature: Support for user-defined Pydantic BaseModel Config (for pait dynamically produced Pydantic BaseModel based on function parameters)
- Feature: Api doc route support https and use @pait()
- Feature: Support Pre Depend
- Feature: Support mock value anc mock fn value by Field.example attr
- Feature: Support config json encoder
- Fix: fix pydantic schema not support default value is None
- Fix: fix gen_example_dict_from_schema gen enum value bug
- Fix: fix pydantic schema default desc is null and snaic openapi bug
- Refactor: refactor param_handler
- Fix: can not raise real exc;refactor raise_and_tip -> gen_tip_exc
- Feature: modify test client helper diff_response logic
- Feature: example json value support Python TypeHints:Any
- Feature: add param required check
- Feature: support DynamicModel config
- Feature: add global block http method
- Feature: add check response in test helper
- Refactor: core structure
- Feature: mock response
- Feature: test client helper
- Feature: global config support not call
setatter
in runtime - Feature: support set customer name
- Fix, fix md doc display other filed param
- Feature: openapi support RequestBody schema
- Remove: remove pait&json&yaml doc
- Fix: refactor circular reference
- Feature: add global config
- Fix: fix
param_handle
can not parse single field bug - Fix: support update json type default value
- Fix: fix python3.8 annotation
- Fix: single filed not pydantic filed info
- Fix: update requirements and resolve pydantic`s CVE-2021-29510
- Fix: sanic new version bug
- Fix: new version pait.app pait func bug
- Feature: support summary column
- Feature: doc module support project name
- Feature: support redoc ui route
- Feature: support swagger ui route
- Refactor: pait.api_doc & pait.app
- Test: add param handle test
- Test: add util test
- Feature: support postponed annotations
- Feature: load_app support return pait data
- Feature: add multi field and add lazyproperty
- Feature: support tornado, sanic
- Test: add pait param verify test
- Feature: BaseField add raw_return
- Feature: add create_pydantic_model func
- Feature: add BaseField inherit limit
- Refactor: refactor app helper
- Fix: fix param_handle bug
- Example: add example Response
- Style: add mypy check
- Feature: filed support mypy check
- Feature: support openapi allOf
- Refactor: New design&program architecture
- Feature: add interface info(life cycle, author, group, desc....)
- Feature: add auto load app
- Feature: add PaitBaseModel
- Feature: add markdown/json/yaml api doc
- Feature: api doc support openapi
- Feature: add raise error response
- Feature: support Dependencies
- Feature: support cbv error tip
- Future: support cbv class attribute
- Feature: add more field
- Feature: support cbv
- Feature: support flask type checking and parameter type conversion
- description: The first version
- Feature: support starletter type checking and parameter type conversion