Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[State CosmosDB] Preserve property order #3373

Open
RobertConanMcMillan opened this issue Mar 4, 2024 · 1 comment
Open

[State CosmosDB] Preserve property order #3373

RobertConanMcMillan opened this issue Mar 4, 2024 · 1 comment
Labels
help wanted Extra attention is needed kind/enhancement New feature or request size/XS 2 days of work
Milestone

Comments

@RobertConanMcMillan
Copy link

When reading an entry from a CosmosDB backed state store, properties are returned in seemingly random order, often shuffled differently on each fetch.

This breaks System.Text.Json polymorphism, as the $type (or other delimiter) must be the first property read in an object.

Expected Behavior

The JSON should not be modified or altered, when read from the state store.

When the value:

{
    "$type": "some-type",
    "value": "some-value"
}

Is stored in the state store, get state should return:

{
    "$type": "some-type",
    "value": "some-value"
}

Actual Behavior

When the value:

{
    "$type": "some-type",
    "value": "some-value"
}

Is stored in the state store, get state will randomly return either:

{
    "$type": "some-type",
    "value": "some-value"
}

or

{
    "value": "some-value"
    "$type": "some-type"
}

Steps to Reproduce the Problem

  1. Store JSON value in state.azure.cosmosdb state store
  2. Read value from state store
  3. Compare JSON property order

Release Note

RELEASE NOTE: FIX CosmosDB state returns shuffled JSON

@RobertConanMcMillan RobertConanMcMillan added the kind/bug Something isn't working label Mar 4, 2024
@berndverst
Copy link
Member

The Dapr API does not make any guarantees about the ordering of fields. This is not part of our API contract @RobertConanMcMillan. Therefore I do not see this as a bug.

However, I'm happy to accept PRs.

@berndverst berndverst added kind/enhancement New feature or request and removed kind/bug Something isn't working labels Mar 7, 2024
@berndverst berndverst added this to the v1.14 milestone Mar 7, 2024
@berndverst berndverst added size/XS 2 days of work help wanted Extra attention is needed labels Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed kind/enhancement New feature or request size/XS 2 days of work
Projects
None yet
Development

No branches or pull requests

2 participants