Skip to content

Polymorphic responses ignore the spec discriminator: ERROR probe results parse as UnsupportedProbeResult #496

Backlog

Description

@emilyoram

createProbe returns a polymorphic result. The spec (probes.yaml, ProbeResult) declares a discriminator on outcome with a mapping, and every variant has additionalProperties: false. The generated parser ignores both:

# generated/camunda_orchestration_sdk/api/probe/create_probe.py
try:   OKProbeResult.from_dict(data) ...
try:   UnsupportedProbeResult.from_dict(data) ...
return ErrorProbeResult.from_dict(data)

UnsupportedProbeResult.from_dict accepts any payload carrying outcome and worker, so an ERROR response is returned as UnsupportedProbeResult and its message is dropped. Reproduced by feeding {"outcome": "ERROR", "worker": "w", "message": "boom"} through create_probe._parse_response: the result is UnsupportedProbeResult with outcome == "ERROR".

The ErrorProbeResult branch in examples/probe.py (added in #494) therefore never runs against a real ERROR response.

Suggested direction: make union parsing dispatch on the declared discriminator (a generator hook, not a hand edit of generated code), and fall back to the current try-each-variant order only when there is none. Check the other x-polymorphic-schema responses for the same problem. Add a regression test using the payload above.

Found by the Copilot review on #494.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions