schemathesis 3.23.0__py3-none-any.whl → 3.23.1__py3-none-any.whl

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.
@@ -1097,7 +1097,7 @@ def _try_load_schema(config: LoaderConfig, first: Loader, second: Loader) -> Bas
1097
1097
  try:
1098
1098
  return first(config)
1099
1099
  except SchemaError as exc:
1100
- if should_try_more(exc):
1100
+ if config.force_schema_version is None and should_try_more(exc):
1101
1101
  try:
1102
1102
  return second(config)
1103
1103
  except Exception as second_exc:
@@ -1112,6 +1112,8 @@ def is_specific_exception(loader: Loader, exc: Exception) -> bool:
1112
1112
  loader is _load_graphql_schema
1113
1113
  and isinstance(exc, SchemaError)
1114
1114
  and exc.type == SchemaErrorType.GRAPHQL_INVALID_SCHEMA
1115
+ # In some cases it is not clear that the schema is even supposed to be GraphQL, e.g. an empty input
1116
+ and "Syntax Error: Unexpected <EOF>." not in exc.extras
1115
1117
  )
1116
1118
 
1117
1119
 
@@ -184,6 +184,7 @@ def from_uri(
184
184
  )
185
185
 
186
186
 
187
+ SCHEMA_INVALID_ERROR = "The provided API schema does not appear to be a valid OpenAPI schema"
187
188
  SCHEMA_LOADING_ERROR = "Received unsupported content while expecting a JSON or YAML payload for Open API"
188
189
  SCHEMA_SYNTAX_ERROR = "API schema does not appear syntactically valid"
189
190
 
