Visitar URL original
DaprContainer withComponent(path) incorrectly parses the type field · Issue #1368 · dapr/java-sdk · GitHub
Skip to content

DaprContainer withComponent(path) incorrectly parses the type field #1368

Closed

Description

@joebowbeer

Expected Behavior

DaprContainer withComponent(path) correctly parses the type field.

Actual Behavior

DaprContainer withComponent(path) incorrectly parses the type field.

The type is read from the root level:

String type = (String) component.get("type");

But the type is actually stored in the spec:

The test currently passes because it replaces the actual type with null, but should be state.redis:

Steps to Reproduce the Problem

Change the expected type to state.redis in the DaprComponentTest and observe the failure.

NOTE: withComponent(path) is also parsing the spec.metadata incorrectly.

The expected metadata should match that in the statestore.yaml file:

    const expectedComponentYaml =
        "apiVersion: dapr.io/v1alpha1\n"
      + "kind: Component\n"
      + "metadata:\n"
      + "  name: statestore\n"
      + "spec:\n"
      + "  type: state.redis\n"
      + "  version: v1\n"
      + "  metadata:\n"
      + "  - name: keyPrefix\n"
      + "    value: name\n"
      + "  - name: redisHost\n"
      + "    value: redis:6379\n"
      + "  - name: redisPassword\n"
      + "    value: \"\"\n"

Release Note

RELEASE NOTE:

Activity

  1. added this to the v1.16 milestone on Aug 19, 2025
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

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions