fix(jambo): Fix allOf, anyOf, null and array type parsing #33

Closed
thommann wants to merge 10 commits from main into main
19 changed files with 63 additions and 51 deletions
Showing only changes of commit 9c598eeacc - Show all commits

View File

@@ -1,7 +1,7 @@
from jambo.types.type_parser_options import TypeParserOptions
from pydantic import Field, TypeAdapter
from typing_extensions import Annotated, Any, Generic, Self, TypeVar, Unpack
from typing import Annotated, Any, Generic, Self, TypeVar, Unpack
HideyoshiNakazone commented 2025-08-19 03:02:51 +00:00 (Migrated from github.com)
Review

typing_extensions is prefered for Python3.10 compatibility

`typing_extensions` is prefered for Python3.10 compatibility
from abc import ABC, abstractmethod
@@ -47,7 +47,7 @@ class GenericTypeParser(ABC, Generic[T]):
if not self._validate_default(parsed_type, parsed_properties):
raise ValueError(
f"Default value {properties.get('default')} is not valid for type {parsed_type.__name__}"
f"Default value {properties.get('default')} is not valid for type {parsed_type}"
)
return parsed_type, parsed_properties

View File

@@ -1,7 +1,7 @@
from jambo.parser._type_parser import GenericTypeParser
from jambo.types.type_parser_options import TypeParserOptions
from typing_extensions import Any, Unpack
from typing import Any, Unpack
HideyoshiNakazone commented 2025-08-19 03:02:36 +00:00 (Migrated from github.com)
Review

typing_extensions is prefered for Python3.10 compatibility

`typing_extensions` is prefered for Python3.10 compatibility
class AllOfTypeParser(GenericTypeParser):

View File

@@ -2,11 +2,14 @@ from jambo.parser._type_parser import GenericTypeParser
from jambo.types.type_parser_options import TypeParserOptions
from pydantic import Field
from typing_extensions import Annotated, Union, Unpack
from typing import Annotated, Unpack
from types import UnionType
HideyoshiNakazone commented 2025-08-19 03:05:28 +00:00 (Migrated from github.com)
Review

typing_extensions is prefered for Python3.10 compatibility

`typing_extensions` is prefered for Python3.10 compatibility
from functools import reduce
from operator import or_
class AnyOfTypeParser(GenericTypeParser):
mapped_type = Union
mapped_type = UnionType
json_schema_type = "anyOf"
@@ -41,4 +44,6 @@ class AnyOfTypeParser(GenericTypeParser):
for t, v in sub_types
]
return Union[(*field_types,)], mapped_properties
union_type = reduce(or_, field_types)
return union_type, mapped_properties

View File

@@ -1,7 +1,7 @@
from jambo.parser._type_parser import GenericTypeParser
from jambo.types.type_parser_options import TypeParserOptions
from typing_extensions import Iterable, TypeVar, Unpack
from typing import Iterable, TypeVar, Unpack
import copy

View File

@@ -1,7 +1,7 @@
from jambo.parser._type_parser import GenericTypeParser
from jambo.types.type_parser_options import TypeParserOptions
from typing_extensions import Unpack
from typing import Unpack
HideyoshiNakazone commented 2025-08-19 03:06:54 +00:00 (Migrated from github.com)
Review

typing_extensions is prefered for Python3.10 compatibility

`typing_extensions` is prefered for Python3.10 compatibility
class BooleanTypeParser(GenericTypeParser):

View File

@@ -3,7 +3,7 @@ from jambo.types.json_schema_type import JSONSchemaNativeTypes
from jambo.types.type_parser_options import TypeParserOptions
from pydantic import AfterValidator
from typing_extensions import Annotated, Any, Literal, Unpack
from typing import Annotated, Any, Literal, Unpack
HideyoshiNakazone commented 2025-08-19 03:08:39 +00:00 (Migrated from github.com)
Review

typing_extensions is prefered for Python3.10 compatibility

