schemathesis 4.3.5__py3-none-any.whl → 4.3.6__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.

Potentially problematic release.


This version of schemathesis might be problematic. Click here for more details.

@@ -4,26 +4,45 @@ from __future__ import annotations
4
4
  def from_parameter(parameter: str, path: str) -> str | None:
5
5
  # TODO: support other naming patterns
6
6
  # Named like "userId" -> look for "User" resource
7
- if parameter.endswith("Id"):
7
+ if parameter.endswith("Id") and len(parameter) > 2:
8
8
  return to_pascal_case(parameter[:-2])
9
9
  # Named like "user_id" -> look for "User" resource
10
10
  elif parameter.endswith("_id"):
11
11
  return to_pascal_case(parameter[:-3])
12
12
  # Just "id" -> infer from path context
13
13
  elif parameter == "id":
14
- return from_path(path)
14
+ return from_path(path, parameter_name=parameter)
15
15
  return None
16
16
 
17
17
 
18
- def from_path(path: str) -> str | None:
19
- segments = [s for s in path.split("/") if s and "{" not in s]
18
+ def from_path(path: str, parameter_name: str | None = None) -> str | None:
19
+ """Detect resource name from OpenAPI path."""
20
+ segments = [s for s in path.split("/") if s]
20
21
 
21
22
  if not segments:
22
23
  # API Root
23
24
  return None
24
25
 
25
- singular = to_singular(segments[-1])
26
- return to_pascal_case(singular)
26
+ # If parameter name provided, find the resource it refers to
27
+ if parameter_name:
28
+ placeholder = f"{{{parameter_name}}}"
29
+ try:
30
+ param_index = segments.index(placeholder)
31
+ if param_index > 0:
32
+ resource_segment = segments[param_index - 1]
33
+ if "{" not in resource_segment:
34
+ singular = to_singular(resource_segment)
35
+ return to_pascal_case(singular)
36
+ except ValueError:
37
+ pass # Parameter not found in path
38
+
39
+ # Fallback to last non-parameter segment
40
+ non_param_segments = [s for s in segments if "{" not in s]
41
+ if non_param_segments:
42
+ singular = to_singular(non_param_segments[-1])
43
+ return to_pascal_case(singular)
44
+
45
+ return None
27
46
 
28
47
 
29
48
  IRREGULAR_TO_PLURAL = {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: schemathesis
3
- Version: 4.3.5
3
+ Version: 4.3.6
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://github.com/schemathesis/schemathesis/blob/master/CHANGELOG.md
@@ -167,7 +167,7 @@ schemathesis/specs/openapi/stateful/links.py,sha256=SSA66mU50FFBz7e6sA37CfL-Vt0O
167
167
  schemathesis/specs/openapi/stateful/dependencies/__init__.py,sha256=0JM-FrY6Awv6gl-qDHaaK7pXbt_GKutBKPyIaph8apA,7842
168
168
  schemathesis/specs/openapi/stateful/dependencies/inputs.py,sha256=1qVVIlzx52qsy55Pht9dYNtn2dewRSiHegfrBO1RD8c,10347
169
169
  schemathesis/specs/openapi/stateful/dependencies/models.py,sha256=HxdVcVebjUFhSlSs_M8vDB-BnYfYwLGceIQAzytawrs,11324
170
- schemathesis/specs/openapi/stateful/dependencies/naming.py,sha256=MGoyh1bfw2SoKzdbzpHxed9LHMjokPJTU_YErZaF-Ls,11396
170
+ schemathesis/specs/openapi/stateful/dependencies/naming.py,sha256=HfpkCB1GglX1BAKXer3llvPkQsk8wx0QZhZq7ANcdMM,12214
171
171
  schemathesis/specs/openapi/stateful/dependencies/outputs.py,sha256=zvVUfQWNIuhMkKDpz5hsVGkkvkefLt1EswpJAnHajOw,1186
172
172
  schemathesis/specs/openapi/stateful/dependencies/resources.py,sha256=4bgXILFgC1_y9aU_4scaNw3lkJ6laW5MMkLYh3Ph4Hg,9894
173
173
  schemathesis/specs/openapi/stateful/dependencies/schemas.py,sha256=yMu13RsXIPDeZT1tATTxI1vkpYhjs-XFSFEvx3_Xh_Q,14094
@@ -179,8 +179,8 @@ schemathesis/transport/prepare.py,sha256=erYXRaxpQokIDzaIuvt_csHcw72iHfCyNq8VNEz
179
179
  schemathesis/transport/requests.py,sha256=wriRI9fprTplE_qEZLEz1TerX6GwkE3pwr6ZnU2o6vQ,10648
180
180
  schemathesis/transport/serialization.py,sha256=GwO6OAVTmL1JyKw7HiZ256tjV4CbrRbhQN0ep1uaZwI,11157
181
181
  schemathesis/transport/wsgi.py,sha256=kQtasFre6pjdJWRKwLA_Qb-RyQHCFNpaey9ubzlFWKI,5907
182
- schemathesis-4.3.5.dist-info/METADATA,sha256=f9Q8lbfSrfHg97P7fabHN6K0KN6qVpqFJjfg2B_w2QA,8540
183
- schemathesis-4.3.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
184
- schemathesis-4.3.5.dist-info/entry_points.txt,sha256=hiK3un-xfgPdwj9uj16YVDtTNpO128bmk0U82SMv8ZQ,152
185
- schemathesis-4.3.5.dist-info/licenses/LICENSE,sha256=2Ve4J8v5jMQAWrT7r1nf3bI8Vflk3rZVQefiF2zpxwg,1121
186
- schemathesis-4.3.5.dist-info/RECORD,,
182
+ schemathesis-4.3.6.dist-info/METADATA,sha256=fSBJbdXmS3wufMePS7qdtcEmUy4eMoiV28sqkp0db68,8540
183
+ schemathesis-4.3.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
184
+ schemathesis-4.3.6.dist-info/entry_points.txt,sha256=hiK3un-xfgPdwj9uj16YVDtTNpO128bmk0U82SMv8ZQ,152
185
+ schemathesis-4.3.6.dist-info/licenses/LICENSE,sha256=2Ve4J8v5jMQAWrT7r1nf3bI8Vflk3rZVQefiF2zpxwg,1121
186
+ schemathesis-4.3.6.dist-info/RECORD,,