feat: add OpenAPI spec upload for bulk resource registration#758
Open
PurdueDM wants to merge 2 commits intoMerit-Systems:mainfrom
Open
feat: add OpenAPI spec upload for bulk resource registration#758PurdueDM wants to merge 2 commits intoMerit-Systems:mainfrom
PurdueDM wants to merge 2 commits intoMerit-Systems:mainfrom
Conversation
- Add OpenAPI 3.x / Swagger 2.x parser (lib/openapi/parse-spec.ts) - Extracts endpoints, parameters, request bodies, response schemas - Resolves $ref references and server variables - Base URL auto-detection from spec servers or Swagger 2.x host/basePath - Add registerFromOpenApi tRPC endpoint with dry-run mode - Preview all endpoints before committing to registration - Sequential registration with rate limiting (200ms) - Reuses existing probeX402Endpoint + registerResource pipeline - Add OpenApiUpload UI component on the register page - File upload (JSON/YAML) via existing Dropzone component - Paste textarea for copy-pasting spec content - Endpoint preview with HTTP method badges and descriptions - Per-endpoint success/failure reporting after registration - Base URL override for specs without server info Fixes Merit-Systems#97
Contributor
|
@PurdueDM is attempting to deploy a commit to the Merit Systems Team on Vercel. A member of the Team first needs to authorize it. |
apps/scan/src/app/(app)/(home)/resources/register/_components/openapi-upload.tsx
Show resolved
Hide resolved
apps/scan/src/app/(app)/(home)/resources/register/_components/openapi-upload.tsx
Show resolved
Hide resolved
…ad, FileReader error handling - Add circular reference detection in resolveRef with visited-set to prevent DoS - Remove YAML file accept since parser only supports JSON - Add FileReader.onerror handler for user-facing error feedback
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
Adds OpenAPI spec upload support to the resource registration page, allowing users to paste or upload an OpenAPI 3.x / Swagger 2.x specification to bulk-register all endpoints as x402 resources.
Fixes #97
Changes
New: OpenAPI Parser (�pps/scan/src/lib/openapi/parse-spec.ts)
servers(3.x) orhost/basePath(2.x)New: tRPC Endpoint (
egisterFromOpenApi)
probeX402Endpoint()+registerResource()pipeline (no new registration logic)New: UI Component (openapi-upload.tsx)
Dropzonecomponent (.json, .yaml, .yml)Modified: Register Page
OpenApiUploadcomponent below the existingRegisterResourceFormHow it works
Only endpoints responding with 402 get registered — others are skipped with error messages.
No new dependencies