`typing_extensions` is prefered for Python3.10 compatibility
class ConstTypeParser(GenericTypeParser):

View File

@@ -2,7 +2,7 @@ from jambo.parser._type_parser import GenericTypeParser
from jambo.types.json_schema_type import JSONSchemaNativeTypes
from jambo.types.type_parser_options import TypeParserOptions
from typing_extensions import Unpack
from typing import Unpack
HideyoshiNakazone commented 2025-08-19 03:17:39 +00:00 (Migrated from github.com)
Review

typing_extensions is prefered for Python3.10 compatibility

`typing_extensions` is prefered for Python3.10 compatibility
from enum import Enum

View File

@@ -1,7 +1,7 @@
from jambo.parser._type_parser import GenericTypeParser
from jambo.types.type_parser_options import TypeParserOptions
from typing_extensions import Unpack
from typing import Unpack
HideyoshiNakazone commented 2025-08-19 03:17:45 +00:00 (Migrated from github.com)
Review

typing_extensions is prefered for Python3.10 compatibility

`typing_extensions` is prefered for Python3.10 compatibility
class FloatTypeParser(GenericTypeParser):

View File

@@ -1,7 +1,7 @@
from jambo.parser._type_parser import GenericTypeParser
from jambo.types.type_parser_options import TypeParserOptions
from typing_extensions import Unpack
from typing import Unpack
HideyoshiNakazone commented 2025-08-19 03:17:51 +00:00 (Migrated from github.com)
Review

typing_extensions is prefered for Python3.10 compatibility

`typing_extensions` is prefered for Python3.10 compatibility
class IntTypeParser(GenericTypeParser):

View File

@@ -1,7 +1,7 @@
HideyoshiNakazone commented 2025-08-19 03:23:21 +00:00 (Migrated from github.com)
Review

Already implemented in a previous PR that was merged, sorry

Already implemented in a previous PR that was merged, sorry
HideyoshiNakazone commented 2025-08-19 03:23:21 +00:00 (Migrated from github.com)
Review

Already implemented in a previous PR that was merged, sorry

Already implemented in a previous PR that was merged, sorry
from jambo.parser._type_parser import GenericTypeParser
from jambo.types.type_parser_options import TypeParserOptions
from typing_extensions import Unpack
HideyoshiNakazone commented 2025-08-19 03:23:21 +00:00 (Migrated from github.com)
Review

Already implemented in a previous PR that was merged, sorry

Already implemented in a previous PR that was merged, sorry
from typing import Unpack
HideyoshiNakazone commented 2025-08-19 03:23:21 +00:00 (Migrated from github.com)
Review

Already implemented in a previous PR that was merged, sorry

Already implemented in a previous PR that was merged, sorry
class NullTypeParser(GenericTypeParser):
HideyoshiNakazone commented 2025-08-19 03:23:21 +00:00 (Migrated from github.com)
Review

Already implemented in a previous PR that was merged, sorry

Already implemented in a previous PR that was merged, sorry
HideyoshiNakazone commented 2025-08-19 03:23:21 +00:00 (Migrated from github.com)
Review

Already implemented in a previous PR that was merged, sorry

Already implemented in a previous PR that was merged, sorry

View File

@@ -2,7 +2,7 @@ from jambo.parser._type_parser import GenericTypeParser
from jambo.types.type_parser_options import TypeParserOptions
from pydantic import BaseModel, ConfigDict, Field, create_model
from typing_extensions import Any, Unpack
from typing import Any, Unpack
HideyoshiNakazone commented 2025-08-19 03:22:50 +00:00 (Migrated from github.com)
Review

typing_extensions is prefered for Python3.10 compatibility

`typing_extensions` is prefered for Python3.10 compatibility
class ObjectTypeParser(GenericTypeParser):

View File

