strawberry-graphql 0.223.0__tar.gz → 0.224.0.dev1711748192__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/PKG-INFO +1 -1
  2. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/pyproject.toml +1 -1
  3. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/experimental/__init__.py +1 -1
  4. strawberry_graphql-0.224.0.dev1711748192/strawberry/experimental/pydantic/_compat.py +277 -0
  5. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/experimental/pydantic/error_type.py +3 -2
  6. strawberry_graphql-0.224.0.dev1711748192/strawberry/experimental/pydantic/fields.py +88 -0
  7. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/experimental/pydantic/object_type.py +16 -8
  8. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/experimental/pydantic/utils.py +5 -9
  9. strawberry_graphql-0.223.0/strawberry/experimental/pydantic/_compat.py +0 -103
  10. strawberry_graphql-0.223.0/strawberry/experimental/pydantic/fields.py +0 -199
  11. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/LICENSE +0 -0
  12. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/README.md +0 -0
  13. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/__init__.py +0 -0
  14. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/__main__.py +0 -0
  15. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/aiohttp/__init__.py +0 -0
  16. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/aiohttp/handlers/__init__.py +0 -0
  17. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/aiohttp/handlers/graphql_transport_ws_handler.py +0 -0
  18. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/aiohttp/handlers/graphql_ws_handler.py +0 -0
  19. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/aiohttp/test/__init__.py +0 -0
  20. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/aiohttp/test/client.py +0 -0
  21. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/aiohttp/views.py +0 -0
  22. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/annotation.py +0 -0
  23. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/arguments.py +0 -0
  24. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/asgi/__init__.py +0 -0
  25. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/asgi/handlers/__init__.py +0 -0
  26. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/asgi/handlers/graphql_transport_ws_handler.py +0 -0
  27. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/asgi/handlers/graphql_ws_handler.py +0 -0
  28. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/asgi/test/__init__.py +0 -0
  29. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/asgi/test/client.py +0 -0
  30. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/auto.py +0 -0
  31. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/chalice/__init__.py +0 -0
  32. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/chalice/views.py +0 -0
  33. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/channels/__init__.py +0 -0
  34. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/channels/handlers/base.py +0 -0
  35. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/channels/handlers/graphql_transport_ws_handler.py +0 -0
  36. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/channels/handlers/graphql_ws_handler.py +0 -0
  37. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/channels/handlers/http_handler.py +0 -0
  38. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/channels/handlers/ws_handler.py +0 -0
  39. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/channels/router.py +0 -0
  40. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/channels/testing.py +0 -0
  41. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/__init__.py +0 -0
  42. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/app.py +0 -0
  43. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/commands/__init__.py +0 -0
  44. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/commands/codegen.py +0 -0
  45. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/commands/export_schema.py +0 -0
  46. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/commands/schema_codegen.py +0 -0
  47. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/commands/server.py +0 -0
  48. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/commands/upgrade/__init__.py +0 -0
  49. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/commands/upgrade/_fake_progress.py +0 -0
  50. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/commands/upgrade/_run_codemod.py +0 -0
  51. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/constants.py +0 -0
  52. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/debug_server.py +0 -0
  53. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/utils/__init__.py +0 -0
  54. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/cli/utils/load_schema.py +0 -0
  55. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/codegen/__init__.py +0 -0
  56. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/codegen/exceptions.py +0 -0
  57. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/codegen/plugins/__init__.py +0 -0
  58. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/codegen/plugins/print_operation.py +0 -0
  59. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/codegen/plugins/python.py +0 -0
  60. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/codegen/plugins/typescript.py +0 -0
  61. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/codegen/query_codegen.py +0 -0
  62. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/codegen/types.py +0 -0
  63. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/codemods/__init__.py +0 -0
  64. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/codemods/annotated_unions.py +0 -0
  65. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/custom_scalar.py +0 -0
  66. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/dataloader.py +0 -0
  67. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/directive.py +0 -0
  68. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/django/__init__.py +0 -0
  69. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/django/apps.py +0 -0
  70. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/django/context.py +0 -0
  71. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/django/test/__init__.py +0 -0
  72. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/django/test/client.py +0 -0
  73. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/django/views.py +0 -0
  74. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/enum.py +0 -0
  75. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/__init__.py +0 -0
  76. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/conflicting_arguments.py +0 -0
  77. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/duplicated_type_name.py +0 -0
  78. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/exception.py +0 -0
  79. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/exception_source.py +0 -0
  80. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/handler.py +0 -0
  81. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/invalid_argument_type.py +0 -0
  82. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/invalid_union_type.py +0 -0
  83. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/missing_arguments_annotations.py +0 -0
  84. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/missing_field_annotation.py +0 -0
  85. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/missing_return_annotation.py +0 -0
  86. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/not_a_strawberry_enum.py +0 -0
  87. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/object_is_not_a_class.py +0 -0
  88. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/object_is_not_an_enum.py +0 -0
  89. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/permission_fail_silently_requires_optional.py +0 -0
  90. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/private_strawberry_field.py +0 -0
  91. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/scalar_already_registered.py +0 -0
  92. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/syntax.py +0 -0
  93. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/unresolved_field_type.py +0 -0
  94. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/utils/__init__.py +0 -0
  95. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/exceptions/utils/source_finder.py +0 -0
  96. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/experimental/pydantic/__init__.py +0 -0
  97. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/experimental/pydantic/conversion.py +0 -0
  98. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/experimental/pydantic/conversion_types.py +0 -0
  99. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/experimental/pydantic/exceptions.py +0 -0
  100. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/ext/LICENSE +0 -0
  101. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/ext/__init__.py +0 -0
  102. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/ext/dataclasses/LICENSE +0 -0
  103. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/ext/dataclasses/__init__.py +0 -0
  104. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/ext/dataclasses/dataclasses.py +0 -0
  105. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/ext/mypy_plugin.py +0 -0
  106. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/__init__.py +0 -0
  107. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/add_validation_rules.py +0 -0
  108. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/base_extension.py +0 -0
  109. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/context.py +0 -0
  110. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/directives.py +0 -0
  111. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/disable_validation.py +0 -0
  112. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/field_extension.py +0 -0
  113. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/mask_errors.py +0 -0
  114. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/max_aliases.py +0 -0
  115. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/max_tokens.py +0 -0
  116. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/parser_cache.py +0 -0
  117. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/pyinstrument.py +0 -0
  118. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/query_depth_limiter.py +0 -0
  119. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/runner.py +0 -0
  120. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/tracing/__init__.py +0 -0
  121. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/tracing/apollo.py +0 -0
  122. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/tracing/datadog.py +0 -0
  123. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/tracing/opentelemetry.py +0 -0
  124. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/tracing/sentry.py +0 -0
  125. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/tracing/utils.py +0 -0
  126. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/utils.py +0 -0
  127. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/extensions/validation_cache.py +0 -0
  128. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/fastapi/__init__.py +0 -0
  129. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/fastapi/context.py +0 -0
  130. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/fastapi/handlers/__init__.py +0 -0
  131. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/fastapi/handlers/graphql_transport_ws_handler.py +0 -0
  132. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/fastapi/handlers/graphql_ws_handler.py +0 -0
  133. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/fastapi/router.py +0 -0
  134. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/federation/__init__.py +0 -0
  135. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/federation/argument.py +0 -0
  136. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/federation/enum.py +0 -0
  137. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/federation/field.py +0 -0
  138. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/federation/mutation.py +0 -0
  139. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/federation/object_type.py +0 -0
  140. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/federation/scalar.py +0 -0
  141. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/federation/schema.py +0 -0
  142. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/federation/schema_directive.py +0 -0
  143. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/federation/schema_directives.py +0 -0
  144. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/federation/types.py +0 -0
  145. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/federation/union.py +0 -0
  146. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/field.py +0 -0
  147. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/field_extensions/__init__.py +0 -0
  148. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/field_extensions/input_mutation.py +0 -0
  149. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/file_uploads/__init__.py +0 -0
  150. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/file_uploads/scalars.py +0 -0
  151. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/file_uploads/utils.py +0 -0
  152. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/flask/__init__.py +0 -0
  153. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/flask/views.py +0 -0
  154. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/http/__init__.py +0 -0
  155. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/http/async_base_view.py +0 -0
  156. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/http/base.py +0 -0
  157. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/http/exceptions.py +0 -0
  158. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/http/ides.py +0 -0
  159. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/http/sync_base_view.py +0 -0
  160. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/http/temporal_response.py +0 -0
  161. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/http/types.py +0 -0
  162. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/http/typevars.py +0 -0
  163. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/lazy_type.py +0 -0
  164. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/litestar/__init__.py +0 -0
  165. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/litestar/controller.py +0 -0
  166. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/litestar/handlers/graphql_transport_ws_handler.py +0 -0
  167. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/litestar/handlers/graphql_ws_handler.py +0 -0
  168. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/mutation.py +0 -0
  169. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/object_type.py +0 -0
  170. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/parent.py +0 -0
  171. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/permission.py +0 -0
  172. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/printer/__init__.py +0 -0
  173. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/printer/ast_from_value.py +0 -0
  174. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/printer/printer.py +0 -0
  175. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/private.py +0 -0
  176. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/py.typed +0 -0
  177. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/quart/__init__.py +0 -0
  178. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/quart/views.py +0 -0
  179. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/relay/__init__.py +0 -0
  180. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/relay/exceptions.py +0 -0
  181. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/relay/fields.py +0 -0
  182. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/relay/types.py +0 -0
  183. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/relay/utils.py +0 -0
  184. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/resolvers.py +0 -0
  185. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/sanic/__init__.py +0 -0
  186. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/sanic/context.py +0 -0
  187. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/sanic/utils.py +0 -0
  188. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/sanic/views.py +0 -0
  189. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/scalars.py +0 -0
  190. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema/__init__.py +0 -0
  191. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema/base.py +0 -0
  192. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema/compat.py +0 -0
  193. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema/config.py +0 -0
  194. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema/exceptions.py +0 -0
  195. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema/execute.py +0 -0
  196. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema/name_converter.py +0 -0
  197. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema/schema.py +0 -0
  198. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema/schema_converter.py +0 -0
  199. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema/types/__init__.py +0 -0
  200. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema/types/base_scalars.py +0 -0
  201. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema/types/concrete_type.py +0 -0
  202. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema/types/scalar.py +0 -0
  203. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema_codegen/__init__.py +0 -0
  204. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/schema_directive.py +0 -0
  205. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/starlite/__init__.py +0 -0
  206. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/starlite/controller.py +0 -0
  207. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/starlite/handlers/graphql_transport_ws_handler.py +0 -0
  208. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/starlite/handlers/graphql_ws_handler.py +0 -0
  209. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/static/apollo-sandbox.html +0 -0
  210. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/static/graphiql.html +0 -0
  211. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/static/pathfinder.html +0 -0
  212. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/subscriptions/__init__.py +0 -0
  213. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/subscriptions/protocols/__init__.py +0 -0
  214. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/subscriptions/protocols/graphql_transport_ws/__init__.py +0 -0
  215. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py +0 -0
  216. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/subscriptions/protocols/graphql_transport_ws/types.py +0 -0
  217. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/subscriptions/protocols/graphql_ws/__init__.py +0 -0
  218. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/subscriptions/protocols/graphql_ws/handlers.py +0 -0
  219. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/subscriptions/protocols/graphql_ws/types.py +0 -0
  220. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/test/__init__.py +0 -0
  221. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/test/client.py +0 -0
  222. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/tools/__init__.py +0 -0
  223. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/tools/create_type.py +0 -0
  224. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/tools/merge_types.py +0 -0
  225. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/type.py +0 -0
  226. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/types/__init__.py +0 -0
  227. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/types/execution.py +0 -0
  228. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/types/fields/__init__.py +0 -0
  229. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/types/fields/resolver.py +0 -0
  230. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/types/graphql.py +0 -0
  231. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/types/info.py +0 -0
  232. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/types/nodes.py +0 -0
  233. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/types/type_resolver.py +0 -0
  234. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/types/types.py +0 -0
  235. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/union.py +0 -0
  236. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/unset.py +0 -0
  237. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/utils/__init__.py +0 -0
  238. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/utils/aio.py +0 -0
  239. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/utils/await_maybe.py +0 -0
  240. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/utils/dataclasses.py +0 -0
  241. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/utils/debug.py +0 -0
  242. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/utils/deprecations.py +0 -0
  243. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/utils/graphql_lexer.py +0 -0
  244. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/utils/importer.py +0 -0
  245. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/utils/inspect.py +0 -0
  246. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/utils/logging.py +0 -0
  247. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/utils/operation.py +0 -0
  248. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/utils/str_converters.py +0 -0
  249. {strawberry_graphql-0.223.0 → strawberry_graphql-0.224.0.dev1711748192}/strawberry/utils/typing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.223.0
