strawberry-graphql 0.226.2__tar.gz → 0.227.0.dev1713463204__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 (250) hide show
  1. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/PKG-INFO +1 -1
  2. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/pyproject.toml +7 -7
  3. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/__init__.py +2 -1
  4. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/ext/mypy_plugin.py +1 -24
  5. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/object_type.py +54 -0
  6. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema/execute.py +2 -0
  7. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema/schema.py +11 -0
  8. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema/schema_converter.py +33 -0
  9. strawberry_graphql-0.227.0.dev1713463204/strawberry/schema/validation_rules/one_of.py +80 -0
  10. strawberry_graphql-0.227.0.dev1713463204/strawberry/schema_directives.py +9 -0
  11. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/type.py +4 -0
  12. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/types/types.py +11 -0
  13. strawberry_graphql-0.227.0.dev1713463204/strawberry/utils/__init__.py +0 -0
  14. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/LICENSE +0 -0
  15. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/README.md +0 -0
  16. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/__main__.py +0 -0
  17. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/aiohttp/__init__.py +0 -0
  18. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/aiohttp/handlers/__init__.py +0 -0
  19. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/aiohttp/handlers/graphql_transport_ws_handler.py +0 -0
  20. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/aiohttp/handlers/graphql_ws_handler.py +0 -0
  21. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/aiohttp/test/__init__.py +0 -0
  22. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/aiohttp/test/client.py +0 -0
  23. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/aiohttp/views.py +0 -0
  24. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/annotation.py +0 -0
  25. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/arguments.py +0 -0
  26. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/asgi/__init__.py +0 -0
  27. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/asgi/handlers/__init__.py +0 -0
  28. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/asgi/handlers/graphql_transport_ws_handler.py +0 -0
  29. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/asgi/handlers/graphql_ws_handler.py +0 -0
  30. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/asgi/test/__init__.py +0 -0
  31. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/asgi/test/client.py +0 -0
  32. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/auto.py +0 -0
  33. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/chalice/__init__.py +0 -0
  34. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/chalice/views.py +0 -0
  35. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/channels/__init__.py +0 -0
  36. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/channels/handlers/base.py +0 -0
  37. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/channels/handlers/graphql_transport_ws_handler.py +0 -0
  38. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/channels/handlers/graphql_ws_handler.py +0 -0
  39. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/channels/handlers/http_handler.py +0 -0
  40. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/channels/handlers/ws_handler.py +0 -0
  41. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/channels/router.py +0 -0
  42. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/channels/testing.py +0 -0
  43. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/__init__.py +0 -0
  44. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/app.py +0 -0
  45. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/commands/__init__.py +0 -0
  46. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/commands/codegen.py +0 -0
  47. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/commands/export_schema.py +0 -0
  48. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/commands/schema_codegen.py +0 -0
  49. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/commands/server.py +0 -0
  50. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/commands/upgrade/__init__.py +0 -0
  51. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/commands/upgrade/_fake_progress.py +0 -0
  52. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/commands/upgrade/_run_codemod.py +0 -0
  53. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/constants.py +0 -0
  54. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/debug_server.py +0 -0
  55. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/utils/__init__.py +0 -0
  56. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/cli/utils/load_schema.py +0 -0
  57. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/codegen/__init__.py +0 -0
  58. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/codegen/exceptions.py +0 -0
  59. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/codegen/plugins/__init__.py +0 -0
  60. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/codegen/plugins/print_operation.py +0 -0
  61. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/codegen/plugins/python.py +0 -0
  62. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/codegen/plugins/typescript.py +0 -0
  63. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/codegen/query_codegen.py +0 -0
  64. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/codegen/types.py +0 -0
  65. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/codemods/__init__.py +0 -0
  66. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/codemods/annotated_unions.py +0 -0
  67. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/custom_scalar.py +0 -0
  68. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/dataloader.py +0 -0
  69. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/directive.py +0 -0
  70. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/django/__init__.py +0 -0
  71. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/django/apps.py +0 -0
  72. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/django/context.py +0 -0
  73. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/django/test/__init__.py +0 -0
  74. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/django/test/client.py +0 -0
  75. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/django/views.py +0 -0
  76. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/enum.py +0 -0
  77. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/__init__.py +0 -0
  78. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/conflicting_arguments.py +0 -0
  79. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/duplicated_type_name.py +0 -0
  80. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/exception.py +0 -0
  81. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/exception_source.py +0 -0
  82. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/handler.py +0 -0
  83. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/invalid_argument_type.py +0 -0
  84. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/invalid_union_type.py +0 -0
  85. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/missing_arguments_annotations.py +0 -0
  86. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/missing_field_annotation.py +0 -0
  87. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/missing_return_annotation.py +0 -0
  88. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/not_a_strawberry_enum.py +0 -0
  89. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/object_is_not_a_class.py +0 -0
  90. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/object_is_not_an_enum.py +0 -0
  91. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/permission_fail_silently_requires_optional.py +0 -0
  92. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/private_strawberry_field.py +0 -0
  93. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/scalar_already_registered.py +0 -0
  94. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/syntax.py +0 -0
  95. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/unresolved_field_type.py +0 -0
  96. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/utils/__init__.py +0 -0
  97. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/exceptions/utils/source_finder.py +0 -0
  98. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/experimental/__init__.py +0 -0
  99. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/experimental/pydantic/__init__.py +0 -0
  100. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/experimental/pydantic/_compat.py +0 -0
  101. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/experimental/pydantic/conversion.py +0 -0
  102. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/experimental/pydantic/conversion_types.py +0 -0
  103. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/experimental/pydantic/error_type.py +0 -0
  104. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/experimental/pydantic/exceptions.py +0 -0
  105. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/experimental/pydantic/fields.py +0 -0
  106. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/experimental/pydantic/object_type.py +0 -0
  107. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/experimental/pydantic/utils.py +0 -0
  108. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/ext/LICENSE +0 -0
  109. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/ext/__init__.py +0 -0
  110. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/ext/dataclasses/LICENSE +0 -0
  111. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/ext/dataclasses/__init__.py +0 -0
  112. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/ext/dataclasses/dataclasses.py +0 -0
  113. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/__init__.py +0 -0
  114. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/add_validation_rules.py +0 -0
  115. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/base_extension.py +0 -0
  116. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/context.py +0 -0
  117. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/directives.py +0 -0
  118. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/disable_validation.py +0 -0
  119. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/field_extension.py +0 -0
  120. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/mask_errors.py +0 -0
  121. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/max_aliases.py +0 -0
  122. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/max_tokens.py +0 -0
  123. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/parser_cache.py +0 -0
  124. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/pyinstrument.py +0 -0
  125. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/query_depth_limiter.py +0 -0
  126. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/runner.py +0 -0
  127. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/tracing/__init__.py +0 -0
  128. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/tracing/apollo.py +0 -0
  129. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/tracing/datadog.py +0 -0
  130. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/tracing/opentelemetry.py +0 -0
  131. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/tracing/sentry.py +0 -0
  132. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/tracing/utils.py +0 -0
  133. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/utils.py +0 -0
  134. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/extensions/validation_cache.py +0 -0
  135. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/fastapi/__init__.py +0 -0
  136. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/fastapi/context.py +0 -0
  137. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/fastapi/handlers/__init__.py +0 -0
  138. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/fastapi/handlers/graphql_transport_ws_handler.py +0 -0
  139. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/fastapi/handlers/graphql_ws_handler.py +0 -0
  140. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/fastapi/router.py +0 -0
  141. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/federation/__init__.py +0 -0
  142. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/federation/argument.py +0 -0
  143. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/federation/enum.py +0 -0
  144. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/federation/field.py +0 -0
  145. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/federation/mutation.py +0 -0
  146. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/federation/object_type.py +0 -0
  147. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/federation/scalar.py +0 -0
  148. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/federation/schema.py +0 -0
  149. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/federation/schema_directive.py +0 -0
  150. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/federation/schema_directives.py +0 -0
  151. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/federation/types.py +0 -0
  152. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/federation/union.py +0 -0
  153. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/field.py +0 -0
  154. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/field_extensions/__init__.py +0 -0
  155. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/field_extensions/input_mutation.py +0 -0
  156. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/file_uploads/__init__.py +0 -0
  157. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/file_uploads/scalars.py +0 -0
  158. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/file_uploads/utils.py +0 -0
  159. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/flask/__init__.py +0 -0
  160. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/flask/views.py +0 -0
  161. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/http/__init__.py +0 -0
  162. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/http/async_base_view.py +0 -0
  163. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/http/base.py +0 -0
  164. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/http/exceptions.py +0 -0
  165. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/http/ides.py +0 -0
  166. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/http/sync_base_view.py +0 -0
  167. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/http/temporal_response.py +0 -0
  168. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/http/types.py +0 -0
  169. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/http/typevars.py +0 -0
  170. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/lazy_type.py +0 -0
  171. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/litestar/__init__.py +0 -0
  172. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/litestar/controller.py +0 -0
  173. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/litestar/handlers/graphql_transport_ws_handler.py +0 -0
  174. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/litestar/handlers/graphql_ws_handler.py +0 -0
  175. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/mutation.py +0 -0
  176. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/parent.py +0 -0
  177. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/permission.py +0 -0
  178. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/printer/__init__.py +0 -0
  179. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/printer/ast_from_value.py +0 -0
  180. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/printer/printer.py +0 -0
  181. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/private.py +0 -0
  182. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/py.typed +0 -0
  183. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/quart/__init__.py +0 -0
  184. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/quart/views.py +0 -0
  185. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/relay/__init__.py +0 -0
  186. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/relay/exceptions.py +0 -0
  187. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/relay/fields.py +0 -0
  188. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/relay/types.py +0 -0
  189. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/relay/utils.py +0 -0
  190. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/resolvers.py +0 -0
  191. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/sanic/__init__.py +0 -0
  192. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/sanic/context.py +0 -0
  193. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/sanic/utils.py +0 -0
  194. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/sanic/views.py +0 -0
  195. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/scalars.py +0 -0
  196. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema/__init__.py +0 -0
  197. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema/base.py +0 -0
  198. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema/compat.py +0 -0
  199. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema/config.py +0 -0
  200. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema/exceptions.py +0 -0
  201. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema/name_converter.py +0 -0
  202. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema/types/__init__.py +0 -0
  203. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema/types/base_scalars.py +0 -0
  204. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema/types/concrete_type.py +0 -0
  205. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema/types/scalar.py +0 -0
  206. {strawberry_graphql-0.226.2/strawberry/subscriptions/protocols → strawberry_graphql-0.227.0.dev1713463204/strawberry/schema/validation_rules}/__init__.py +0 -0
  207. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema_codegen/__init__.py +0 -0
  208. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/schema_directive.py +0 -0
  209. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/starlite/__init__.py +0 -0
  210. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/starlite/controller.py +0 -0
  211. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/starlite/handlers/graphql_transport_ws_handler.py +0 -0
  212. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/starlite/handlers/graphql_ws_handler.py +0 -0
  213. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/static/apollo-sandbox.html +0 -0
  214. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/static/graphiql.html +0 -0
  215. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/static/pathfinder.html +0 -0
  216. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/subscriptions/__init__.py +0 -0
  217. {strawberry_graphql-0.226.2/strawberry/types/fields → strawberry_graphql-0.227.0.dev1713463204/strawberry/subscriptions/protocols}/__init__.py +0 -0
  218. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/subscriptions/protocols/graphql_transport_ws/__init__.py +0 -0
  219. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py +0 -0
  220. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/subscriptions/protocols/graphql_transport_ws/types.py +0 -0
  221. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/subscriptions/protocols/graphql_ws/__init__.py +0 -0
  222. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/subscriptions/protocols/graphql_ws/handlers.py +0 -0
  223. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/subscriptions/protocols/graphql_ws/types.py +0 -0
  224. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/test/__init__.py +0 -0
  225. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/test/client.py +0 -0
  226. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/tools/__init__.py +0 -0
  227. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/tools/create_type.py +0 -0
  228. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/tools/merge_types.py +0 -0
  229. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/types/__init__.py +0 -0
  230. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/types/execution.py +0 -0
  231. {strawberry_graphql-0.226.2/strawberry/utils → strawberry_graphql-0.227.0.dev1713463204/strawberry/types/fields}/__init__.py +0 -0
  232. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/types/fields/resolver.py +0 -0
  233. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/types/graphql.py +0 -0
  234. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/types/info.py +0 -0
  235. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/types/nodes.py +0 -0
  236. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/types/type_resolver.py +0 -0
  237. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/union.py +0 -0
  238. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/unset.py +0 -0
  239. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/utils/aio.py +0 -0
  240. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/utils/await_maybe.py +0 -0
  241. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/utils/dataclasses.py +0 -0
  242. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/utils/debug.py +0 -0
  243. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/utils/deprecations.py +0 -0
  244. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/utils/graphql_lexer.py +0 -0
  245. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/utils/importer.py +0 -0
  246. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/utils/inspect.py +0 -0
  247. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/utils/logging.py +0 -0
  248. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/utils/operation.py +0 -0
  249. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/utils/str_converters.py +0 -0
  250. {strawberry_graphql-0.226.2 → strawberry_graphql-0.227.0.dev1713463204}/strawberry/utils/typing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.226.2