@@ -1,12 +1,15 @@
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
from types import UnionType
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
from jambo.parser._type_parser import GenericTypeParser
from jambo.types.type_parser_options import TypeParserOptions
from pydantic import Field, BeforeValidator, TypeAdapter, ValidationError
from typing_extensions import Annotated, Union, Unpack, Any
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
from typing import Annotated, Unpack, Any
HideyoshiNakazone commented 2025-08-19 03:22:09 +00:00 (Migrated from github.com)
Review

typing_extensions is prefered for Python3.10 compatibility

`typing_extensions` is prefered for Python3.10 compatibility
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
from functools import reduce
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
from operator import or_
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
class OneOfTypeParser(GenericTypeParser):
mapped_type = Union
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
mapped_type = UnionType
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
json_schema_type = "oneOf"
@@ -36,7 +39,7 @@ class OneOfTypeParser(GenericTypeParser):
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
for t, v in sub_types
]
union_type = Union[(*field_types,)]
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
union_type = reduce(or_, field_types)
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
discriminator = properties.get("discriminator")
if discriminator and isinstance(discriminator, dict):
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR
HideyoshiNakazone commented 2025-08-19 03:22:42 +00:00 (Migrated from github.com)
Review

This entire feature should be in a separate PR

This entire feature should be in a separate PR

View File

@@ -1,10 +1,12 @@
from __future__ import annotations
from jambo.parser import GenericTypeParser
from jambo.types.type_parser_options import TypeParserOptions
HideyoshiNakazone commented 2025-08-19 03:23:34 +00:00 (Migrated from github.com)
Review

typing_extensions is prefered for Python3.10 compatibility

`typing_extensions` is prefered for Python3.10 compatibility
from typing_extensions import Any, ForwardRef, Literal, TypeVar, Union, Unpack
from typing import Any, ForwardRef, Literal, TypeVar, Unpack
RefType = TypeVar("RefType", bound=Union[type, ForwardRef])
RefType = TypeVar("RefType", bound=type | ForwardRef)
RefStrategy = Literal["forward_ref", "def_ref"]

View File

@@ -2,7 +2,7 @@ from jambo.parser._type_parser import GenericTypeParser
from jambo.types.type_parser_options import TypeParserOptions
from pydantic import EmailStr, HttpUrl, IPvAnyAddress, FilePath
from typing_extensions import Unpack
from typing import Unpack
HideyoshiNakazone commented 2025-08-19 03:23:41 +00:00 (Migrated from github.com)
Review

typing_extensions is prefered for Python3.10 compatibility

`typing_extensions` is prefered for Python3.10 compatibility
from datetime import date, datetime, time

View File

