jsoncompat 0.5.0

JSON Schema and OpenAPI Compatibility Checker
Documentation
# Generated implementation. Import the public model module instead.
from __future__ import annotations

import typing
from jsoncompat.codegen import dataclasses as dc

__all__ = ("bind_models",)

def _jsoncompat_init_0(self: dc.DataclassModel, *, skip_validation: bool = False, root: typing.Any) -> None:
    self.__post_init__(skip_validation)

def _jsoncompat_init_1(self: dc.DataclassModel, *, skip_validation: bool = False, age: typing.Any, name: typing.Any, __jsoncompat_extra__: typing.Any = dc.EXTRA_DEFAULT) -> None:
    self.__post_init__(skip_validation)

def _jsoncompat_init_2(self: dc.DataclassModel, *, skip_validation: bool = False, age: typing.Any, interests: typing.Any, name: typing.Any, __jsoncompat_extra__: typing.Any = dc.EXTRA_DEFAULT) -> None:
    self.__post_init__(skip_validation)

def _jsoncompat_init_3(self: dc.DataclassModel, *, skip_validation: bool = False, version: typing.Any, data: typing.Any) -> None:
    self.__post_init__(skip_validation)

def _jsoncompat_init_4(self: dc.DataclassModel, *, skip_validation: bool = False, version: typing.Any, data: typing.Any) -> None:
    self.__post_init__(skip_validation)

