1717from pydantic import BaseModel
1818from pydantic .annotated_handlers import GetJsonSchemaHandler
1919
20- from .compatibility import apply_compatibility_mode
2120from .constraint import Constraint , build_constraints , compute_constraints
2221
2322CONDITIONALS_REF_MARKER = "$$ref"
@@ -67,7 +66,7 @@ def _normalize_require_fields(field: str | tuple[str] | list[str]) -> list[str]:
6766 return list (field )
6867 if isinstance (field , list ):
6968 return field
70- raise ValueError ("Parameter should be list or str." )
69+ raise ValueError ("Parameter must be a list or str." )
7170
7271
7372class QueryBuilder :
@@ -137,8 +136,8 @@ def __and__(self, other: QueryBuilder | DependentSchemaBuilder) -> QueryBuilder:
137136 and self .conditions
138137 ):
139138 raise ValueError (
140- "Canot combine wheres specified with Schemas with ones specified "
141- "with conditions."
139+ "Cannot combine where clauses specified with schemas with "
140+ "ones specified with conditions."
142141 )
143142
144143 conditions = self .conditions [0 ] if len (self .conditions ) == 1 else {}
@@ -179,8 +178,8 @@ def __or__(self, other: QueryBuilder | DependentSchemaBuilder) -> QueryBuilder:
179178 and self .conditions
180179 ):
181180 raise ValueError (
182- "Canot combine wheres specified with Schemas with ones specified "
183- "with conditions."
181+ "Cannot combine where clauses specified with schemas with "
182+ "ones specified with conditions."
184183 )
185184
186185 if isinstance (other , DependentSchemaBuilder ):
@@ -227,7 +226,7 @@ def then_apply(self, schema: type[BaseModel]) -> Self:
227226
228227 def then_apply_only (self , schema : type [BaseModel ]) -> Self :
229228 """Mixes in this schema when the condition is met (``then`` clause).
230- "additionalPropertes" is set to false!
229+ ``additionalProperties`` is set to ``False``.
231230
232231 This does not combine with ``constrain`` or other ``then_apply`` methods.
233232 The last ``then_apply`` will take precedence.
@@ -254,7 +253,7 @@ def else_apply(self, schema: type[BaseModel]) -> Self:
254253
255254 def else_apply_only (self , schema : type [BaseModel ]) -> Self :
256255 """Mixes in this schema when the condition is *not* met (``else`` clause).
257- "additionalPropertes" is set to false!
256+ ``additionalProperties`` is set to ``False``.
258257
259258 This does not combine with ``otherwise`` or other ``else_apply`` methods.
260259 The last ``else_apply`` will take precedence.
@@ -561,22 +560,10 @@ def __get_pydantic_json_schema__(
561560 def model_json_schema (
562561 cls ,
563562 * args ,
564- compatibility_mode : str | bool = False ,
565563 ** kwargs : Any ,
566564 ) -> dict [str , Any ]:
567- """Generate JSON Schema for this model, applying compatibility mode if needed.
568-
569- Args:
570- compatibility_mode: Controls schema conversion.
571- ``False`` (default) -- no conversion.
572- ``True`` -- full conversion (dependentRequired/Schemas -> if/then/else).
573- to if/then/else only.
574- """
565+ """Generate JSON Schema for this model."""
575566 result = super ().model_json_schema (* args , ** kwargs ) # type: ignore[misc]
576567 result = _remove_conditionals_ref_marker (result )
577568
578- mode = compatibility_mode or getattr (cls , "model_compatibility_mode" , False )
579- if mode is True :
580- result = apply_compatibility_mode (result )
581-
582569 return result
0 commit comments