3
+ Version: 0.224.0.dev1711748192
4
4
  Summary: A library for creating GraphQL APIs
5
5
  Home-page: https://strawberry.rocks/
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "strawberry-graphql"
3
3
  packages = [ { include = "strawberry" } ]
4
- version = "0.223.0"
4
+ version = "0.224.0.dev.1711748192"
5
5
  description = "A library for creating GraphQL APIs"
6
6
  authors = ["Patrick Arminio <patrick.arminio@gmail.com>"]
7
7
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  try:
2
2
  from . import pydantic
3
- except ImportError:
3
+ except ModuleNotFoundError:
4
4
  pass
5
5
  else:
6
6
  __all__ = ["pydantic"]
@@ -0,0 +1,277 @@
1
+ import dataclasses
2
+ from dataclasses import dataclass
3
+ from decimal import Decimal
4
+ from functools import cached_property
5
+ from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Type
6
+ from uuid import UUID
7
+
8
+ import pydantic
9
+ from pydantic import BaseModel
10
+ from pydantic.version import VERSION as PYDANTIC_VERSION
11
+
12
+ from strawberry.experimental.pydantic.exceptions import UnsupportedTypeError
13
+
14
+ if TYPE_CHECKING:
15
+ from pydantic.fields import FieldInfo
16
+
17
+ IS_PYDANTIC_V2: bool = PYDANTIC_VERSION.startswith("2.")
18
+ IS_PYDANTIC_V1: bool = not IS_PYDANTIC_V2
19
+
20
+
21
+ @dataclass
22
+ class CompatModelField:
23
+ name: str
24
+ type_: Any
25
+ outer_type_: Any
26
+ default: Any
27
+ default_factory: Optional[Callable[[], Any]]
28
+ required: bool
29
+ alias: Optional[str]
30
+ allow_none: bool
31
+ has_alias: bool
32
+ description: Optional[str]
33
+ _missing_type: Any
34
+ is_v1: bool
35
+
36
+ @property
37
+ def has_default_factory(self) -> bool:
38
+ return self.default_factory is not self._missing_type
39
+
40
+ @property
41
+ def has_default(self) -> bool:
42
+ return self.default is not self._missing_type
43
+
44
+
45
+ ATTR_TO_TYPE_MAP = {
46
+ "NoneStr": Optional[str],
47
+ "NoneBytes": Optional[bytes],
48
+ "StrBytes": None,
49
+ "NoneStrBytes": None,
50
+ "StrictStr": str,
51
+ "ConstrainedBytes": bytes,
52
+ "conbytes": bytes,
53
+ "ConstrainedStr": str,
54
+ "constr": str,
55
+ "EmailStr": str,
56
+ "PyObject": None,
57
+ "ConstrainedInt": int,
58
+ "conint": int,
59
+ "PositiveInt": int,
60
+ "NegativeInt": int,
61
+ "ConstrainedFloat": float,
62
+ "confloat": float,
63
+ "PositiveFloat": float,
64
+ "NegativeFloat": float,
65
+ "ConstrainedDecimal": Decimal,
66
+ "condecimal": Decimal,
67
+ "UUID1": UUID,
68
+ "UUID3": UUID,
69
+ "UUID4": UUID,
70
+ "UUID5": UUID,
71
+ "FilePath": None,
72
+ "DirectoryPath": None,
73
+ "Json": None,
74
+ "JsonWrapper": None,
75
+ "SecretStr": str,
76
+ "SecretBytes": bytes,
77
+ "StrictBool": bool,
78
+ "StrictInt": int,
79
+ "StrictFloat": float,
80
+ "PaymentCardNumber": None,
81
+ "ByteSize": None,
82
+ "AnyUrl": str,
83
+ "AnyHttpUrl": str,
84
+ "HttpUrl": str,
85
+ "PostgresDsn": str,
86
+ "RedisDsn": str,
87
+ }
88
+
89
+ ATTR_TO_TYPE_MAP_Pydantic_V2 = {
90
+ "EmailStr": str,
91
+ "SecretStr": str,
92
+ "SecretBytes": bytes,
93
+ "AnyUrl": str,
94
+ }
95
+
96
+ ATTR_TO_TYPE_MAP_Pydantic_Core_V2 = {
97
+ "MultiHostUrl": str,
98
+ }
99
+
100
+
101
+ def get_fields_map_for_v2() -> Dict[Any, Any]:
102
+ import pydantic_core
103
+
104
+ fields_map = {
105
+ getattr(pydantic, field_name): type
106
+ for field_name, type in ATTR_TO_TYPE_MAP_Pydantic_V2.items()
107
+ if hasattr(pydantic, field_name)
108
+ }
109
+ fields_map.update(
110
+ {
111
+ getattr(pydantic_core, field_name): type
112
+ for field_name, type in ATTR_TO_TYPE_MAP_Pydantic_Core_V2.items()
113
+ if hasattr(pydantic_core, field_name)
114
+ }
115
+ )
116
+
117
+ return fields_map
118
+
119
+
120
+ class PydanticV2Compat:
121
+ @property
122
+ def PYDANTIC_MISSING_TYPE(self) -> Any:
123
+ from pydantic_core import PydanticUndefined
124
+
125
+ return PydanticUndefined
126
+
127
+ def get_model_fields(self, model: Type[BaseModel]) -> Dict[str, CompatModelField]:
128
+ field_info: dict[str, FieldInfo] = model.model_fields
129
+ new_fields = {}
130
+ # Convert it into CompatModelField
131
+ for name, field in field_info.items():
132
+ new_fields[name] = CompatModelField(
133
+ name=name,
134
+ type_=field.annotation,
135
+ outer_type_=field.annotation,
136
+ default=field.default,
137
+ default_factory=field.default_factory,
138
+ required=field.is_required(),
139
+ alias=field.alias,
140
+ # v2 doesn't have allow_none
141
+ allow_none=False,
142
+ has_alias=field is not None,
143
+ description=field.description,
144
+ _missing_type=self.PYDANTIC_MISSING_TYPE,
145
+ is_v1=False,
146
+ )
147
+ return new_fields
148
+
149
+ @cached_property
150
+ def fields_map(self) -> Dict[Any, Any]:
151
+ return get_fields_map_for_v2()
152
+
153
+ def get_basic_type(self, type_: Any) -> Type[Any]:
154
+ if type_ in self.fields_map:
155
+ type_ = self.fields_map[type_]
156
+
157
+ if type_ is None:
158
+ raise UnsupportedTypeError()
159
+
160
+ if is_new_type(type_):
161
+ return new_type_supertype(type_)
162
+
163
+ return type_
164
+
165
+
166
+ class PydanticV1Compat:
167
+ @property
168
+ def PYDANTIC_MISSING_TYPE(self) -> Any:
169
+ return dataclasses.MISSING
170
+
171
+ def get_model_fields(self, model: Type[BaseModel]) -> Dict[str, CompatModelField]:
172
+ new_fields = {}
173
+ # Convert it into CompatModelField
174
+ for name, field in model.__fields__.items(): # type: ignore[attr-defined]
175
+ new_fields[name] = CompatModelField(
176
+ name=name,
177
+ type_=field.type_,
178
+ outer_type_=field.outer_type_,
179
+ default=field.default,
180
+ default_factory=field.default_factory,
181
+ required=field.required,
182
+ alias=field.alias,
183
+ allow_none=field.allow_none,
184
+ has_alias=field.has_alias,
185
+ description=field.field_info.description,
186
+ _missing_type=self.PYDANTIC_MISSING_TYPE,
187
+ is_v1=True,
188
+ )
189
+ return new_fields
190
+
191
+ @cached_property
192
+ def fields_map(self) -> Dict[Any, Any]:
193
+ if IS_PYDANTIC_V2:
194
+ return {
195
+ getattr(pydantic.v1, field_name): type
196
+ for field_name, type in ATTR_TO_TYPE_MAP.items()
197
+ if hasattr(pydantic.v1, field_name)
198
+ }
199
+
200
+ return {
201
+ getattr(pydantic, field_name): type
202
+ for field_name, type in ATTR_TO_TYPE_MAP.items()
203
+ if hasattr(pydantic, field_name)
204
+ }
205
+
206
+ def get_basic_type(self, type_: Any) -> Type[Any]:
207
+ if IS_PYDANTIC_V1:
208
+ # only pydantic v1 has these
209
+ if lenient_issubclass(type_, pydantic.ConstrainedInt):
210
+ return int
211
+ if lenient_issubclass(type_, pydantic.ConstrainedFloat):
212
+ return float
213
+ if lenient_issubclass(type_, pydantic.ConstrainedStr):
214
+ return str
215
+ if lenient_issubclass(type_, pydantic.ConstrainedList):
216
+ return List[self.get_basic_type(type_.item_type)] # type: ignore
217
+
218
+ if type_ in self.fields_map:
219
+ type_ = self.fields_map[type_]
220
+
221
+ if type_ is None:
222
+ raise UnsupportedTypeError()
223
+
224
+ if is_new_type(type_):
225
+ return new_type_supertype(type_)
226
+
227
+ return type_
228
+
229
+
230
+ class PydanticCompat:
231
+ def __init__(self, is_v2: bool):
232
+ if is_v2:
233
+ self._compat = PydanticV2Compat()
234
+ else:
235
+ self._compat = PydanticV1Compat() # type: ignore[assignment]
236
+
237
+ @classmethod
238
+ def from_model(cls, model: Type[BaseModel]) -> "PydanticCompat":
239
+ if hasattr(model, "model_fields"):
240
+ return cls(is_v2=True)
241
+
242
+ return cls(is_v2=False)
243
+
244
+ def __getattr__(self, name: str) -> Any:
245
+ return getattr(self._compat, name)
246
+
247
+
248
+ if IS_PYDANTIC_V2:
249
+ from typing_extensions import get_args, get_origin
250
+
251
+ from pydantic._internal._typing_extra import is_new_type
252
+ from pydantic._internal._utils import lenient_issubclass, smart_deepcopy
253
+
254
+ def new_type_supertype(type_: Any) -> Any:
255
+ return type_.__supertype__
256
+ else:
257
+ from pydantic.typing import ( # type: ignore[no-redef]
258
+ get_args,
259
+ get_origin,
260
+ is_new_type,
261
+ new_type_supertype,
262
+ )
263
+ from pydantic.utils import ( # type: ignore[no-redef]
264
+ lenient_issubclass,
265
+ smart_deepcopy,
266
+ )
267
+
268
+
269
+ __all__ = [
270
+ "PydanticCompat",
271
+ "is_new_type",
272
+ "lenient_issubclass",
273
+ "get_origin",
274
+ "get_args",
275
+ "new_type_supertype",
276
+ "smart_deepcopy",
277
+ ]
@@ -19,7 +19,7 @@ from pydantic import BaseModel
19
19
  from strawberry.auto import StrawberryAuto
