Skip to content

Commit fa9fd56

Browse files
github-actions[bot]quentin-quix
and
quentin-quix
authored
Update documentation (#436)
Co-authored-by: quentin-quix <171557156+quentin-quix@users.noreply.github.com>
1 parent 839af4a commit fa9fd56

File tree

1 file changed

+105
-6
lines changed

1 file changed

+105
-6
lines changed

docs/api-reference/quixstreams.md

Lines changed: 105 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,6 +2975,93 @@ Use it to not depend on exact implementation and simplify testing.
29752975
Instances of `confluent_kafka.Message` cannot be directly created from Python,
29762976
see https://github.com/confluentinc/confluent-kafka-python/issues/1535.
29772977

2978+
<a id="quixstreams.models.serializers.avro"></a>
2979+
2980+
## quixstreams.models.serializers.avro
2981+
2982+
<a id="quixstreams.models.serializers.avro.AvroSerializer"></a>
2983+
2984+
### AvroSerializer
2985+
2986+
```python
2987+
class AvroSerializer(Serializer)
2988+
```
2989+
2990+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/models/serializers/avro.py#L14)
2991+
2992+
<a id="quixstreams.models.serializers.avro.AvroSerializer.__init__"></a>
2993+
2994+
#### AvroSerializer.\_\_init\_\_
2995+
2996+
```python
2997+
def __init__(schema: Schema,
2998+
strict: bool = False,
2999+
strict_allow_default: bool = False,
3000+
disable_tuple_notation: bool = False)
3001+
```
3002+
3003+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/models/serializers/avro.py#L15)
3004+
3005+
Serializer that returns data in Avro format.
3006+
3007+
For more information see fastavro [schemaless_writer](https://fastavro.readthedocs.io/en/latest/writer.html#fastavro._write_py.schemaless_writer) method.
3008+
3009+
**Arguments**:
3010+
3011+
- `schema`: The avro schema.
3012+
- `strict`: If set to True, an error will be raised if records do not contain exactly the same fields that the schema states.
3013+
Default - `False`
3014+
- `strict_allow_default`: If set to True, an error will be raised if records do not contain exactly the same fields that the schema states unless it is a missing field that has a default value in the schema.
3015+
Default - `False`
3016+
- `disable_tuple_notation`: If set to True, tuples will not be treated as a special case. Therefore, using a tuple to indicate the type of a record will not work.
3017+
Default - `False`
3018+
3019+
<a id="quixstreams.models.serializers.avro.AvroDeserializer"></a>
3020+
3021+
### AvroDeserializer
3022+
3023+
```python
3024+
class AvroDeserializer(Deserializer)
3025+
```
3026+
3027+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/models/serializers/avro.py#L59)
3028+
3029+
<a id="quixstreams.models.serializers.avro.AvroDeserializer.__init__"></a>
3030+
3031+
#### AvroDeserializer.\_\_init\_\_
3032+
3033+
```python
3034+
def __init__(schema: Schema,
3035+
reader_schema: Optional[Schema] = None,
3036+
return_record_name: bool = False,
3037+
return_record_name_override: bool = False,
3038+
return_named_type: bool = False,
3039+
return_named_type_override: bool = False,
3040+
handle_unicode_errors: str = "strict")
3041+
```
3042+
3043+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/models/serializers/avro.py#L60)
3044+
3045+
Deserializer that parses data from Avro.
3046+
3047+
For more information see fastavro [schemaless_reader](https://fastavro.readthedocs.io/en/latest/reader.html#fastavro._read_py.schemaless_reader) method.
3048+
3049+
**Arguments**:
3050+
3051+
- `schema`: The Avro schema.
3052+
- `reader_schema`: If the schema has changed since being written then the new schema can be given to allow for schema migration.
3053+
Default - `None`
3054+
- `return_record_name`: If true, when reading a union of records, the result will be a tuple where the first value is the name of the record and the second value is the record itself.
3055+
Default - `False`
3056+
- `return_record_name_override`: If true, this will modify the behavior of return_record_name so that the record name is only returned for unions where there is more than one record. For unions that only have one record, this option will make it so that the record is returned by itself, not a tuple with the name.
3057+
Default - `False`
3058+
- `return_named_type`: If true, when reading a union of named types, the result will be a tuple where the first value is the name of the type and the second value is the record itself NOTE: Using this option will ignore return_record_name and return_record_name_override.
3059+
Default - `False`
3060+
- `return_named_type_override`: If true, this will modify the behavior of return_named_type so that the named type is only returned for unions where there is more than one named type. For unions that only have one named type, this option will make it so that the named type is returned by itself, not a tuple with the name.
3061+
Default - `False`
3062+
- `handle_unicode_errors`: Should be set to a valid string that can be used in the errors argument of the string decode() function.
3063+
Default - `"strict"`
3064+
29783065
<a id="quixstreams.models.serializers"></a>
29793066

29803067
## quixstreams.models.serializers
@@ -3309,24 +3396,30 @@ Serializes floats to bytes
33093396
class JSONSerializer(Serializer)
33103397
```
33113398

3312-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/models/serializers/json.py#L13)
3399+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/models/serializers/json.py#L15)
33133400

33143401
<a id="quixstreams.models.serializers.json.JSONSerializer.__init__"></a>
33153402

33163403
#### JSONSerializer.\_\_init\_\_
33173404

33183405
```python
3319-
def __init__(dumps: Callable[[Any], Union[str, bytes]] = default_dumps)
3406+
def __init__(dumps: Callable[[Any], Union[str, bytes]] = default_dumps,
3407+
schema: Optional[Mapping] = None,
3408+
validator: Optional[Validator] = None)
33203409
```
33213410

3322-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/models/serializers/json.py#L14)
3411+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/models/serializers/json.py#L16)
33233412

33243413
Serializer that returns data in json format.
33253414

33263415
**Arguments**:
33273416

33283417
- `dumps`: a function to serialize objects to json.
33293418
Default - :py:func:`quixstreams.utils.json.dumps`
3419+
- `schema`: A schema used to validate the data using [`jsonschema.Draft202012Validator`](https://python-jsonschema.readthedocs.io/en/stable/api/jsonschema/validators/`jsonschema.validators.Draft202012Validator`).
3420+
Default - `None`
3421+
- `validator`: A jsonschema validator used to validate the data. Takes precedences over the schema.
3422+
Default - `None`
33303423

33313424
<a id="quixstreams.models.serializers.json.JSONDeserializer"></a>
33323425

@@ -3336,24 +3429,30 @@ Default - :py:func:`quixstreams.utils.json.dumps`
33363429
class JSONDeserializer(Deserializer)
33373430
```
33383431

3339-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/models/serializers/json.py#L35)
3432+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/models/serializers/json.py#L58)
33403433

33413434
<a id="quixstreams.models.serializers.json.JSONDeserializer.__init__"></a>
33423435

33433436
#### JSONDeserializer.\_\_init\_\_
33443437

33453438
```python
3346-
def __init__(loads: Callable[[Union[bytes, bytearray]], Any] = default_loads)
3439+
def __init__(loads: Callable[[Union[bytes, bytearray]], Any] = default_loads,
3440+
schema: Optional[Mapping] = None,
3441+
validator: Optional[Validator] = None)
33473442
```
33483443

3349-
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/models/serializers/json.py#L36)
3444+
[[VIEW SOURCE]](https://github.com/quixio/quix-streams/blob/main/quixstreams/models/serializers/json.py#L59)
33503445

33513446
Deserializer that parses data from JSON
33523447

33533448
**Arguments**:
33543449

33553450
- `loads`: function to parse json from bytes.
33563451
Default - :py:func:`quixstreams.utils.json.loads`.
3452+
- `schema`: A schema used to validate the data using [`jsonschema.Draft202012Validator`](https://python-jsonschema.readthedocs.io/en/stable/api/jsonschema/validators/`jsonschema.validators.Draft202012Validator`).
3453+
Default - `None`
3454+
- `validator`: A jsonschema validator used to validate the data. Takes precedences over the schema.
3455+
Default - `None`
33573456

33583457
<a id="quixstreams.models.serializers.base"></a>
33593458

0 commit comments

Comments
 (0)