3
+ Version: 0.227.0.dev1713463204
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.226.2"
4
+ version = "0.227.0.dev.1713463204"
5
5
  description = "A library for creating GraphQL APIs"
6
6
  authors = ["Patrick Arminio <patrick.arminio@gmail.com>"]
7
7
  license = "MIT"
@@ -64,10 +64,10 @@ pyinstrument = {version = ">=4.0.0", optional = true}
64
64
 
65
65
  [tool.poetry.group.dev.dependencies]
66
66
  asgiref = "^3.2"
67
- ddtrace = ">=1.6.4"
67
+ ddtrace = ">=1.6.4,<3.0.0"
68
68
  email-validator = {version = ">=1.1.3,<3.0.0", optional = false}
69
69
  freezegun = "^1.2.1"
70
- libcst = {version = ">=0.4.7", optional = false}
70
+ libcst = {version = ">=0.4.7,<1.2.0", optional = false}
71
71
  MarkupSafe = "2.1.3"
72
72
  nox = "^2023.4.22"
73
73
  nox-poetry = "^1.0.3"
@@ -76,7 +76,7 @@ opentelemetry-sdk = "<2"
76
76
  pygments = "^2.3"
77
77
  pyinstrument = {version = ">=4.0.0", optional = false}
78
78
  pytest = "^7.2"
