* draft: first pass at complete schema language generation and factory validator * actually a working validator and fixes to the schema that went uncaught * remove extra spike file * fix formatting file * pr feedback and a little bit of refactoring * fix some types that were erroneously marked as invalid schema * some comments * add jsonschemamixin to interfaces * update changelog * bump version
27 lines
702 B
Python
27 lines
702 B
Python
#
|
|
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
|
|
#
|
|
|
|
from abc import abstractmethod
|
|
from dataclasses import dataclass
|
|
from typing import Any, List, Mapping, Union
|
|
|
|
import requests
|
|
from dataclasses_jsonschema import JsonSchemaMixin
|
|
|
|
|
|
@dataclass
|
|
class Decoder(JsonSchemaMixin):
|
|
"""
|
|
Decoder strategy to transform a requests.Response into a Mapping[str, Any]
|
|
"""
|
|
|
|
@abstractmethod
|
|
def decode(self, response: requests.Response) -> Union[Mapping[str, Any], List]:
|
|
"""
|
|
Decodes a requests.Response into a Mapping[str, Any] or an array
|
|
:param response: the response to decode
|
|
:return: Mapping or array describing the response
|
|
"""
|
|
pass
|