20
20
  from strawberry.experimental.pydantic._compat import (
21
21
  CompatModelField,
22
- get_model_fields,
22
+ PydanticCompat,
23
23
  lenient_issubclass,
24
24
  )
25
25
  from strawberry.experimental.pydantic.utils import (
@@ -72,7 +72,8 @@ def error_type(
72
72
  all_fields: bool = False,
73
73
  ) -> Callable[..., Type]:
74
74
  def wrap(cls: Type) -> Type:
75
- model_fields = get_model_fields(model)
75
+ compat = PydanticCompat.from_model(model)
76
+ model_fields = compat.get_model_fields(model)
76
77
  fields_set = set(fields) if fields else set()
77
78
 
78
79
  if fields:
@@ -0,0 +1,88 @@
1
+ import builtins
2
+ from typing import Any, Union
3
+ from typing_extensions import Annotated
4
+
5
+ from pydantic import BaseModel
6
+
7
+ from strawberry.experimental.pydantic._compat import (
8
+ PydanticCompat,
9
+ get_args,
10
+ get_origin,
11
+ lenient_issubclass,
12
+ )
13
+ from strawberry.experimental.pydantic.exceptions import (
14
+ UnregisteredTypeException,
15
+ )
16
+ from strawberry.types.types import StrawberryObjectDefinition
17
+
18
+ try:
19
+ from types import UnionType as TypingUnionType
20
+ except ImportError:
21
+ import sys
22
+
23
+ if sys.version_info < (3, 10):
24
+ TypingUnionType = ()
25
+ else:
26
+ raise
27
+
28
+ try:
29
+ from typing import GenericAlias as TypingGenericAlias # type: ignore
30
+ except ImportError:
31
+ import sys
32
+
33
+ # python < 3.9 does not have GenericAlias (list[int], tuple[str, ...] and so on)
34
+ # we do this under a conditional to avoid a mypy :)
35
+ if sys.version_info < (3, 9):
36
+ TypingGenericAlias = ()
37
+ else:
38
+ raise
39
+
40
+
41
+ def replace_pydantic_types(type_: Any, is_input: bool) -> Any:
42
+ if lenient_issubclass(type_, BaseModel):
43
+ attr = "_strawberry_input_type" if is_input else "_strawberry_type"
44
+ if hasattr(type_, attr):
45
+ return getattr(type_, attr)
46
+ else:
47
+ raise UnregisteredTypeException(type_)
48
+ return type_
49
+
50
+
51
+ def replace_types_recursively(
52
+ type_: Any, is_input: bool, compat: PydanticCompat
53
+ ) -> Any:
54
+ """Runs the conversions recursively into the arguments of generic types if any"""
55
+ basic_type = compat.get_basic_type(type_)
56
+ replaced_type = replace_pydantic_types(basic_type, is_input)
57
+
58
+ origin = get_origin(type_)
59
+
60
+ if not origin or not hasattr(type_, "__args__"):
61
+ return replaced_type
62
+
63
+ converted = tuple(
64
+ replace_types_recursively(t, is_input=is_input, compat=compat)
65
+ for t in get_args(replaced_type)
66
+ )
67
+
68
+ if isinstance(replaced_type, TypingGenericAlias):
69
+ return TypingGenericAlias(origin, converted)
70
+ if isinstance(replaced_type, TypingUnionType):
71
+ return Union[converted]
72
+
73
+ # TODO: investigate if we could move the check for annotated to the top
74
+ if origin is Annotated and converted:
75
+ converted = (converted[0],)
76
+
77
+ replaced_type = replaced_type.copy_with(converted)
78
+
79
+ if isinstance(replaced_type, StrawberryObjectDefinition):
80
+ # TODO: Not sure if this is necessary. No coverage in tests
81
+ # TODO: Unnecessary with StrawberryObject
82
+ replaced_type = builtins.type(
83
+ replaced_type.name,
84
+ (),
85
+ {"__strawberry_definition__": replaced_type},
86
+ )
87
+
88
+ return replaced_type
@@ -19,9 +19,8 @@ from typing import (
19
19
  from strawberry.annotation import StrawberryAnnotation
20
20
  from strawberry.auto import StrawberryAuto
21
21
  from strawberry.experimental.pydantic._compat import (
22
- IS_PYDANTIC_V1,
23
22
  CompatModelField,
24
- get_model_fields,
23
+ PydanticCompat,
25
24
  )
26
25
  from strawberry.experimental.pydantic.conversion import (
27
26
  convert_pydantic_model_to_strawberry_class,
@@ -44,10 +43,12 @@ if TYPE_CHECKING:
44
43
  from graphql import GraphQLResolveInfo
45
44
 
46
45
 
47
- def get_type_for_field(field: CompatModelField, is_input: bool): # noqa: ANN201
46
+ def get_type_for_field(field: CompatModelField, is_input: bool, compat: PydanticCompat): # noqa: ANN201
48
47
  outer_type = field.outer_type_
49
- replaced_type = replace_types_recursively(outer_type, is_input)
50
- if IS_PYDANTIC_V1:
48
+
49
+ replaced_type = replace_types_recursively(outer_type, is_input, compat=compat)
50
+
51
+ if field.is_v1:
51
52
  # only pydantic v1 has this Optional logic
52
53
  should_add_optional: bool = field.allow_none
53
54
  if should_add_optional:
@@ -62,9 +63,10 @@ def _build_dataclass_creation_fields(
62
63
  existing_fields: Dict[str, StrawberryField],
63
64
  auto_fields_set: Set[str],
64
65
  use_pydantic_alias: bool,
66
+ compat: PydanticCompat,
65
67
  ) -> DataclassCreationFields:
66
68
  field_type = (
67
- get_type_for_field(field, is_input)
69
+ get_type_for_field(field, is_input, compat=compat)
68
70
  if field.name in auto_fields_set
69
71
  else existing_fields[field.name].type
70
72
  )
@@ -129,7 +131,8 @@ def type(
129
131
  use_pydantic_alias: bool = True,
130
132
  ) -> Callable[..., Type[StrawberryTypeFromPydantic[PydanticModel]]]:
131
133
  def wrap(cls: Any) -> Type[StrawberryTypeFromPydantic[PydanticModel]]:
132
- model_fields = get_model_fields(model)
134
+ compat = PydanticCompat.from_model(model)
135
+ model_fields = compat.get_model_fields(model)
133
136
  original_fields_set = set(fields) if fields else set()
134
137
 
135
138
  if fields:
@@ -182,7 +185,12 @@ def type(
182
185
 
183
186
  all_model_fields: List[DataclassCreationFields] = [
184
187
  _build_dataclass_creation_fields(
185
- field, is_input, extra_fields_dict, auto_fields_set, use_pydantic_alias
188
+ field,
189
+ is_input,
190
+ extra_fields_dict,
191
+ auto_fields_set,
192
+ use_pydantic_alias,
193
+ compat=compat,
186
194
  )
187
195
  for field_name, field in model_fields.items()
188
196
  if field_name in fields_set
@@ -14,9 +14,8 @@ from typing import (
14
14
  )
15
15
 
16
16
  from strawberry.experimental.pydantic._compat import (
17
- PYDANTIC_MISSING_TYPE,
18
17
  CompatModelField,
19
- get_model_fields,
18
+ PydanticCompat,
20
19
  smart_deepcopy,
21
20
  )
22
21
  from strawberry.experimental.pydantic.exceptions import (
@@ -83,12 +82,8 @@ def get_default_factory_for_field(
83
82
  Returns optionally a NoArgAnyCallable representing a default_factory parameter
84
83
  """
85
84
  # replace dataclasses.MISSING with our own UNSET to make comparisons easier
86
- default_factory = (
87
- field.default_factory
88
- if field.default_factory is not PYDANTIC_MISSING_TYPE
89
- else UNSET
90
- )
91
- default = field.default if field.default is not PYDANTIC_MISSING_TYPE else UNSET
85
+ default_factory = field.default_factory if field.has_default_factory else UNSET
86
+ default = field.default if field.has_default else UNSET
92
87
 
93
88
  has_factory = default_factory is not None and default_factory is not UNSET
94
89
  has_default = default is not None and default is not UNSET
@@ -126,8 +121,9 @@ def get_default_factory_for_field(
126
121
  def ensure_all_auto_fields_in_pydantic(
127
122
  model: Type[BaseModel], auto_fields: Set[str], cls_name: str
128
123
  ) -> None:
124
+ compat = PydanticCompat.from_model(model)
129
125
  # Raise error if user defined a strawberry.auto field not present in the model
130
- non_existing_fields = list(auto_fields - get_model_fields(model).keys())
126
+ non_existing_fields = list(auto_fields - compat.get_model_fields(model).keys())
131
127
 
132
128
  if non_existing_fields:
133
129
  raise AutoFieldsNotInBaseModelError(
@@ -1,103 +0,0 @@
1
- import dataclasses
2
- from dataclasses import dataclass
3
- from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Type
4
-
5
- from pydantic import BaseModel
6
- from pydantic.version import VERSION as PYDANTIC_VERSION
7
-
8
- if TYPE_CHECKING:
9
- from pydantic.fields import FieldInfo
10
-
11
- IS_PYDANTIC_V2: bool = PYDANTIC_VERSION.startswith("2.")
12
- IS_PYDANTIC_V1: bool = not IS_PYDANTIC_V2
13
-
14
-
15
- @dataclass
16
- class CompatModelField:
17
- name: str
18
- type_: Any
19
- outer_type_: Any
20
- default: Any
21
- default_factory: Optional[Callable[[], Any]]
22
- required: bool
23
- alias: Optional[str]
24
- allow_none: bool
25
- has_alias: bool
26
- description: Optional[str]
27
-
28
-
29
- if IS_PYDANTIC_V2:
30
- from typing_extensions import get_args, get_origin
31
-
32
- from pydantic._internal._typing_extra import is_new_type
33
- from pydantic._internal._utils import lenient_issubclass, smart_deepcopy
34
- from pydantic_core import PydanticUndefined
35
-
36
- PYDANTIC_MISSING_TYPE = PydanticUndefined
37
-
38
- def new_type_supertype(type_: Any) -> Any:
39
- return type_.__supertype__
40
-
41
- def get_model_fields(model: Type[BaseModel]) -> Dict[str, CompatModelField]:
42
- field_info: dict[str, FieldInfo] = model.model_fields
43
- new_fields = {}
44
- # Convert it into CompatModelField
45
- for name, field in field_info.items():
46
- new_fields[name] = CompatModelField(
47
- name=name,
48
- type_=field.annotation,
49
- outer_type_=field.annotation,
50
- default=field.default,
51
- default_factory=field.default_factory,
52
- required=field.is_required(),
53
- alias=field.alias,
54
- # v2 doesn't have allow_none
55
- allow_none=False,
56
- has_alias=field is not None,
57
- description=field.description,
58
- )
59
- return new_fields
60
-
61
- else:
62
- from pydantic.typing import ( # type: ignore[no-redef]
63
- get_args,
64
- get_origin,
65
- is_new_type,
66
- new_type_supertype,
67
- )
68
- from pydantic.utils import ( # type: ignore[no-redef]
69
- lenient_issubclass,
70
- smart_deepcopy,
71
- )
72
-
73
- PYDANTIC_MISSING_TYPE = dataclasses.MISSING # type: ignore[assignment]
74
-
75
- def get_model_fields(model: Type[BaseModel]) -> Dict[str, CompatModelField]:
76
- new_fields = {}
77
- # Convert it into CompatModelField
78
- for name, field in model.__fields__.items(): # type: ignore[attr-defined]
79
- new_fields[name] = CompatModelField(
80
- name=name,
81
- type_=field.type_,
82
- outer_type_=field.outer_type_,
83
- default=field.default,
84
- default_factory=field.default_factory,
85
- required=field.required,
86
- alias=field.alias,
87
- allow_none=field.allow_none,
88
- has_alias=field.has_alias,
89
- description=field.field_info.description,
90
- )
91
- return new_fields
92
-
93
-
94
- __all__ = [
95
- "smart_deepcopy",
96
- "lenient_issubclass",
97
- "get_args",
98
- "get_origin",
99
- "is_new_type",
100
- "new_type_supertype",
101
- "get_model_fields",
102
- "PYDANTIC_MISSING_TYPE",
103
- ]