Quality pass: harden generator, fix relative server URLs, shorten spec names#1
Merged
Conversation
- core/naming.short_name: drop "OpenAPI"/"v3"/"REST"/version-number noise so "Swagger Petstore - OpenAPI 3.0" -> "petstore" instead of the unwieldy "swagger-petstore-openapi-3-0". Cascades into project dir, binary name, env-var prefix (PETSTORE_TOKEN vs the old monstrosity). - openapi discoverer: resolve relative server URLs (e.g. "/api/v3") against the source URL when source is HTTP, so the generated client ends up with a working absolute base_url. - generated client: send Accept: application/json and User-Agent; raise a helpful APIError instead of silently failing when base_url is unset; honour --debug / <NAME>_DEBUG to log requests with auth headers redacted. - generated main: drop redundant --json/--no-json (--pretty already toggles); add --debug; thread debug into the Client. - generated commands: extract _coerce() body decoder helper (was inline per param); detect flag collisions across path/query/body and rename the body-side flag to --body-<name> so Click no longer raises at decoration time. - ducktap scorecard --fail-under N for CI gating. - tests: add 5 runtime tests that press a tiny spec and actually invoke the generated CLI through an httpx MockTransport (verifies query params, path substitution, POST bodies, 4xx error path, and absolute base_url resolution from a relative server URL). All 21 tests + ruff pass.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Analysis CompleteGenerated ECC bundle from 2 commits | Confidence: 50% View Pull Request #2Repository Profile
Changed Files (17)
Top hotspots
Top directories
Likely Future Issues (2)
Suggested Follow-up Work (2)
Copy-ready bodies test: add browser coverage for website/style.css ## Summary
- Add browser or end-to-end coverage for the recently changed user-facing surface.
## Why
- Backfill browser coverage before another user-facing UI change lands on the touched surface.
## Touched paths
- `website/style.css`
## Validation
- Add or extend browser / e2e coverage for the changed component, page, or flow.
- Exercise the visible user journey that depends on the touched UI surface.chore: refresh lockfile and validate CI after dependency updates ## Summary
- Refresh the lockfile and rerun CI after the dependency or workflow changes in this PR.
## Why
- Package or workflow changes without a lockfile refresh tend to turn into noisy follow-up fixes after merge.
## Touched paths
- `.github/workflows/ci.yml`
- `.github/workflows/publish.yml`
## Validation
- Refresh the lockfile in the same package manager used by the repo.
- Run the repo typecheck / test / CI entrypoints that depend on the updated package graph.Generated Instincts (15)
After merging, import with: Files
|
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
Quality-focused pass that fixes real bugs blocking the generated CLI from being usable, plus adds the missing runtime test layer.
Bugs fixed
swagger-petstore-openapi-3-0-dt-cli/SWAGGER_PETSTORE_OPENAPI_3_0_TOKEN→petstore-dt-cli/PETSTORE_TOKEN. Newshort_name()dropsOpenAPI/v3/REST/version-number noise.servers: [{url: /api/v3}]and is fetched over HTTP, the generated client previously had a broken relativeBASE_URL. Now resolved against the source URL, so the CLI works out of the box.Acceptheader sent by generated client → many APIs returned XML/HTML. Now sendsAccept: application/json+User-Agent.APIErrortelling the user which env var to set.idin both path and body) crashed Click at import time → body-side flag is auto-renamed to--body-<name>.Quality
--json/--no-json(--prettyalready toggles); add--debug/<NAME>_DEBUGenv var that logs requests with auth headers redacted._coerce()body-decode helper (was inline boilerplate per param × per op).ducktap scorecard --fail-under Nexits 2 for CI gating.Tests
New
tests/test_generated_cli_runtime.pypresses a tiny spec, swaps inhttpx.MockTransport, and verifies the generated CLI actually issues correct GET-with-query, path substitution, POST body, 4xx-to-stderr behaviour, and absolute base_url resolution.Previous tests only checked the generator emitted parseable code, not working code.
Test plan
Generated with Devin
Need help on this PR? Tag
@codesmithwith what you need.