Fix invalid underscore in OpenAPI bin domain names#85
Merged
Conversation
New OpenAPI bins now use `-oas` suffix instead of `_oas` so generated subdomains comply with RFC 1035. Legacy `_oas` bins still validate and route correctly via updated regex and `isOasBin` detection. Frontend OAS detection in `[binId].tsx` accepts both formats so existing UI still flags new bins. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest build updates on your Zuplo project. Learn more about Zuplo for GitHub ↗︎
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR updates OpenAPI bin ID generation and detection to avoid underscores in subdomains (RFC 1035 compliance), while maintaining backwards compatibility for legacy _oas bin IDs.
Changes:
- Generate new OpenAPI bin IDs with the
-oassuffix (instead of_oas) and broaden server-side validation to accept both-oasand legacy_oas. - Update OAS bin detection on both backend (
isOasBin) and frontend (isOas) to recognize the new-oasformat. - Add Vitest coverage for bin ID validation and OAS detection.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
www/pages/bins/[binId].tsx |
Updates frontend OAS detection so OAS-specific UI renders for new -oas bin IDs. |
tests/bin-id.test.ts |
Adds tests for validateBinId and isOasBin covering both -oas and _oas. |
modules/utils.ts |
Extends bin ID regex to accept either -oas or _oas suffix and updates isOasBin accordingly. |
modules/handlers.ts |
Switches OpenAPI bin creation to append -oas and changes YAML side-id naming. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- isOasBin and frontend isOas now use endsWith so substring matches
in the middle of a binId no longer trigger OAS code paths
- Add GET /v1/bins/{binId}/original.yaml handler and route that
serves the original uploaded YAML, with backward-compatible
storage key derivation for legacy `_oas` bins
- x-mockbin-original-url now points at the new endpoint so the link
in the served OpenAPI spec is actually reachable
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
router.query value is string | string[]; endsWith is string-only. Fixes TS build error introduced in prior commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mosch
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-oassuffix instead of_oas, producing RFC 1035-compliant subdomains_oasbins still validate, detect, and invoke correctly (regex +isOasBinaccept both)isOascheck inwww/pages/bins/[binId].tsxupdated so new-oasbins still render OAS-specific UI_YAML_originalto-YAML-originalfor consistencyWhy
Subdomains like
<id>_oas.api.mockbin.iofailed TLS handshake in Java (and other strict) HTTP clients because underscores aren't valid in DNS hostnames:Test plan
npx vitest run— 28/28 pass (18 existing + 10 new)-oasand resolves over HTTPS_oasbin, confirm still routes-oasURLFixes #67
🤖 Generated with Claude Code