Closed
Description
Tell us about the problem you're trying to solve
There is a number of improvements that can be made to classes in airbyte_cdk/schema_helpers.py
.
First, JsonSchemaResolver
can be refactored to have the following signature:
def __init__(schemas: Mapping[str, any], refs: Mapping[str, any])
# schemas are all json files in `schemas/`, refs are all json files in `schemas/shared/`Then we can thoroughly test the resolving behavior in `JsonSchemaResolver` independently from the logic for where we actually load schemas from.
Then ResourceSchemaLoader
would be responsible just for finding the right files in the package directory and passing them into JsonSchemaResolver
. We can even change the signature for RSL to be:
class ResourceSchemaLoader:
def ___init__(package_name: str, json_schema_resolver: JsonSchemaResolver):
this would allow us to mock JsonSchemaResolver and instead just validate that given the right file structure, RSL is passing the correct files to JSR.
┆Issue is synchronized with this Asana task by Unito