@@ -304,6 +305,8 @@ def from_dict(
304
305
  """
305
306
  from .schemas import OpenApi30, SwaggerV20
306
307
 
308
+ if not isinstance(raw_schema, dict):
309
+ raise SchemaError(SchemaErrorType.OPEN_API_INVALID_SCHEMA, SCHEMA_INVALID_ERROR)
307
310
  _code_sample_style = CodeSampleStyle.from_str(code_sample_style)
308
311
  hook_context = HookContext()
309
312
  is_openapi_31 = raw_schema.get("openapi", "").startswith("3.1")
@@ -435,7 +438,7 @@ def _maybe_validate_schema(
435
438
  except ValidationError as exc:
436
439
  raise SchemaError(
437
440
  SchemaErrorType.OPEN_API_INVALID_SCHEMA,
438
- "The provided API schema does not appear to be a valid OpenAPI schema",
441
+ SCHEMA_INVALID_ERROR,
439
442
  extras=[entry for entry in str(exc).splitlines() if entry],
440
443
  ) from exc
441
444
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: schemathesis
3
- Version: 3.23.0
3
+ Version: 3.23.1
4
4
  Summary: Property-based testing framework for Open API and GraphQL based apps
5
5
  Project-URL: Documentation, https://schemathesis.readthedocs.io/en/stable/
6
6
  Project-URL: Changelog, https://schemathesis.readthedocs.io/en/stable/changelog.html
@@ -25,7 +25,7 @@ schemathesis/targets.py,sha256=tzp7VZ2-7g2nZHCooRgFzTMtOVcbl0rvtNR421hQthA,1162
25
25
  schemathesis/throttling.py,sha256=QQcS7TFpXHavUjm0kdFaCcCRhAGlgQ4y3XIbkdRoW20,1079
26
26
  schemathesis/types.py,sha256=AglR5M0bce-YXeDRkweToXTP0GjNOWVjS_mIsxLobwc,919
27
27
  schemathesis/utils.py,sha256=tjH1jkMseEXV6vYg8ylJpYd7sRprnpbmXqdWg20ZaGE,4939
28
- schemathesis/cli/__init__.py,sha256=oSn0AFZRlTi3vPW8TaHDGQKoWF9fw73apmTdRwcBMls,60100
28
+ schemathesis/cli/__init__.py,sha256=mLAjbvhkrRwooGJ74BihfLcO241pbRnx3u12GRkjUZY,60312
29
29
  schemathesis/cli/callbacks.py,sha256=UAlHDW_zYUzuVlpA01GarsApOtij4PaKJpPp4lboqJk,12770
30
30
  schemathesis/cli/cassettes.py,sha256=gPPvcuIj1WnoP-yqqvGCJNe49SWlDFu8OdQkOmY453A,12988
31
31
  schemathesis/cli/constants.py,sha256=x9zrVVFBTOO1HogPeqRO5Mvdgs3y1kiah9R5nPRTIyw,1347
@@ -97,7 +97,7 @@ schemathesis/specs/openapi/examples.py,sha256=QIwFrciKUFz-cxbrXqBdsKCLt01XZo8p3z
97
97
  schemathesis/specs/openapi/filters.py,sha256=Ei-QTFcGCvGSIunT-GYQrtqzB-kqvUePOcUuC7B7mT8,1436
98
98
  schemathesis/specs/openapi/formats.py,sha256=ZT-10kOWE4Xcc_OXchjhPxpjA2iq4SXG2a75Lnib03w,1146
99
99
  schemathesis/specs/openapi/links.py,sha256=YryI35djHOhTikRV3FLafy_jhYFypF7E8Yb6dg9ksWc,14575
100
- schemathesis/specs/openapi/loaders.py,sha256=l3H8T4GgolysRgrxpjYK_vOB2xyPIHNbKPX3_FrLq-M,23439
100
+ schemathesis/specs/openapi/loaders.py,sha256=2s9pF8HdIRcz4GwSLy3XJli_FZaeo9zontbat-SFOws,23613
101
101
  schemathesis/specs/openapi/parameters.py,sha256=GbvxMQ0vg2-HvLrKr1dBtOwSNEXkAF6Hj-hqX9qdTNs,15014
102
102
  schemathesis/specs/openapi/references.py,sha256=pnn0aQbP2Kz0xwZE0gVa9nYGyJkXA2jRYoNMFcRf3TQ,8656
103
103
  schemathesis/specs/openapi/schemas.py,sha256=s81MBsGVoc3WILCYR8DjNvmN6OotSsg27YFK5iqtdt8,46220
@@ -124,8 +124,8 @@ schemathesis/transports/auth.py,sha256=ZKFku9gjhIG6445qNC2p_64Yt9Iz_4azbvja8AMpt
124
124
  schemathesis/transports/content_types.py,sha256=bgep10TeCT9e0GfOxVFBOFmrmdZ3t4tG8MLE0SJN5D0,1297
125
125
  schemathesis/transports/headers.py,sha256=EDxpm8su0AuhyqZUkMex-OFZMAJN_5NHah7fDT2HDZE,989
126
126
  schemathesis/transports/responses.py,sha256=w-l0bQrPuAXKURtDazm9ptuGVcJgEW-QYWYpYblFEyM,1347
127
- schemathesis-3.23.0.dist-info/METADATA,sha256=Z_TM3XU4AMq-jJ0GF0g5Nb66dbqqX8nRDS7ioml-6po,15611
128
- schemathesis-3.23.0.dist-info/WHEEL,sha256=hKi7AIIx6qfnsRbr087vpeJnrVUuDokDHZacPPMW7-Y,87
129
- schemathesis-3.23.0.dist-info/entry_points.txt,sha256=VHyLcOG7co0nOeuk8WjgpRETk5P1E2iCLrn26Zkn5uk,158
130
- schemathesis-3.23.0.dist-info/licenses/LICENSE,sha256=PsPYgrDhZ7g9uwihJXNG-XVb55wj2uYhkl2DD8oAzY0,1103
131
- schemathesis-3.23.0.dist-info/RECORD,,
127
+ schemathesis-3.23.1.dist-info/METADATA,sha256=HJD__7N6XCehhfzauNlzscwE42RpyoyPC3l4Tpzue24,15611
128
+ schemathesis-3.23.1.dist-info/WHEEL,sha256=hKi7AIIx6qfnsRbr087vpeJnrVUuDokDHZacPPMW7-Y,87
129
+ schemathesis-3.23.1.dist-info/entry_points.txt,sha256=VHyLcOG7co0nOeuk8WjgpRETk5P1E2iCLrn26Zkn5uk,158
130
+ schemathesis-3.23.1.dist-info/licenses/LICENSE,sha256=PsPYgrDhZ7g9uwihJXNG-XVb55wj2uYhkl2DD8oAzY0,1103
131
+ schemathesis-3.23.1.dist-info/RECORD,,