@@ -1,4 +1,6 @@
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
from typing_extensions import Dict, List, Literal, TypedDict, Union
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
from __future__ import annotations
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
from typing import Literal, TypedDict
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
from types import NoneType
@@ -19,7 +21,7 @@ JSONSchemaNativeTypes: tuple[type, ...] = (
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
)
JSONType = Union[str, int, float, bool, None, Dict[str, "JSONType"], List["JSONType"]]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONType = str | int | float | bool | None | dict[str, "JSONType"] | list["JSONType"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
class JSONSchema(TypedDict, total=False):
@@ -27,23 +29,23 @@ class JSONSchema(TypedDict, total=False):
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
title: str
description: str
default: JSONType
examples: List[JSONType]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
examples: list[JSONType]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
# Type definitions
type: Union[JSONSchemaType, List[JSONSchemaType]]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
type: JSONSchemaType | list[JSONSchemaType]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
# Object-specific keywords
properties: Dict[str, "JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
required: List[str]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
additionalProperties: Union[bool, "JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
properties: dict[str, "JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
required: list[str]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
additionalProperties: bool | "JSONSchema"
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
minProperties: int
maxProperties: int
patternProperties: Dict[str, "JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
dependencies: Dict[str, Union[List[str], "JSONSchema"]]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
patternProperties: dict[str, "JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
dependencies: dict[str, list[str] | "JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
# Array-specific keywords
items: Union["JSONSchema", List["JSONSchema"]]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
additionalItems: Union[bool, "JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
items: "JSONSchema" | list["JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
additionalItems: bool | "JSONSchema"
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
minItems: int
maxItems: int
uniqueItems: bool
@@ -62,7 +64,7 @@ class JSONSchema(TypedDict, total=False):
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
multipleOf: float
# Enum and const
enum: List[JSONType]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
enum: list[JSONType]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
const: JSONType
# Conditionals
@@ -71,23 +73,23 @@ class JSONSchema(TypedDict, total=False):
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
else_: "JSONSchema" # 'else' is also a reserved word
# Combination keywords
allOf: List["JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
anyOf: List["JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
oneOf: List["JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
allOf: list["JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
anyOf: list["JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
oneOf: list["JSONSchema"]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
not_: "JSONSchema" # 'not' is a reserved word
# Fix forward references
JSONSchema.__annotations__["properties"] = Dict[str, JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["items"] = Union[JSONSchema, List[JSONSchema]]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["additionalItems"] = Union[bool, JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["additionalProperties"] = Union[bool, JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["patternProperties"] = Dict[str, JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["dependencies"] = Dict[str, Union[List[str], JSONSchema]]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["properties"] = dict[str, JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["items"] = JSONSchema | list[JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["additionalItems"] = bool | JSONSchema
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["additionalProperties"] = bool | JSONSchema
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["patternProperties"] = dict[str, JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["dependencies"] = dict[str, list[str] | JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["if_"] = JSONSchema
JSONSchema.__annotations__["then"] = JSONSchema
JSONSchema.__annotations__["else_"] = JSONSchema
JSONSchema.__annotations__["allOf"] = List[JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["anyOf"] = List[JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["oneOf"] = List[JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["allOf"] = list[JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["anyOf"] = list[JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["oneOf"] = list[JSONSchema]
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
JSONSchema.__annotations__["not_"] = JSONSchema
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?
HideyoshiNakazone commented 2025-08-19 03:24:56 +00:00 (Migrated from github.com)
Review

A large change with little impact, is there a necessity for this change?

A large change with little impact, is there a necessity for this change?

View File

@@ -1,6 +1,6 @@
from jambo.types.json_schema_type import JSONSchema
from typing_extensions import TypedDict
from typing import TypedDict
HideyoshiNakazone commented 2025-08-19 03:25:23 +00:00 (Migrated from github.com)
Review

typing_extensions is prefered for Python3.10 compatibility

`typing_extensions` is prefered for Python3.10 compatibility
class TypeParserOptions(TypedDict):

View File

@@ -1,6 +1,6 @@
from jambo.parser.anyof_type_parser import AnyOfTypeParser
from typing_extensions import Annotated, Union, get_args, get_origin
from typing import Annotated, get_args, get_origin
from unittest import TestCase
@@ -42,7 +42,7 @@ class TestAnyOfTypeParser(TestCase):
)
# check union type has string and int
self.assertEqual(get_origin(type_parsing), Union)
self.assertEqual(get_origin(type_parsing), type(str | int))
type_1, type_2 = get_args(type_parsing)
@@ -67,7 +67,7 @@ class TestAnyOfTypeParser(TestCase):
)
# check union type has string and int
self.assertEqual(get_origin(type_parsing), Union)
self.assertEqual(get_origin(type_parsing), type(str | int))
type_1, type_2 = get_args(type_parsing)

View File

@@ -1,6 +1,6 @@
from jambo.parser import ArrayTypeParser
from typing_extensions import get_args
from typing import get_args
from unittest import TestCase

View File

@@ -1,6 +1,6 @@
from jambo.parser import ConstTypeParser
from typing_extensions import Annotated, Literal, get_args, get_origin
from typing import Annotated, Literal, get_args, get_origin
from unittest import TestCase