def _jsoncompat_bind(_models: tuple[type[dc.DataclassModel], ...], _namespace: dict[str, typing.Any]) -> None:
    (UserProfileReader, UserProfileV1, UserProfileV2, UserProfileV2Reader, UserProfileV1Reader,) = _models
    dc.install_model(UserProfileReader, _jsoncompat_init_0, b'x\xda\xd5U\xcdN\xf30\x10\xbc\xe7)*\x7f=\xa6_\x9a\x1cy\x06$\x10\x12\\\x10\xaa\x96x\x93\x1a\x12;\xac\xb7\x11\x08\xf1\xee\xd8mH\x9d\x10A\xc5\xaf\xb8u\xd7\xe3Y\xcf\xec\xa8y\x8cf31\x97XXq4{t\x85+\xdb\xb4\xff\xed\xaa\x86L\x83\xc4\x0am\xd0u}(q\xd0p\xadZiUoj\xd7^\xc6a\x9f\x1f\x1a\x8f\x15J3\x96H\xa2?{\xda\xc3\x84\x86z\x8a\xf0\x18u\xc9kw\x90NRZ&\xa5\xcb\x801\x1a1\x0b\xc2\xbb\x8d"\x94\x0e}9\x9a\x16\x0f\xd5t\xd5U\x7f\xf5e\x88\xb9\xbe\xc1\x9c{\xb8\xb8_\xdcX\xa3sS7\xc0CSn\x95\xf6\x83\x84\xc4\xbc\x02\x02VF\x8b\xd7\x1a\xc5\xb9E:%S\xa8\x0a/\xd2\x10`\xf35\xd6\xb0",<\xec_\xb2\xddL\xd2\x0e1\x0c\xd7\x15\xae\xd4v\xd0\xc61-\x9a\x1dU\x08j\x91\xac\x1f\xee|\x8bBg:_D\x9b\xfd\xc6\x8e\xfd!\xa1e;f\xfd#\x09\x99\x94\xf2;\xb1\xc9\x0e\x88M\xf6\x89\xd8d\xc3\xd8D\x9dab\xbe\x9b\xe5I\xd6\xcc\x8d=J\x12\xafj\xb1k\xff7T&\x92\xa0\xe0$[f\xcbE\x9a%\x1d~{\xd9h<)z\x9b\xfb\xf8\x81\x94\xcak\x86\xea4\x0cb\x01\x95\xc5\xf8\xbd\x8cJ`\x18\xa7b\xfe\xda\x89\xc9D\xed\xe5\x0e\xae\xe7F[\x0e<8<4/\x84\xf1\xe8}_\x98\x11B\x90H\xab\x16H\x81\xe6wcr\xb6\x85\x87\xb0\x06\x1e*\x03\xf2;\xd3\x12\xff\xf4~\xd3\x0f\xed7\xfd\xfb\xfbM\x0f\xdf\xef\x17~D\xa2N\xaa`\xc5\x15\x8e)f\xb4\x7f\xd3\xb4\xe0\x91\xd8n\xe6\x94\xc0\x81\xbc7^\xed\xff\x9f\xa2\xa7g9\x16+\x02', _namespace)
    dc.install_model(UserProfileV1, _jsoncompat_init_1, b'x\xdam\x90KN\xc3@\x0c@\xf79EdX\xb6*e\xc9\x19\x90`\x03\x1b\x84\xaai\xe2\xa4.\xf3\xc3\xe3T\xa0\xaaw\xc7\x934I\xa9\xba\x9by\xb6\x9f?\xc7\xa2,\xc1\x91\x7f\xe5\x10\x91\x850\xc1S\xf9\xb8\xc84^\xa2\xa3\x12e\xa6\xc5\xe93\x14\x92\xeb\x9c\xa2\x87\xc5\xc4:+\x14-\xbe4\x8a\xd7\x13\x96\xdf\x98K\x81\xbc`\x8b\x0c=?\x0da\xf0\xc6]{\x9f\xd1\xb7\xb2\xbb\xa9H\xc2\xe4\xdb\xb3\xa18[\x80\xf1\xbb#\xc6Z3>\xe6a/\x1b\xe8\xf3\xb3O\x1dEa\xbb\xc7J\xfa\x1c\xf8Y\xeeS\xf0Up\xd1\xc8\xbc\xef\x17\xf9,\x84\x1a+k\xd8\x08\x05\x0f\xffg\x86\xb7\x84\xac\xd7k\xc8\xe2\xfbz\x0c\xa6j\x87\xcel\x18\xf3\x11\xe0nu_c\x93V\x879.fkqC\xbd\xbcS\xc32\x0e\x8a1\xe1\x80\x9cr3\xdd?oX\x9c\xfe\x00MNp\xca', _namespace)
    dc.install_model(UserProfileV2, _jsoncompat_init_2, b'x\xda\x9d\x91\xcdN\xc30\x0c\x80\xef}\x8a\xcap\xdc4\x18\xb7=\x03\x12\\\xe0\x82\xd0\x94\xb5n\xe7\x91?\x1cw\x02M{w\x92tm7\xe0\xb4[\xf2\xd9\xfe\x1c;\x87\xa2,\xc1\x90}f\xe7\x91\x850\xc0\xaa|\x98%\xea\xcf\xd1!\x92\xc8T\x8b\xe3\xa5/$\xd3\x99\x88\xeef#\xeb\xb4\x90\xd7\xf8\xd4D|?b\xf9\xf6\xa9\x14\xc8\x0a\xb6\xc8\x90\xf9\xb1\x0fg\xc8\x18$\\\xc8\xaf\x10Ye~?\xf0\x11m+\xdb\x7f\x15A\x98l{2\x14\'\x0b0~v\xc4X\xc7\x8c\xb7i\xea?/=\xef\x18\x8f\xef\xb9v0\xbb\xcd\x0e+\xc99\xf05\xdf\x05g+g\xbc\x92i\x93\x1fdS\x07\xa8\xb1\xd2\x8a\x95\x90\xb3p9\x04\xbc\x04\xe4\xf8/\x0di|]\x0e\xc1Pm\xd1\xa85c\xda\x0a\xdc,nkl\xc2b?\xc5Em4\xae)\xcb\xbbh\x98\xfb^1$\xec\x91Cj\xb6*\x97i\xe4\xe2\xf8\x03\xc4u\x88\xa2', _namespace)
    dc.install_model(UserProfileV2Reader, _jsoncompat_init_3, b'x\xda\xd5R\xcbN\xc30\x10\xbc\xe7+\xaa\x85c\xab\xd2\x1c\xf9\x06\x0e\x15\x12\\\x10\xaa\xb6\xf1&uI\xec\xb0v#\xaa\xaa\xff\x8e\x13R\xd7I\x8d@\xe2Pq\xf3\xaegg\x1f3\x87d2\x81[A\xb9\x81\xfb\xc9\xc1\x05.l\x16\xfe\xed\xa2\x9auMl%\x99 \xeb\xf2X\xd0 \xe1R\x95T\xb2\xdaU.}7\x0d\xf3v_\xb7X\x90\xcaRA\x0c\xfe\xefx\x86\x81\xc2*F\xf8@\xaa\xb0\x1b\xf7\xb1\x88R\x1a\xcbR\x15\x01c2b\x06\xa6\xf7\x9dd\x12\x0e\xfd2\xea6\x1dn\xd3G\xaf\xbe\xf4\xd4D\xaf\xb7\x94Y\x0f\x87\x8f\xd9\xd6h\x95\xe9\xaaF;<\xca\x9bTm#\x10\x94\x95\xc8h\xa5Vp\xb9#<\x19\xe2%\xeb\\\x96\xf4\xbc\x08\x01&\xdbP\x85+\xa6\xbc\x85\xdd\xcc;e\xe6\xcd\x10cq]\xd2Jv\x8dv\x8eiV\x7fQ\x85\xa0\x86\xd8\xb4\xcd\xdd\xdd\x92\xf02\xfd]\xa0I\xaf\xa1q\xfb\xc9d\xac\x19\xb3\xfe\x13\x87DW\xb9\x8em\xd2_\xd8&\xfd\x83m\xd2\xa1m\x92\xfe`\x80B\xc8v>,\x97\xa1ir,\x0du\x80\x88\x97@\xa0\xc5\xd0o\xb7\x97\x93\x0e\xdd\xe9\xc7\xf0%\x99V\xc6\xfa\xb9\xce\xf3\\\x88\xe7\x8b\xa7A\xef\xa4\xd7\'\xa6M\\\x17\xaf\x09\x13\x0a\xe2U\x83,Q\x9d\xd4\x8cK\xf2\xd8AO\x90\x1a\xf7\xa5F\xf1\xad*?*2R\xe3\x98\x1c?\x01\xbfke\xb6', _namespace)
    dc.install_model(UserProfileV1Reader, _jsoncompat_init_4, b'x\xda\xd5S\xc1N\xc30\x0c\xbd\xf7+&\xc3q\xd3X\x8f|\x03\x87\x09\x09.\x08M^\xe3v\x19mR\x9c\xacb\x9a\xf6\xef\xa4\xa5\xcb\xd2.\x08$\x0e\x13\xb7\xd8yy\x8e\xfd\x9e\x0f\xc9d\x02\xb7\x82r\x03\xf7\x93\x83\x0b\\\xd8,\xfc\xd9E5\xeb\x9a\xd8J2A\xd6\xe5\xb1\xa0A\xc2\xa5*\xa9d\xb5\xab\\\xfan\x1a\xe6\xed\xben\xb1 \x95\xa5\x82\x18\xfc\xdd\xf1\x0c\x03\x85U\x8c\xf0\x81Ta7\xeeb\x11\xa54\x96\xa5*\x02\xc6d\xc4\x0cL\xef;\xc9$\x1c\xfaeTm:\xec\xa6\x8f^\xfd\xd3S\x11\xbd\xdeRf=\x1c>f[\xa3U\xa6\xab\x1a\xedp(oR\xb5\x85@PV"\xa3\x95Z\xc1e\x8f\xf0d\x88\x97\xacsY\xd2\xf3"\x04\x98lC\x15\xae\x98\xf2\x16v3\xef\x94\x997C\x8c\xc5uI+\xd9\x15\xda9\xa6Y\xfdE\x15\x82\x1ab\xd3\x16wsK\xc2\xc9\xf4s\x81&\xbd\x86\xc6\xed%\x93\xb1f\xcc\xfaO\x1c\x12m\xe5:\xb6I\x7fa\x9b\xf4\x0f\xb6I\x87\xb6I\xfa\x81\x01\x0a!\xdb\xffa\xb9\x0cM\x93ci\xa8\x03D\xbc\x04\x02-\x86~\xbb\xbd4\xf8\xd0\x9d\xfe\x1b\xfeI\xa6\x95\xb1\xde\xce\xe7\xff\\\x88\xe7\x1fO\x83\xdaI\xafOL\x9b\xb8.^\x13&\x14\xc4\xab\x06Y\xa2:\xa9\x19\xdf\xe4\xc7\x0ez\x82\xd4\xb8/5\x8ao\x97\xf9GEFK|L\x8e\x9f\xbc\xa3e\xb1', _namespace)
    dc.bind_module(1, [(UserProfileReader, 0), (UserProfileV1, 4), (UserProfileV2, 10), (UserProfileV2Reader, 8), (UserProfileV1Reader, 2)], [
        ('root', UserProfileReader, 1, b'{"version":4,"nodes":[{"types":null,"choices":null,"rules":[{"one":[1,9]}]},{"types":["object"],"choices":null,"rules":[{"object":{"properties":[["data",2],["version",7]],"patterns":[],"required":["version","data"],"additional":8}}]},{"types":null,"choices":null,"rules":[{"ref":{"node":3,"pointer":"/$defs/v2"}}]},{"types":["object"],"choices":null,"rules":[{"object":{"properties":[["age",4],["interests",5],["name",6]],"patterns":[],"required":["name","age","interests"],"additional":null}}]},{"types":["integer"],"choices":null,"rules":[{"bound":{"value":0,"lower":true,"exclusive":false}}]},{"types":["integer"],"choices":null,"rules":[]},{"types":["string"],"choices":null,"rules":[{"string_length":{"min":1,"max":null}}]},{"types":null,"choices":[2],"constant":true,"rules":[]},{"types":null,"choices":null,"rules":["false"]},{"types":["object"],"choices":null,"rules":[{"object":{"properties":[["data",10],["version",12]],"patterns":[],"required":["version","data"],"additional":8}}]},{"types":null,"choices":null,"rules":[{"ref":{"node":11,"pointer":"/$defs/v1"}}]},{"types":["object"],"choices":null,"rules":[{"object":{"properties":[["age",4],["name",6]],"patterns":[],"required":["name","age"],"additional":null}}]},{"types":null,"choices":[1],"constant":true,"rules":[]}],"patterns":[],"pattern_sources":[]}'),
        ('union', (2, 8,), "version", ((1, 0), (2, 1),)),
        ('model', UserProfileV1Reader, (("data", "data", 4, False), ("version", "version", 3, False),), None, b'{"version":4,"nodes":[{"types":["object"],"choices":null,"rules":[{"object":{"properties":[["data",1],["version",5]],"patterns":[],"required":["version","data"],"additional":6}}]},{"types":null,"choices":null,"rules":[{"ref":{"node":2,"pointer":"/$defs/v1"}}]},{"types":["object"],"choices":null,"rules":[{"object":{"properties":[["age",3],["name",4]],"patterns":[],"required":["name","age"],"additional":null}}]},{"types":["integer"],"choices":null,"rules":[{"bound":{"value":0,"lower":true,"exclusive":false}}]},{"types":["string"],"choices":null,"rules":[{"string_length":{"min":1,"max":null}}]},{"types":null,"choices":[1],"constant":true,"rules":[]},{"types":null,"choices":null,"rules":["false"]}],"patterns":[],"pattern_sources":[]}'),
        ('literal', (1,)),
        ('model', UserProfileV1, (("age", "age", 5, False), ("name", "name", 6, False),), 7, b'{"version":4,"nodes":[{"types":["object"],"choices":null,"rules":[{"object":{"properties":[["age",1],["name",2]],"patterns":[],"required":["age","name"],"additional":null}},{"object_length":{"min":2,"max":null}}]},{"types":["integer"],"choices":null,"rules":[{"bound":{"value":0,"lower":true,"exclusive":false}}]},{"types":["string"],"choices":null,"rules":[{"string_length":{"min":1,"max":null}}]}],"patterns":[],"pattern_sources":[]}'),
        ("int",),
        ("str",),
        ("any",),
        ('model', UserProfileV2Reader, (("data", "data", 10, False), ("version", "version", 9, False),), None, b'{"version":4,"nodes":[{"types":["object"],"choices":null,"rules":[{"object":{"properties":[["data",1],["version",6]],"patterns":[],"required":["version","data"],"additional":7}}]},{"types":null,"choices":null,"rules":[{"ref":{"node":2,"pointer":"/$defs/v2"}}]},{"types":["object"],"choices":null,"rules":[{"object":{"properties":[["age",3],["interests",4],["name",5]],"patterns":[],"required":["name","age","interests"],"additional":null}}]},{"types":["integer"],"choices":null,"rules":[{"bound":{"value":0,"lower":true,"exclusive":false}}]},{"types":["integer"],"choices":null,"rules":[]},{"types":["string"],"choices":null,"rules":[{"string_length":{"min":1,"max":null}}]},{"types":null,"choices":[2],"constant":true,"rules":[]},{"types":null,"choices":null,"rules":["false"]}],"patterns":[],"pattern_sources":[]}'),
        ('literal', (2,)),
        ('model', UserProfileV2, (("age", "age", 5, False), ("interests", "interests", 5, False), ("name", "name", 6, False),), 7, b'{"version":4,"nodes":[{"types":["object"],"choices":null,"rules":[{"object":{"properties":[["age",1],["interests",2],["name",3]],"patterns":[],"required":["age","interests","name"],"additional":null}},{"object_length":{"min":3,"max":null}}]},{"types":["integer"],"choices":null,"rules":[{"bound":{"value":0,"lower":true,"exclusive":false}}]},{"types":["integer"],"choices":null,"rules":[]},{"types":["string"],"choices":null,"rules":[{"string_length":{"min":1,"max":null}}]}],"patterns":[],"pattern_sources":[]}')
    ], b'{"version":4,"base_nodes":11,"guard_nodes":[{"original":5,"guard":{"types":["integer"],"choices":null,"rules":[{"bound":{"value":0,"lower":true,"exclusive":false}}]}},{"original":6,"guard":{"types":["string"],"choices":null,"rules":[{"string_length":{"min":1,"max":null}}]}}],"guards":[{"owner":4,"field":0,"guard":0},{"owner":4,"field":1,"guard":1},{"owner":10,"field":0,"guard":0},{"owner":10,"field":2,"guard":1}],"conversion_validates":[true,false,true,false,true,false,false,false,true,false,true,false,false],"json_keys":[[2,["\\"data\\":","\\"version\\":"]],[4,["\\"age\\":","\\"name\\":"]],[8,["\\"data\\":","\\"version\\":"]],[10,["\\"age\\":","\\"interests\\":","\\"name\\":"]]]}')


bind_models = _jsoncompat_bind