Created by: spacether
This PR makes improvements that can enable method Schema._validate caching in the future if one wants to implement it. One would need to:
- have path_to_item use a generator for the last piece of the path_to_item so duplicate items in the array will have the same hash on their path_to_item
- have Schema._validate return a dict where the key is empty tuple as path_to_item, and then after that result is returned, append the current path fragment onto all keys in path_to_schemas
- perhaps pass in a _hash_key=type(arg) argument in the validate method because hash(True) == hash(1) in python
Updates in this PR:
- InstantiationMetadata changed to ValidationMetadata and only used in validation
- ValidationMetadata changed to inherit from frozendict, making it immutable
- InstantiationMetadata no longer passed into
__new__
and_from_openapi_data
, insetad _configuration is passed in - *args becomes arg where possible
-
__new__
and_from_openapi_data
signatures kept the same (_configuration passed in) though _from_openapi_data could be rewritten to pass in a parameter named configuration because dicts will always be passed into it as arg. But for__new__
, dicts may be passed in as keyword arguments.
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
./bin/generate-samples.sh bin/configs/java*
. For Windows users, please run the script in Git BASH. -
File the PR against the correct branch: master
(5.3.0),6.0.x
-
If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.