@effect/openapi-generator: generated output triggers the language service `schemaNumber` and `unnecessaryTypeofType` diagnostics
Los mantenedores suelen responder en 1 día
Ya se ha fusionado un pull request relacionado.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 58/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- openapi, typescript
Línea de trabajo
Start at the @effect/openapi-generator path handling generator.generate with format: 'httpclient', using the minimal OpenAPI spec in the issue to reproduce the output. Check generated number schemas and operation response types against the language-service diagnostics, then verify the output also avoids the reported unused decodeError case under noUnusedLocals.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The httpclient output of @effect/openapi-generator 4.0.0-rc.112 is flagged by @effect/language-service (via @effect/tsgo 0.38.0) with two suggestion diagnostics that the generator could avoid by construction.
Reproduction (spec in the collapsed block below, format: 'httpclient'):
const generator = await Effect.runPromise(OpenApiGenerator.make);
const out = await Effect.runPromise(
generator.generate(spec, { name: 'ReproClient', format: 'httpclient' }),
);
Generated (abridged):
export const Addon = Schema.Struct({
"id": Schema.Number.check(Schema.isInt().annotate({ "expected": "an integer" })),
"downloads": Schema.Number.check(Schema.isFinite().annotate({ "expected": "a finite number" })),
})
// ...
readonly "getAddon": <Config extends OperationConfig>(id: string, options: ...) =>
Effect.Effect<WithOptionalResponse<typeof GetAddon200.Type, Config>, HttpClientError.HttpClientError | SchemaError>
tsc with the language-service plugin reports:
repro.ts(11,51): suggestion TS377098: This Schema number API accepts `NaN`, `Infinity`, and `-Infinity`. Use `Schema.Finite` for finite domain numbers. ... effect(schemaNumber)
repro.ts(11,140): suggestion TS377098: ... effect(schemaNumber)
repro.ts(98,170): suggestion TS377090: This `typeof ... .Type` query can be replaced with `GetAddon200`. effect(unnecessaryTypeofType)
Expected
- Numbers from JSON are always finite, so
Schema.Finite(andSchema.Intfortype: integer) would satisfyschemaNumber. The generator already appendsSchema.isFinite()fornumber, so the intent is there; only the base schema differs. - Operation signatures reference
typeof X.Typeeven though the generator emitsexport type X = ...for the same name in the same file. EmittingXwould satisfyunnecessaryTypeofType.
Since both tools live in this monorepo, it would be good for the generator's default output to pass the language service's defaults. We currently post-process the output (replace Schema.Number with Schema.Finite, and typeof X.Type with X when the alias exists), which works but should not be necessary.
Side observation: for a spec with no error responses, the generated client declares decodeError without using it, which fails under noUnusedLocals (TS6133).
Minimal spec
{
"openapi": "3.0.0",
"info": { "title": "Repro", "version": "1.0.0" },
"paths": {
"/addons/{id}": {
"get": {
"operationId": "getAddon",
"parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } }],
"responses": {
"200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Addon" } } } }
}
}
}
},
"components": {
"schemas": {
"Addon": {
"type": "object",
"required": ["id", "downloads"],
"properties": { "id": { "type": "integer" }, "downloads": { "type": "number" } }
}
}
}
}
Versions: @effect/openapi-generator 4.0.0-rc.112, effect 4.0.0-rc.112, @effect/tsgo 0.38.0.
- Lenguaje dominante
- TypeScript
- Estrellas
- 16.7k
- Forks
- 808
- Merge medio
- 10 h 13 min
- PR fusionados (30 d)
- 800
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Effect-TS/effect
-
RpcTest.makeClient: accept disableFatalDefectsPosiblemente ocupada @effect-bot la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Effect-TS/effect#9893 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
@effect/ai-anthropic: responses whose usage has only input_tokens and output_tokens fail to decode (Anthropic-compatible gateways)Posiblemente ocupada @effect-bot la tomó hoy. Abierto
Effect-TS/effect#9963 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
McpClient rejects McpServer's method-not-found response and fails later stdio requestsPosiblemente ocupada @effect-bot la tomó hoy. Abierto
Effect-TS/effect#9958 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
SQLite withTransaction: interrupting a queued transaction as it gets the connection leaks the connectionPosiblemente ocupada @effect-bot la tomó hoy. Abierto
Dificultad 4/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
ClickhouseMigrator records migrations as done before running them, so a failed migration is skipped on the next runPosiblemente ocupada @effect-bot la tomó hoy. Abierto
Effect-TS/effect#9956 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de Effect-TS/effect
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
outline/outline#14348 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
[Bug]: Agent import retains quotes in .env API keys followed by inline commentsPosiblemente ocupada @yxr-2025 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
elie222/rakazo#2322 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
awslabs/visual-asset-management-system#804 ·
Los mantenedores suelen responder en 1 día
-
用户目录有单引号时,热加载时YAML解析崩溃Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
dsh-market/dsh-market#1027 · 1 comentario ·
Los mantenedores suelen responder en 1 día