Skip to content

fix(cli): flatten direct OpenAPI union references - #15

Open
uuzzrm wants to merge 1 commit into
langfuse:mainfrom
uuzzrm:codex/fix-cli-oneof-prompts-14609
Open

fix(cli): flatten direct OpenAPI union references#15
uuzzrm wants to merge 1 commit into
langfuse:mainfrom
uuzzrm:codex/fix-cli-oneof-prompts-14609

Conversation

@uuzzrm

@uuzzrm uuzzrm commented Aug 12, 2026

Copy link
Copy Markdown

What does this PR do?

Fixes langfuse/langfuse#14609.

The OpenAPI patch script only flattened discriminated oneOf schemas when each branch used the older allOf wrapper shape. The current prompt schemas use direct component references instead. As a result, langfuse api prompts create --help exposed no request-body flags and the documented type, name, and prompt example failed.

This change:

  • extracts the union flattening logic into a small testable module;
  • supports direct component-reference branches when their schemas expose a single-value enum discriminator;
  • keeps the existing allOf form working;
  • leaves untagged oneOf schemas untouched;
  • regenerates the bundled OpenAPI spec for the prompt and chat-message schemas.

Validation

  • bun test scripts/patch-openapi-logic.test.ts
  • bun test — 19 tests, 145 assertions
  • bun scripts/patch-openapi.ts (idempotent on the patched spec)
  • bun build src/cli.ts --outdir /tmp/langfuse-cli-14609-dist --target node --format esm
  • Verified prompts create --help shows --type, --name, and --prompt
  • Verified --curl produces the expected JSON body without making a network request
  • git diff --check

AI-assisted development was used for investigation and implementation; the fix and test suite were run locally against this checkout.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

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.

bug: langfuse-cli prompt create failure

1 participant