79
- pytest-asyncio = ">=0.20.3"
79
+ pytest-asyncio = ">=0.20.3,<0.24.0"
80
80
  pytest-codspeed = "^2.0.1"
81
81
  pytest-cov = "^4.0.0"
82
82
  pytest-emoji = "^0.2.0"
@@ -84,11 +84,11 @@ pytest-mock = "^3.10"
84
84
  pytest-snapshot = "^0.9.0"
85
85
  pytest-xdist = {extras = ["psutil"], version = "^3.1.0"}
86
86
  python-multipart = ">=0.0.7"
87
- rich = {version = ">=12.5.1", optional = false}
87
+ rich = {version = ">=12.5.1,<14.0.0", optional = false}
88
88
  sanic-testing = ">=22.9,<24.0"
89
89
  sentry-sdk = "^1.39.2"
90
90
  typer = {version = ">=0.7.0", optional = false}
91
- types-aiofiles = ">=22.1"
91
+ types-aiofiles = ">=22.1,<24.0"
92
92
  types-certifi = "^2021.10.8"
93
93
  types-chardet = "^5.0.4"
94
94
  types-freezegun = "^1.1.9"
@@ -98,7 +98,7 @@ types-typed-ast = "^1.5.8"
98
98
  types-ujson = "^5.6.0"
