What version of Effect is running?
3.21.2
What steps can reproduce the bug?
import { HttpApi, HttpApiEndpoint, HttpApiGroup, OpenApi } from "@effect/platform"
import { Schema } from "effect"
const Api = HttpApi.make("Api").add(
HttpApiGroup.make("group").add(
HttpApiEndpoint.get("endpoint")`/`
.addSuccess(Schema.Literal("a", "b").annotations({ title: "Letter" }))
)
)
const spec = OpenApi.fromApi(Api)
console.dir(spec.paths["/"].get?.responses["200"].content?.["application/json"]?.schema, { depth: null })
What is the expected behavior?
Should log { type: 'string', enum: [ 'a', 'b' ], title: 'Letter' }, with the title annotation.
What do you see instead?
Logs { type: 'string', enum: [ 'a', 'b' ] }, without the title annotation.
Additional information
In the internal process of unifying ASTs of Union types, it is recreating the Union AST, therefore discarding its annotations.
It can cause problems like missing information in OpenApi specs and not respecting the encoding method and HTTP status declared as annotations.
What version of Effect is running?
3.21.2
What steps can reproduce the bug?
What is the expected behavior?
Should log
{ type: 'string', enum: [ 'a', 'b' ], title: 'Letter' }, with the title annotation.What do you see instead?
Logs
{ type: 'string', enum: [ 'a', 'b' ] }, without the title annotation.Additional information
In the internal process of unifying ASTs of Union types, it is recreating the Union AST, therefore discarding its annotations.
It can cause problems like missing information in OpenApi specs and not respecting the encoding method and HTTP status declared as annotations.