[BUG][Rust] "X cannot be used as a model name. Renamed to X" is logged on every lookup of a hyphenated name
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Comienza con AbstractRustCodegen.sanitizeIdentifier y toModelName, y luego reproduce el comportamiento con el YAML de OpenAPI pet-record proporcionado y el comando de generación de Rust. Se considera terminado cuando el nombre con guion ya no produce una advertencia cuando el nombre original con sus mayúsculas y minúsculas y el nombre final coinciden, mientras que las renombraciones reales siguen produciendo advertencias y los archivos generados permanecen idénticos.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
Description
AbstractRustCodegen.sanitizeIdentifier counts the hyphen and period replacement as a rename and then logs the cased original next to the result. For a name like pet-record both are PetRecord, so the warning carries no information, and toModelName goes through it every time a model name is resolved.
On GitHub's REST description (api.github.com.2022-11-28.json at github/rest-api-description@3cef12e8, 12 MB) the rust generator logs 6,961,556 of these warnings. 6,958,297 have the same name on both sides; the other 3,259 are real renames such as ApplicationJson cannot be used as a model name. Renamed to ApplicationSlashJson. The run takes 4 min 39 s and writes a 1.0 GB log. With the warning limited to real renames the same run takes 5.0 s, writes 2 MB of log, and generates identical files.
openapi-generator version
7.25.0, and master at 10e6c21.
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: hyphenated schema name
version: "1"
paths:
/pets:
get:
operationId: listPets
responses:
"200":
description: ok
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/pet-record"
components:
schemas:
pet-record:
type: object
properties:
name:
type: string
Generation Details
java -jar openapi-generator-cli-7.25.0.jar generate -g rust -i spec.yaml -o out
Steps to reproduce
The command prints this line 16 times:
[main] WARN o.o.c.languages.AbstractRustCodegen - PetRecord cannot be used as a model name. Renamed to PetRecord
Expected: no warning, since the name only changed case.
Suggest a fix
Warn only when the final name differs from the cased original.
- Lenguaje dominante
- Java
- Estrellas
- 26.8k
- Forks
- 7.7k
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 103
Preparar el entorno
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 OpenAPITools/openapi-generator
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
OpenAPITools/openapi-generator#24997 ·
Los mantenedores suelen responder en 1 día
-
Issue: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
OpenAPITools/openapi-generator#24859 ·
Los mantenedores suelen responder en 1 día
-
[BUG][KOTLIN] Fails to compile after updating to 7.25.0 with useJackson3=false useSpringBoot4=trueAbiertoIssue: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
OpenAPITools/openapi-generator#24842 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
OpenAPITools/openapi-generator#24830 ·
Los mantenedores suelen responder en 1 día
-
Issue: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
OpenAPITools/openapi-generator#24816 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de OpenAPITools/openapi-generator
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
openhab/openhab-core#5847 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
apache/parquet-java#3820 ·
Los mantenedores suelen responder en 1 día
-
Base64Variant.decodeBase64Byte() crashes on non-ASCII char instead of returning BASE64_VALUE_INVALIDAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100