99
99
  types-protobuf = "^4.23.0.1"
100
100
  mypy = "1.9.0"
101
- pytest-mypy-plugins = "3.0.0"
101
+ pytest-mypy-plugins = ">=1.10,<4.0"
102
102
  poetry-plugin-export = "^1.6.0"
103
103
  # another bug in poetry
104
104
  urllib3 = "<2"
@@ -7,7 +7,7 @@ from .enum import enum, enum_value
7
7
  from .field import field
8
8
  from .lazy_type import LazyType, lazy
9
9
  from .mutation import mutation, subscription
10
- from .object_type import asdict, input, interface, type
10
+ from .object_type import asdict, input, interface, one_of_input, type
11
11
  from .parent import Parent
12
12
  from .permission import BasePermission
13
13
  from .private import Private
@@ -38,6 +38,7 @@ __all__ = [
38
38
  "federation",
39
39
  "field",
40
40
  "input",
41
+ "one_of_input",
41
42
  "interface",
42
43
  "mutation",
43
44
  "scalar",
@@ -11,7 +11,6 @@ from typing import (
11
11
  List,
12
12
  Optional,
13
13
  Set,
14
- Tuple,
15
14
  Union,
16
15
  cast,
17
16
  )
@@ -60,16 +59,11 @@ try:
60
59
  except ImportError:
61
60
  TypeVarDef = TypeVarType
62
61
 
63
- PYDANTIC_VERSION: Optional[Tuple[int, ...]] = None
64
-
65
62
  # To be compatible with user who don't use pydantic
66
63
  try:
67
- import pydantic
68
64
  from pydantic.mypy import METADATA_KEY as PYDANTIC_METADATA_KEY
69
65
  from pydantic.mypy import PydanticModelField
70
66
 
71
- PYDANTIC_VERSION = tuple(map(int, pydantic.__version__.split(".")))
72
-
73
67
  from strawberry.experimental.pydantic._compat import IS_PYDANTIC_V1
74
68
  except ImportError:
75
69
  PYDANTIC_METADATA_KEY = ""
@@ -470,11 +464,6 @@ def strawberry_pydantic_class_callback(ctx: ClassDefContext) -> None:
470
464
  return_type=model_type,
471
465
  )
