feat: Support semantic-method specs without a POST operation per path - #305
Merged
Merged
Conversation
nextlove 4.4.0 generates a single semantic operation per path (the non-POST method for read routes) instead of mirroring every operation onto POST. createEndpoint previously required a post operation and built the endpoint exclusively from it, so such specs failed with "No valid post operation found". - Build the endpoint from the semantic method's operation when a path has no post operation, and restore the POST alias to request.methods (the Seam API accepts POST on every endpoint), so a semantic-method spec produces the same blueprint as a POST-mirrored one. - Derive request parameters from the operation's query parameters when the endpoint is built from a non-POST operation without a JSON request body. Endpoints built from a POST operation keep deriving parameters from the request body only, bit-identical to prior output. - Allow query parameter schemas without a top-level type in OpenapiOperationSchema (union schemas carry oneOf/anyOf instead), matching the requestBody schema's existing optional type. Validated by building blueprints from seam-connect's POST-mirrored spec and its regenerated semantic-method spec: 318 endpoints on both sides, none gained or lost; all diffs are parameter/method order, intended deprecated-PUT removals, or spec-side fidelity gaps documented in the PR. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UgJLypfYKgaoAYq7fKy4fs
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
nextlove@4.4.0generates a single semantic operation per path (the non-POST method for read routes) instead of mirroring every operation onto POST.createEndpointpreviously hard-required apostoperation and built the endpoint exclusively from it, so semantic-method specs failed withNo valid post operation found for /access_codes/create_multiple— this is what's currently failing the "Open PR on seamapi/types" check on seam-connect#17333.Changes
createEndpoint: when a path has nopostoperation, build the endpoint from the semantic method's operation (via the existinggetSemanticMethod) and restore the POST alias intorequest.methods— the Seam API accepts POST on every endpoint, the semantic spec just stops documenting the mirror. When apostoperation exists, behavior is unchanged (built from POST, methods as-declared).createRequest: when the endpoint is built from a non-POST operation with no JSON request body (GET/DELETE), derive parameters from the operation's queryparameters. Endpoints built from a POST operation keep deriving parameters from the request body only — bit-identical to prior output (this gate matters:/seam/console/v1/get_resource_locatorhas a bodyless POST with a query param that the old code silently dropped, and an ungated fallback would have changed old-spec output).ParameterSchema:schema.typeis now optional — union query parameters (oneOf/anyOf) carry no top-leveltype, matching therequestBodyschema right below it. The runtime already flattens unions.Validation: semantic spec ⇒ same blueprint
Built blueprints from seam-connect's POST-mirrored spec (main) and its regenerated semantic-method spec (seam-connect#17333), then compared endpoint-by-endpoint:
[POST,PUT]→[PUT,POST]; samesemanticMethod)PUTremoved (methods3→2,semanticMethodPUT→PATCH)/access_codes/update,/noise_sensors/noise_thresholds/update— these previously documented the deprecated PUT as the semantic method/seam/console/v1/get_resource_locatorgainsuuidThe 5-endpoint gap is in nextlove's generation, not blueprint:
/access_grants/get,/access_methods/delete,/connected_accounts/get,/spaces/get,/user_identities/getuse union-typed (z.union)commonParams. The generated schema has no top-level.properties(onlyoneOf), so nextlove's GET generation emits no query parameters at all — the information is absent from the semantic spec, and blueprint cannot recover it. (The old POST body carried the fulloneOf, which blueprint flattened into all-optional params.) A companion nextlove PR flattens union schemas into query parameters, after which these 5 converge too.Also
npm testpasses in full — including theseam-blueprintsnapshot against the real published@seamapi/typesspec, which proves old-spec output is unchanged — plus two new unit tests: a semantic-method endpoint (methods[GET, POST], params from query) and a deep-equality test that a semantic-method spec produces the same endpoint object as its POST-mirrored equivalent.🤖 Generated with Claude Code
https://claude.ai/code/session_01UgJLypfYKgaoAYq7fKy4fs
Generated by Claude Code