@typespec/http-client-python 0.30.0-alpha.20260601.2 → 0.30.0-alpha.20260603.1

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.
@@ -716,15 +716,31 @@ export async function prepareBaselineOfGeneratedCode(generatedFolder: string): P
716
716
  run(`git fetch --depth 1 origin ${branch}`);
717
717
  run(`git checkout FETCH_HEAD`);
718
718
 
719
+ // we don't copy whole generated folder, just the specific subfolders needed for tests
720
+ // to verify correct preservation/deletion of files and folders during regeneration,
721
+ // to avoid accidentally including any manually edited code that might be in the repo
722
+ // and cause confusion when it doesn't get updated during regeneration
723
+ const legacyCodePathNeededForTests = [
724
+ "azure/authentication-api-key",
725
+ "unbranded/authentication-api-key",
726
+ "azure/authentication-union",
727
+ "azure/generation-subdir",
728
+ "azure/generation-subdir2",
729
+ "unbranded/generation-subdir",
730
+ "unbranded/generation-subdir2",
731
+ ];
732
+
719
733
  const sourceRoot = join(tempDir, ...sourceSubdir.split("/"));
720
- for (const flavor of ["azure", "unbranded"]) {
721
- const src = join(sourceRoot, flavor);
722
- const dest = join(testsGeneratedDir, flavor);
734
+ for (const subPath of legacyCodePathNeededForTests) {
735
+ const segments = subPath.split("/");
736
+ const src = join(sourceRoot, ...segments);
737
+ const dest = join(testsGeneratedDir, ...segments);
723
738
  if (!existsSync(src)) {
724
739
  console.warn(pc.yellow(`Baseline folder not found: ${src}`));
725
740
  continue;
726
741
  }
727
- console.log(pc.dim(`Copying ${flavor}/ -> ${dest}`));
742
+ console.log(pc.dim(`Copying ${subPath} -> ${dest}`));
743
+ await mkdir(dirname(dest), { recursive: true });
728
744
  await cp(src, dest, { recursive: true });
729
745
  }
730
746
 
@@ -171,9 +171,7 @@ def _get_etag_role(parameter: dict[str, Any]) -> Optional[str]:
171
171
  return parameter.get("etagRole")
172
172
 
173
173
 
174
- def _pick_etag_slot(
175
- candidates: list[dict[str, Any]], standard_wire_name: str
176
- ) -> Optional[dict[str, Any]]:
174
+ def _pick_etag_slot(candidates: list[dict[str, Any]], standard_wire_name: str) -> Optional[dict[str, Any]]:
177
175
  """Choose which etag-typed header should be promoted to the etag/match_condition slot.
178
176
 
179
177
  When more than one etag-typed header is present in an operation, prefer the
@@ -258,15 +256,14 @@ def _process_operation_etag_headers(
258
256
  elif role == "ifNoneMatch":
259
257
  if_none_match_candidates.append(p)
260
258
 
261
- property_if_match, property_if_none_match = _resolve_etag_pair(
262
- if_match_candidates, if_none_match_candidates
263
- )
259
+ property_if_match, property_if_none_match = _resolve_etag_pair(if_match_candidates, if_none_match_candidates)
264
260
 
265
261
  if property_if_match and property_if_none_match:
266
262
  etag_params = {id(property_if_match), id(property_if_none_match)}
267
- operation["parameters"] = [
268
- item for item in operation["parameters"] if id(item) not in etag_params
269
- ] + [property_if_match, property_if_none_match]
263
+ operation["parameters"] = [item for item in operation["parameters"] if id(item) not in etag_params] + [
264
+ property_if_match,
265
+ property_if_none_match,
266
+ ]
270
267
  operation["hasEtag"] = True
271
268
  client["hasEtag"] = True
272
269
 
@@ -171,9 +171,7 @@ def _get_etag_role(parameter: dict[str, Any]) -> Optional[str]:
171
171
  return parameter.get("etagRole")
172
172
 
173
173
 
174
- def _pick_etag_slot(
175
- candidates: list[dict[str, Any]], standard_wire_name: str
176
- ) -> Optional[dict[str, Any]]:
174
+ def _pick_etag_slot(candidates: list[dict[str, Any]], standard_wire_name: str) -> Optional[dict[str, Any]]:
177
175
  """Choose which etag-typed header should be promoted to the etag/match_condition slot.
178
176
 
179
177
  When more than one etag-typed header is present in an operation, prefer the
@@ -258,15 +256,14 @@ def _process_operation_etag_headers(
258
256
  elif role == "ifNoneMatch":
259
257
  if_none_match_candidates.append(p)
260
258
 
261
- property_if_match, property_if_none_match = _resolve_etag_pair(
262
- if_match_candidates, if_none_match_candidates
263
- )
259
+ property_if_match, property_if_none_match = _resolve_etag_pair(if_match_candidates, if_none_match_candidates)
264
260
 
265
261
  if property_if_match and property_if_none_match:
266
262
  etag_params = {id(property_if_match), id(property_if_none_match)}
267
- operation["parameters"] = [
268
- item for item in operation["parameters"] if id(item) not in etag_params
269
- ] + [property_if_match, property_if_none_match]
263
+ operation["parameters"] = [item for item in operation["parameters"] if id(item) not in etag_params] + [
264
+ property_if_match,
265
+ property_if_none_match,
266
+ ]
270
267
  operation["hasEtag"] = True
271
268
  client["hasEtag"] = True
272
269
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/http-client-python",
3
- "version": "0.30.0-alpha.20260601.2",
3
+ "version": "0.30.0-alpha.20260603.1",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec emitter for Python SDKs",
6
6
  "homepage": "https://typespec.io",