472
466
  else:
473
- extra = {}
474
-
475
- if PYDANTIC_VERSION and PYDANTIC_VERSION >= (2, 7, 0):
476
- extra["api"] = ctx.api
477
-
478
467
  add_method(
479
468
  ctx,
480
469
  "to_pydantic",
@@ -485,7 +474,6 @@ def strawberry_pydantic_class_callback(ctx: ClassDefContext) -> None:
485
474
  typed=True,
486
475
  force_optional=False,
487
476
  use_alias=True,
488
- **extra,
489
477
  )
490
478
  for f in missing_pydantic_fields
491
479
  ],
@@ -499,23 +487,12 @@ def strawberry_pydantic_class_callback(ctx: ClassDefContext) -> None:
499
487
  initializer=None,
500
488
  kind=ARG_OPT,
501
489
  )
502
- extra_type = ctx.api.named_type(
503
- "builtins.dict",
504
- [ctx.api.named_type("builtins.str"), AnyType(TypeOfAny.explicit)],
505
- )
506
-
507
- extra_argument = Argument(
508
- variable=Var(name="extra", type=UnionType([NoneType(), extra_type])),
509
- type_annotation=UnionType([NoneType(), extra_type]),
510
- initializer=None,
511
- kind=ARG_OPT,
512
- )
513
490
 
514
491
  add_static_method_to_class(
515
492
  ctx.api,
516
493
  ctx.cls,
517
494
  name="from_pydantic",
518
- args=[model_argument, extra_argument],
495
+ args=[model_argument],
519
496
  return_type=fill_typevars(ctx.cls.info),
520
497
  )
521
498
 
@@ -264,6 +264,60 @@ def type(
264
264
  return wrap(cls)
265
265
 
266
266
 
267
+ @overload
268
+ @dataclass_transform(
269
+ order_default=True, kw_only_default=True, field_specifiers=(field, StrawberryField)
270
+ )
271
+ def one_of_input(
272
+ cls: T,
273
+ *,
274
+ name: Optional[str] = None,
275
+ description: Optional[str] = None,
276
+ directives: Optional[Sequence[object]] = (),
277
+ ) -> T:
278
+ ...
279
+
280
+
281
+ @overload
282
+ @dataclass_transform(
283
+ order_default=True, kw_only_default=True, field_specifiers=(field, StrawberryField)
284
+ )
285
+ def one_of_input(
286
+ *,
287
+ name: Optional[str] = None,
288
+ description: Optional[str] = None,
289
+ directives: Optional[Sequence[object]] = (),
290
+ ) -> Callable[[T], T]:
291
+ ...
292
+
293
+
294
+ def one_of_input(
295
+ cls: Optional[T] = None,
296
+ *,
297
+ name: Optional[str] = None,
298
+ description: Optional[str] = None,
299
+ directives: Optional[Sequence[object]] = (),
300
+ ):
301
+ """Annotates a class as a GraphQL Input type with the @oneOf directive.
302
+ Example usage:
303
+ >>> @strawberry.one_of_input
304
+ >>> class X:
305
+ >>> field_abc: str = "ABC"
306
+ """
307
+
308
+ from strawberry.schema_directives import OneOf
309
+
310
+ directives = (*(directives or tuple()), OneOf())
311
+
312
+ return type( # type: ignore # not sure why mypy complains here
313
+ cls,
314
+ name=name,
315
+ description=description,
316
+ directives=directives,
317
+ is_input=True,
318
+ )
319
+
320
+
267
321
  @overload
268
322
  @dataclass_transform(
269
323
  order_default=True, kw_only_default=True, field_specifiers=(field, StrawberryField)
@@ -23,6 +23,7 @@ from graphql.validation import validate
23
23
 
24
24
  from strawberry.exceptions import MissingQueryError
25
25
  from strawberry.extensions.runner import SchemaExtensionsRunner
26
+ from strawberry.schema.validation_rules.one_of import OneOfInputValidationRule
26
27
  from strawberry.types import ExecutionResult
27
28
 
28
29
  from .exceptions import InvalidOperationTypeError
@@ -55,6 +56,7 @@ def validate_document(
55
56
  document: DocumentNode,
56
57
  validation_rules: Tuple[Type[ASTValidationRule], ...],
57
58
  ) -> List[GraphQLError]:
59
+ validation_rules += (OneOfInputValidationRule,)
58
60
  return validate(
59
61
  schema,
60
62
  document,
@@ -16,6 +16,8 @@ from typing import (
16
16
  )
17
17
 
18
18
  from graphql import (
19
+ GraphQLBoolean,
20
+ GraphQLField,
19
21
  GraphQLNamedType,
20
22
  GraphQLNonNull,
21
23
  GraphQLSchema,
@@ -168,6 +170,7 @@ class Schema(BaseSchema):
168
170
 
169
171
  self._warn_for_federation_directives()
170
172
  self._resolve_node_ids()
173
+ self._extend_introspection()
171
174
 
172
175
  # Validate schema early because we want developers to know about
173
176
  # possible issues as soon as possible
@@ -375,6 +378,14 @@ class Schema(BaseSchema):
375
378
  stacklevel=3,
376
379
  )
377
380
 
381
+ def _extend_introspection(self):
382
+ def _resolve_is_one_of(obj: Any, info: Any) -> bool:
383
+ return obj.extensions["strawberry-definition"].is_one_of
384
+
385
+ instrospection_type = self._schema.type_map["__Type"]
386
+ instrospection_type.fields["isOneOf"] = GraphQLField(GraphQLBoolean) # type: ignore[attr-defined]
387
+ instrospection_type.fields["isOneOf"].resolve = _resolve_is_one_of # type: ignore[attr-defined]
388
+
378
389
  def as_str(self) -> str:
379
390
  return print_schema(self)
380
391
 
@@ -26,6 +26,7 @@ from graphql import (
26
26
  GraphQLDirective,
27
27
  GraphQLEnumType,
28
28
  GraphQLEnumValue,
29
+ GraphQLError,
29
30
  GraphQLField,
30
31
  GraphQLInputField,
31
32
  GraphQLInputObjectType,
@@ -410,6 +411,37 @@ class GraphQLCoreConverter:
410
411
  assert isinstance(graphql_object_type, GraphQLInputObjectType) # For mypy
411
412
  return graphql_object_type
412
413
 
414
+ def check_one_of(value: dict[str, Any]) -> dict[str, Any]:
415
+ if len(value) != 1:
416
+ raise GraphQLError(
417
+ f"OneOf Input Object '{type_name}' must specify exactly one key."
418
+ )
419
+
420
+ first_key, first_value = next(iter(value.items()))
421
+
422
+ if first_value is None or first_value is UNSET:
423
+ raise GraphQLError(
424
+ f"Value for member field '{first_key}' must be non-null"
425
+ )
426
+
427
+ # We are populating all missing keys with `None`, so users
428
+ # don't have to set an explicit default for the input type
429
+ # The alternative is to tell them to use `UNSET`, but it looks
430
+ # a bit unfriendly to use
431
+
432
+ for field in type_definition.fields:
433
+ name = self.config.name_converter.from_field(field)
434
+ if name not in value:
435
+ value[name] = None
436
+
437
+ return value
438
+
439
+ out_type = (
440
+ check_one_of
441
+ if type_definition.is_input and type_definition.is_one_of
442
+ else None
443
+ )
444
+
413
445
  graphql_object_type = GraphQLInputObjectType(
414
446
  name=type_name,
415
447
  fields=lambda: self.get_graphql_input_fields(type_definition),
@@ -417,6 +449,7 @@ class GraphQLCoreConverter:
417
449
  extensions={
418
450
  GraphQLCoreConverter.DEFINITION_BACKREF: type_definition,
419
451
  },
452
+ out_type=out_type,
420
453
  )
421
454
 
422
455
  self.type_map[type_name] = ConcreteType(
@@ -0,0 +1,80 @@
1
+ from typing import Any
2
+
3
+ from graphql import (
4
+ ExecutableDefinitionNode,
5
+ GraphQLError,
6
+ GraphQLNamedType,
7
+ ObjectValueNode,
8
+ ValidationContext,
9
+ ValidationRule,
10
+ VariableDefinitionNode,
11
+ get_named_type,
12
+ )
13
+
14
+
15
+ class OneOfInputValidationRule(ValidationRule):
16
+ def __init__(self, validation_context: ValidationContext) -> None:
17
+ super().__init__(validation_context)
18
+
19
+ def enter_operation_definition(
20
+ self, node: ExecutableDefinitionNode, *_args: Any
21
+ ) -> None:
22
+ self.variable_definitions: dict[str, VariableDefinitionNode] = {}
23
+
24
+ def enter_variable_definition(
25
+ self, node: VariableDefinitionNode, *_args: Any
26
+ ) -> None:
27
+ self.variable_definitions[node.variable.name.value] = node
28
+
29
+ def enter_object_value(self, node: ObjectValueNode, *_args: Any) -> None:
30
+ type_ = get_named_type(self.context.get_input_type())
31
+
32
+ if not type_:
33
+ return
34
+
35
+ strawberry_type = type_.extensions.get("strawberry-definition")
36
+
37
+ if strawberry_type and strawberry_type.is_one_of:
38
+ self.validate_one_of(node, type_)
39
+
40
+ def validate_one_of(self, node: ObjectValueNode, type: GraphQLNamedType) -> None:
41
+ field_node_map = {field.name.value: field for field in node.fields}
42
+ keys = list(field_node_map.keys())
43
+ is_not_exactly_one_field = len(keys) != 1
44
+
45
+ if is_not_exactly_one_field:
46
+ self.report_error(
47
+ GraphQLError(
48
+ f"OneOf Input Object '{type.name}' must specify exactly one key.",
49
+ nodes=[node],
50
+ )
51
+ )
52
+
53
+ return
54
+
55
+ value = field_node_map[keys[0]].value
56
+ is_null_literal = not value or value.kind == "null_value"
57
+ is_variable = value.kind == "variable"
58
+
59
+ if is_null_literal:
60
+ self.report_error(
61
+ GraphQLError(
62
+ f"Field '{type.name}.{keys[0]}' must be non-null.",
63
+ nodes=[node],
64
+ )
65
+ )
66
+
67
+ return
68
+
69
+ if is_variable:
70
+ variable_name = value.name.value # type: ignore
71
+ definition = self.variable_definitions[variable_name]
72
+ is_nullable_variable = definition.type.kind != "non_null_type"
73
+
74
+ if is_nullable_variable:
75
+ self.report_error(
76
+ GraphQLError(
77
+ f"Variable '{variable_name}' must be non-nullable to be used for OneOf Input Object '{type.name}'.",
78
+ nodes=[node],
79
+ )
80
+ )
@@ -0,0 +1,9 @@
1
+ from strawberry.schema_directive import Location, schema_directive
2
+
3
+
4
+ @schema_directive(locations=[Location.INPUT_OBJECT], name="oneOf")
5
+ class OneOf:
6
+ ...
7
+
8
+
9
+ __all__ = ["OneOf"]
@@ -37,6 +37,10 @@ class StrawberryType(ABC):
37
37
  def type_params(self) -> List[TypeVar]:
38
38
  return []
39
39
 
40
+ @property
41
+ def is_one_of(self) -> bool:
42
+ return False
43
+
40
44
  @abstractmethod
41
45
  def copy_with(
42
46
  self,
@@ -197,6 +197,17 @@ class StrawberryObjectDefinition(StrawberryType):
197
197
  # All field mappings succeeded. This is a match
198
198
  return True
199
199
 
200
+ @property
201
+ def is_one_of(self) -> bool:
202
+ from strawberry.schema_directives import OneOf
203
+
204
+ if not self.is_input or not self.directives:
205
+ return False
206
+
207
+ return any(
208
+ directive for directive in self.directives if isinstance(directive, OneOf)
209
+ )
210
+
200
211
 
201
212
  # TODO: remove when deprecating _type_definition
202
213
  if TYPE_CHECKING: