Skip to content

Strip periods from OperationIds - #84

Open
RawToast wants to merge 4 commits into
masterfrom
operationids
Open

Strip periods from OperationIds#84
RawToast wants to merge 4 commits into
masterfrom
operationids

Conversation

@RawToast

@RawToast RawToast commented Aug 7, 2026

Copy link
Copy Markdown
Owner

What this PR does

Normalizes OpenAPI operation IDs by removing periods, spaces, and parentheses before generating JavaScript identifiers and matching selected operations. Adds utility and integration coverage for normalization and selective generation, updates snapshots and OAS2/CLI tests, and replaces the Blockscout fixture with an expanded OpenAPI 3 specification.

@kanri-san

kanri-san Bot commented Aug 7, 2026

Copy link
Copy Markdown

Summary

Normalizes OpenAPI operation IDs by removing periods, spaces, and parentheses before generating JavaScript identifiers and matching selected operations. Adds utility and integration coverage for normalization and selective generation, updates snapshots and OAS2/CLI tests, and replaces the Blockscout fixture with an expanded OpenAPI 3 specification.

Changes

File Change Reason
packages/zenko/src/utils/string-utils.ts Adds operation ID normalization for periods, spaces, and parentheses. Produces valid and consistent JavaScript identifiers.
packages/zenko/src/zenko.ts Applies normalized operation IDs during operation generation and selection. Keeps generated names and selective operation matching consistent.
packages/zenko/src/utils/schema-utils.ts Updates schema utility handling related to normalized operation names. Supports operation metadata consistently across generation paths.
packages/zenko/src/utils/zod-type-refs.ts Adds handling and tests for generated Zod type references. Maintains valid references for expanded operation and schema coverage.
packages/zenko/src/tests/cli.test.ts Updates CLI coverage for operation ID normalization and generated output. Verifies behavior through the public command-line generation path.
packages/zenko/src/tests/schema-version-oas2.test.ts Adjusts OAS2 expectations and adds normalized operation ID cases. Ensures the change remains compatible with Swagger/OpenAPI 2 inputs.
packages/zenko/src/tests/selective-operations.test.ts Adds tests for selecting operations using normalized IDs. Confirms filtering works when source operation IDs contain special characters.
packages/zenko/src/utils/tests/string-utils.test.ts Adds unit cases covering removal of periods, spaces, and parentheses. Documents and validates normalization behavior directly.
packages/zenko/src/utils/tests/schema-utils.test.ts Updates schema utility test coverage. Covers utility behavior affected by operation processing changes.
packages/zenko/src/utils/tests/zod-type-refs.test.ts Adds tests for Zod type reference generation. Protects generated schema references across the expanded fixtures.
packages/zenko/src/tests/snapshots/zenko.test.ts.snap Updates generated output snapshots. Reflects normalized operation and type names.
packages/specs/resources/blockscout.yaml Replaces the former Swagger 2 fixture with a substantially expanded OpenAPI 3 Blockscout specification. Provides broader real-world coverage of operation IDs and schema generation.
packages/zenko/package.json Updates a package dependency or package metadata version. Keeps package configuration aligned with the implementation changes.

Walkthrough by kanri

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.45%. Comparing base (40e2fd8) to head (6df4c08).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #84      +/-   ##
==========================================
+ Coverage   97.36%   97.45%   +0.08%     
==========================================
  Files          21       22       +1     
  Lines        3608     3652      +44     
==========================================
+ Hits         3513     3559      +46     
+ Misses         95       93       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Move keyword mapping out of zenko.ts and unit-test every branch so
codecov/patch can measure the new switch arms.

@kanri-san kanri-san Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issues

1. Normalization is non-injective: valid IDs such as `foo.bar` and `foobar` both...

Location: packages/zenko/src/zenko.ts:166

Severity: warning

Normalization is non-injective: valid IDs such as foo.bar and foobar both match a selected foobar, so both operations are generated and can produce duplicate exports/object keys. Prefer an exact raw-ID match first; otherwise only accept a normalized match when it resolves to one operation, and report ambiguity.

Verdict

Status: APPROVED

Normalization coverage is solid, but ambiguous normalized operation IDs need deterministic handling.

The effective status was recalculated from current findings and prior Kanri threads: APPROVED.


Reviewed by kanri | 0 new inline comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant