Issues with OpenAPI Schema Generation for Record Endpoints in Effect Typescript Library
Hey, we are having an issue with the OpenAPI schema generation for endpoints that return a record.
The response schema is something like
Effect uses
- There is no example value generated for that response, it only shows
- Tools that generate types from an OpenAPI schema might have issues to generate proper types for that response.
I managed to fix it by using
Could it maybe be configurable how records like this are represented in the schema or is there a better fix already?
The response schema is something like
Schema.Record({key: Schema.String, value: SomeStructSchema})Effect uses
patternProperties to represent this in the OpenAPI schema which has some issues:- There is no example value generated for that response, it only shows
{}- Tools that generate types from an OpenAPI schema might have issues to generate proper types for that response.
openapi-ts for example generates Record<string, never> from that. Not sure if that is a common issue with those type of tools though.I managed to fix it by using
OpenApi.Transform to manually modify the schema to use additionalProperties instead but it's a bit messy and not typechecked.Could it maybe be configurable how records like this are represented in the schema or is there a better fix already?
