Skip to content

feat: Replace Spec.fromPath with Spec.fromClasspath#94

Merged
thced merged 2 commits into
masterfrom
fix/spec-inputstream
May 22, 2026
Merged

feat: Replace Spec.fromPath with Spec.fromClasspath#94
thced merged 2 commits into
masterfrom
fix/spec-inputstream

Conversation

@thced

@thced thced commented May 22, 2026

Copy link
Copy Markdown
Contributor

The filesystem-path loader was awkward for the common case — every service ships its OpenAPI spec inside its own JAR. fromClasspath takes a Class<?> + resource name and dispatches on extension the same way, making the JAR-packaged case a one-liner.

Removes fromPath(Path) and its test; adds fromClasspath(Class<?>, String) with tests covering JSON, YAML, YML, missing-resource, and unknown-extension cases. README updated with the new API and a note on the leading-slash gotcha in Class.getResourceAsStream.

thced added 2 commits May 22, 2026 12:21
The filesystem-path loader was awkward for the common case — every
service ships its OpenAPI spec inside its own JAR. fromClasspath takes
a Class<?> + resource name and dispatches on extension the same way,
making the JAR-packaged case a one-liner.

Removes fromPath(Path) and its test; adds fromClasspath(Class<?>, String)
with tests covering JSON, YAML, YML, missing-resource, and
unknown-extension cases. README updated with the new API and a note on
the leading-slash gotcha in Class.getResourceAsStream.
Sonar S5778 — each lambda should have at most one invocation that
can throw a runtime exception. Both getClass() and Spec.fromClasspath
were inside the lambda; the call we're actually asserting against is
Spec.fromClasspath, so pull the class lookup out into a local first.
@sonarqubecloud

Copy link
Copy Markdown

@thced thced merged commit 897d079 into master May 22, 2026
6 checks passed
@thced thced deleted the fix/spec-inputstream branch May 22, 2026 10:42
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