Skip to content

OpenApi.fromApi corrupts JSON.rawJSON on cache hits #7239

Description

@isnifer

What version of Effect is running?

4.0.0-rc.108

What steps can reproduce the bug?

Run the same Effect Play example with these versions:

The example calls OpenApi.fromApi twice for an API whose OpenAPI transform adds a
JSON.rawJSON("9223372036854775807") value.

What is the expected behavior?

Both calls should serialize the value as the exact JSON number:

{"value":9223372036854775807}

What do you see instead?

In 4.0.0-rc.108, the first call is correct, but the cached second call serializes:

{"value":{"rawJSON":"9223372036854775807"}}

4.0.0-beta.107 serializes the exact JSON number on both calls.

Additional information

This appears to be caused by cloneOpenAPISpec, added in #6550. The clone copies the enumerable rawJSON property into a plain object and loses the special JSON.rawJSON behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions