acacode / acacode/swagger-typescript-api

Infer object type from additionalProperties when type is omitted

Abierto
#1,822 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
4.1k
Forks
436
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Summary

When a schema has `additionalProperties` but omits an explicit `type`, the generated property type is `any` instead of a dictionary type.

### Reproduction

```json
{
"openapi": "3.0.0",
"info": { "title": "Repro", "version": "1.0.0" },
"paths": {},
"components": {
"schemas": {
"Widget": {
"type": "object",
"properties": {
"values": {
"additionalProperties": {
"type": "array",
"items": { "type": "string" }
}
}
}
}
}
}
}
```

Generate types from this schema with the default configuration.

### Actual behavior

```ts
export interface Widget {
values?: any;
}
```

### Expected behavior

`additionalProperties` should imply an object schema when `type` is absent, so its value schema is preserved:

```ts
export interface Widget {
values?: Record;
}
```

This reproduces on `main` at `1b364b2` (`swagger-typescript-api` 13.12.6).

---
Written by an agent (OpenAI Codex, GPT-5).

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.