Skip to content

feat(api-detector-core): add PathTemplates.stripBasePath and OpenApiEndpointCollector.firstServerBasePath - #66

Merged
Arc-E-Tect merged 2 commits into
mainfrom
feat/mirage-stub-base-path
Aug 17, 2026
Merged

feat(api-detector-core): add PathTemplates.stripBasePath and OpenApiEndpointCollector.firstServerBasePath#66
Arc-E-Tect merged 2 commits into
mainfrom
feat/mirage-stub-base-path

Conversation

@Arc-E-Tect

Copy link
Copy Markdown
Owner

Summary

  • Adds two small primitives needed to fix a real bug in mirage-api-detector's scanMocks mode (follow-up PR there, blocked on this release): a WireMock stub mapping records the full request path a client actually sends - including whatever deployment-time context path the server runs under, e.g. /crm-service - while an OpenAPI-declared path (and a @RequestMapping-derived one) never includes it. Left unaccounted for, a stub-derived record can never match its corresponding declared endpoint's fingerprint.
  • Verified against a real project's data: every one of 49 stub-derived records was an orphaned, unmatched row before this - none merged with the endpoint it actually stubs.
  • PathTemplates.stripBasePath(path, basePath) removes a matching leading segment, both normalised first; a no-op for a blank or root base path.
  • OpenApiEndpointCollector.firstServerBasePath(rootDocument) returns the path component of the document's first servers entry's url (e.g. http://localhost:9011/crm-service/crm-service), so a consumer can default to it with no explicit configuration for the common case.
  • Full test coverage for both, including fixture OpenAPI documents with and without a servers entry.

…ndpointCollector.firstServerBasePath

A WireMock stub mapping records the full request path a client actually sends - including whatever
deployment-time context path the server runs under, e.g. /crm-service - while an OpenAPI-declared
path (and a @RequestMapping-derived one) never includes it, since an OpenAPI document's paths are
always relative to its own servers entry. Left unaccounted for, mirage-api-detector's scanMocks
mode could never match a stub against its corresponding declared endpoint: verified against a real
project's data, every single stub-derived record ended up as an orphaned, unmatched row instead of
being recognised as evidence for the declared endpoint it actually stubs.

PathTemplates.stripBasePath(path, basePath) removes a matching leading segment, both normalised
first, and is a no-op for a blank or root base path.

OpenApiEndpointCollector.firstServerBasePath(rootDocument) returns the path component of the
document's first servers entry's url (e.g. http://localhost:9011/crm-service yields /crm-service),
so a consumer can default to it without requiring explicit configuration for the common case.

Both are consumed by mirage-api-detector's new basePath DSL option in a follow-up change, once this
is released.
@Arc-E-Tect
Arc-E-Tect merged commit 865e711 into main Aug 17, 2026
4 checks passed
@Arc-E-Tect
Arc-E-Tect deleted the feat/mirage-stub-base-path branch August 17, 2026 07:41
Arc-E-Tect added a commit that referenced this pull request Aug 17, 2026
# [1.2.0](api-detector-core-v1.1.0...api-detector-core-v1.2.0) (2026-08-17)

### ✨ New and updated features

* **api-detector-core:** add PathTemplates.stripBasePath and OpenApiEndpointCollector.firstServerBasePath ([#66](#66)) ([865e711](865e711)), closes [#66](#66)

### 📝 Documentation

* **api-detector-core:** update README version to 1.1.0 [skip ci] ([1680e7b](1680e7b))
@Arc-E-Tect

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 1.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Arc-E-Tect added a commit that referenced this pull request Aug 17, 2026
# [1.0.0](hexagonal-spring-rules-v0.5.0...hexagonal-spring-rules-v1.0.0) (2026-08-17)

### ✨ New and updated features

* **api-detector-core:** add ContractProgressTableWriter for shared Progress Over Time reporting ([#59](#59)) ([dd4d36a](dd4d36a)), closes [#59](#59)
* add geo-tracker-lens-pack library with independent release pipeline ([#60](#60)) ([1730931](1730931)), closes [#60](#60)
* **api-detector-core:** add PathTemplates.stripBasePath and OpenApiEndpointCollector.firstServerBasePath ([#66](#66)) ([865e711](865e711)), closes [#66](#66)
* **api-detector-core:** add published shared library for the SEDR API detector plugins ([#52](#52)) ([059ee4d](059ee4d)), closes [#52](#52)
* **api-detector-core:** add ScanProgressReporter for visible long-scan progress ([#56](#56)) ([9357bc9](9357bc9)), closes [#56](#56)
* **api-detector-core:** add shared contract-lifecycle progress history framework ([#53](#53)) ([0bb104e](0bb104e)), closes [#53](#53)
* **api-detector-core:** separate real implementation evidence from stub evidence in contract history ([#64](#64)) ([0775933](0775933)), closes [#64](#64)
* **api-detector-core:** write and tolerate a schema-version marker ([#65](#65)) ([e27d53f](e27d53f)), closes [#65](#65)

### 🐛 Bug Fixes

* **ci:** detect first semantic release version in calculate workflow ([#61](#61)) ([3a80fe1](3a80fe1)), closes [#61](#61)
* **workflow:** fix tag checking for project-specific tag formats ([#54](#54)) ([ce8f57e](ce8f57e)), closes [#54](#54)
* **hexagonal-spring-rules:** give module its own semantic-release tag namespace ([#67](#67)) ([613a69a](613a69a)), closes [#67](#67)
* **examples:** remove mavenLocal now that dependencies are released ([#42](#42)) ([9b20913](9b20913)), closes [#42](#42)
* **ci:** stabilize security scan reporting and SEDR scan scope ([#49](#49)) ([f5c7df2](f5c7df2)), closes [#49](#49)
* **CI:** stop the NVD cache refresh from timing out on every cold sync ([#46](#46)) ([cbaebf3](cbaebf3)), closes [#46](#46)
* tag checking for project-specific tag formats in workflow ([#55](#55)) ([9e9255e](9e9255e)), closes [#55](#55)
* **geo-tracker-lens-pack:** use https scm connection for Maven Central metadata ([#63](#63)) ([5bb98c0](5bb98c0)), closes [#63](#63)

### 📝 Documentation

* **api-detector-core:** update README version to 0.1.0 [skip ci] ([14c5f16](14c5f16))
* **api-detector-core:** update README version to 0.2.0 [skip ci] ([2f68414](2f68414))
* **api-detector-core:** update README version to 0.3.0 [skip ci] ([9c63eac](9c63eac))
* **hexagonal-spring-rules:** update README version to 0.5.0 [skip ci] ([5c8b553](5c8b553))
* **sedr-library:** update README version to 0.5.1 [skip ci] ([bb4becf](bb4becf))
* **sedr-library:** update README version to 0.5.2 [skip ci] ([8320bb8](8320bb8))
* **api-detector-core:** update README version to 1.0.0 [skip ci] ([ebb1c5f](ebb1c5f))
* **geo-tracker-lens-pack:** update README version to 1.0.0 [skip ci] ([ab46583](ab46583))
* **geo-tracker-lens-pack:** update README version to 1.0.1 [skip ci] ([1ac70e4](1ac70e4))
* **api-detector-core:** update README version to 1.1.0 [skip ci] ([1680e7b](1680e7b))
* **api-detector-core:** update README version to 1.2.0 [skip ci] ([6656c7f](6656c7f))

### 🔧 Misc

* Change NVD cache refresh schedule to weekly ([#45](#45)) ([83c3552](83c3552)), closes [#45](#45)
* dependency updates for Library projects ([#43](#43)) ([fa70e5e](fa70e5e)), closes [#43](#43)
* dependency updates for Library projects ([#47](#47)) ([398933c](398933c)), closes [#47](#47)
* dependency updates for Library projects ([#48](#48)) ([105111d](105111d)), closes [#48](#48)
* dependency updates for Library projects ([#50](#50)) ([2d5d3ce](2d5d3ce)), closes [#50](#50)
* dependency updates for Library projects ([#58](#58)) ([83dff89](83dff89)), closes [#58](#58)
* Make workflow triggers more specific and add progress reporter ([#57](#57)) ([10c64dc](10c64dc)), closes [#57](#57)
* **ci:** remove redundant Monday NVD cache refresh schedule ([#51](#51)) ([ffd937f](ffd937f)), closes [#51](#51)
* **geo-tracker-lens-pack:** trigger release pipeline after CI fix ([b2440cc](b2440cc))
* **Sedr Library:** update npm packages ([#44](#44)) ([821da37](821da37)), closes [#44](#44)

### BREAKING CHANGE

* **api-detector-core:** contractHistoryFile written by a previous version of this
library (9 fields, no stubbedAt) is no longer readable by
ContractHistoryStore.load() - it now throws
LegacyContractHistoryFormatException instead of loading it under the old,
now-ambiguous implementedAt semantics. Consumers must migrate existing
history files (mirage-api-detector's new migrateContractHistory task) or
start a fresh history file before upgrading.
@Arc-E-Tect

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Arc-E-Tect added a commit that referenced this pull request Aug 21, 2026
# [1.0.0](sedr-library-v0.5.2...sedr-library-v1.0.0) (2026-08-21)

### ✨ New and updated features

* **api-detector-core:** add ContractProgressTableWriter for shared Progress Over Time reporting ([#59](#59)) ([dd4d36a](dd4d36a)), closes [#59](#59)
* add geo-tracker-lens-pack library with independent release pipeline ([#60](#60)) ([1730931](1730931)), closes [#60](#60)
* **api-detector-core:** add PathTemplates.stripBasePath and OpenApiEndpointCollector.firstServerBasePath ([#66](#66)) ([865e711](865e711)), closes [#66](#66)
* **api-detector-core:** add published shared library for the SEDR API detector plugins ([#52](#52)) ([059ee4d](059ee4d)), closes [#52](#52)
* **api-detector-core:** add ScanProgressReporter for visible long-scan progress ([#56](#56)) ([9357bc9](9357bc9)), closes [#56](#56)
* **api-detector-core:** add shared contract-lifecycle progress history framework ([#53](#53)) ([0bb104e](0bb104e)), closes [#53](#53)
* **api-detector-core:** separate real implementation evidence from stub evidence in contract history ([#64](#64)) ([0775933](0775933)), closes [#64](#64)
* **api-detector-core:** write and tolerate a schema-version marker ([#65](#65)) ([e27d53f](e27d53f)), closes [#65](#65)

### 🐛 Bug Fixes

* **hexagonal-spring-rules:** align dependency-check config with sibling projects ([#71](#71)) ([769f76a](769f76a)), closes [#71](#71)
* **ci:** detect first semantic release version in calculate workflow ([#61](#61)) ([3a80fe1](3a80fe1)), closes [#61](#61)
* **workflow:** fix tag checking for project-specific tag formats ([#54](#54)) ([ce8f57e](ce8f57e)), closes [#54](#54)
* **hexagonal-spring-rules:** give module its own semantic-release tag namespace ([#67](#67)) ([613a69a](613a69a)), closes [#67](#67)
* **sedr-library:** give module its own semantic-release tag namespace ([#68](#68)) ([ff2eb0d](ff2eb0d)), closes [#68](#68) [#67](#67)
* tag checking for project-specific tag formats in workflow ([#55](#55)) ([9e9255e](9e9255e)), closes [#55](#55)
* **api-detector-core:** update swagger-parser dependency and document OpenAPI v3 support ([#70](#70)) ([352b03e](352b03e)), closes [#70](#70)
* **geo-tracker-lens-pack:** use https scm connection for Maven Central metadata ([#63](#63)) ([5bb98c0](5bb98c0)), closes [#63](#63)

### 📝 Documentation

* **api-detector-core:** update README version to 0.1.0 [skip ci] ([14c5f16](14c5f16))
* **api-detector-core:** update README version to 0.2.0 [skip ci] ([2f68414](2f68414))
* **api-detector-core:** update README version to 0.3.0 [skip ci] ([9c63eac](9c63eac))
* **sedr-library:** update README version to 0.5.2 [skip ci] ([8320bb8](8320bb8))
* **api-detector-core:** update README version to 1.0.0 [skip ci] ([ebb1c5f](ebb1c5f))
* **geo-tracker-lens-pack:** update README version to 1.0.0 [skip ci] ([ab46583](ab46583))
* **hexagonal-spring-rules:** update README version to 1.0.0 [skip ci] ([140934e](140934e))
* **geo-tracker-lens-pack:** update README version to 1.0.1 [skip ci] ([1ac70e4](1ac70e4))
* **hexagonal-spring-rules:** update README version to 1.0.1 [skip ci] ([0c115a7](0c115a7))
* **api-detector-core:** update README version to 1.1.0 [skip ci] ([1680e7b](1680e7b))
* **api-detector-core:** update README version to 1.2.0 [skip ci] ([6656c7f](6656c7f))
* **api-detector-core:** update README version to 1.2.1 [skip ci] ([b4230b2](b4230b2))

### 🔧 Misc

* dependency updates for Library projects ([#58](#58)) ([83dff89](83dff89)), closes [#58](#58)
* dependency updates for Library projects ([#69](#69)) ([d46b898](d46b898)), closes [#69](#69)
* dependency updates for Library projects ([#72](#72)) ([2f7c387](2f7c387)), closes [#72](#72)
* Make workflow triggers more specific and add progress reporter ([#57](#57)) ([10c64dc](10c64dc)), closes [#57](#57)
* **ci:** remove redundant Monday NVD cache refresh schedule ([#51](#51)) ([ffd937f](ffd937f)), closes [#51](#51)
* **geo-tracker-lens-pack:** trigger release pipeline after CI fix ([b2440cc](b2440cc))

### BREAKING CHANGE

* **api-detector-core:** contractHistoryFile written by a previous version of this
library (9 fields, no stubbedAt) is no longer readable by
ContractHistoryStore.load() - it now throws
LegacyContractHistoryFormatException instead of loading it under the old,
now-ambiguous implementedAt semantics. Consumers must migrate existing
history files (mirage-api-detector's new migrateContractHistory task) or
start a fresh history file before upgrading.
@Arc-E-Tect

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant