Open Api Generator having issues with api.github.com.json
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 42/100
Línea de trabajo
Comienza con el esquema api.github.com.json referenciado en la issue y reproduce la generación usando OpenAPI Generator 7.11.0 con la configuración de Java mostrada. Compara el modelo ContentDirectory generado con las declaraciones content-directory original y modificada; se considera terminado cuando la generación ya no produce el modelo de utilidad con el nombre incorrecto.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Issue
We were using the Open Api Generator(OAG) to generate some Java models based on the current OAS schema JSON . This generates a wrong-named model when it's doing the ContentDirectory Schema Model, which is called from here
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/content-directory"
},
{
"$ref": "#/components/schemas/content-file"
},
{
"$ref": "#/components/schemas/content-symlink"
},
{
"$ref": "#/components/schemas/content-submodule"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"array": "#/components/schemas/content-directory",
"file": "#/components/schemas/content-file",
"symlink": "#/components/schemas/content-symlink",
"submodule": "#/components/schemas/content-submodule"
}
}
}
Possible solution
To patch the bug, I've changed the definition of the schema to avoid the wrong-named model issue. This happens because when OAG couldn't figure out the logic or a declaration, it generates a utility model to patch this issue.
Here is the original ContentDirectory declaration:
"content-directory": {
"title": "Content Directory",
"description": "A list of directory items",
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"dir",
"file",
"submodule",
"symlink"
]
},
"size": {
"type": "integer"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"content": {
"type": "string"
},
"sha": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"git_url": {
"type": "string",
"format": "uri",
"nullable": true
},
"html_url": {
"type": "string",
"format": "uri",
"nullable": true
},
"download_url": {
"type": "string",
"format": "uri",
"nullable": true
},
"_links": {
"type": "object",
"properties": {
"git": {
"type": "string",
"format": "uri",
"nullable": true
},
"html": {
"type": "string",
"format": "uri",
"nullable": true
},
"self": {
"type": "string",
"format": "uri"
}
},
"required": [
"git",
"html",
"self"
]
}
},
"required": [
"_links",
"git_url",
"html_url",
"download_url",
"name",
"path",
"sha",
"size",
"type",
"url"
]
}
}
And here is the modified declaration that we used to patch the issue.
"content-directory": {
"title": "Content Directory",
"description": "A list of directory items",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"array"
]
},
"size": {
"type": "integer"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"content": {
"type": "string"
},
"sha": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"git_url": {
"type": "string",
"format": "uri",
"nullable": true
},
"html_url": {
"type": "string",
"format": "uri",
"nullable": true
},
"download_url": {
"type": "string",
"format": "uri",
"nullable": true
},
"_links": {
"type": "object",
"properties": {
"git": {
"type": "string",
"format": "uri",
"nullable": true
},
"html": {
"type": "string",
"format": "uri",
"nullable": true
},
"self": {
"type": "string",
"format": "uri"
}
},
"required": [
"git",
"html",
"self"
]
}
},
"required": [
"_links",
"git_url",
"html_url",
"download_url",
"name",
"path",
"sha",
"size",
"type",
"url"
]
}
This is the OAG version used to generate the model: 7.11.0
and the config used in the generator:
openApiGenerate {
generatorName.set("java")
inputSpec.set("$projectDir/src/main/resources/api.github.com.fixed.json")
outputDir.set("$buildDir")
apiPackage.set("com.github.client.api")
modelPackage.set("com.github.client.model")
configOptions.put("dateLibrary", "java8")
ignoreFileOverride.value("$projectDir/.openapi-generator-ignore")
configOptions.put("library", "apache-httpclient")
configOptions.put("sourceFolder", "generated/main/java")
configOptions.put("openApiNullable", "false")
configOptions.put("invokerPackage", "com.github.client")
}
- Lenguaje dominante
- Sin datos de lenguaje
- Estrellas
- 1.6k
- Forks
- 345
- Merge medio
- 6 h
- PR fusionados (30 d)
- 82
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
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 github/rest-api-description
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
github/rest-api-description#7266 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
github/rest-api-description#7246 ·
Los mantenedores suelen responder en 1 día
-
feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
github/rest-api-description#7220 ·
Los mantenedores suelen responder en 1 día
-
feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
github/rest-api-description#7201 ·
Los mantenedores suelen responder en 1 día
-
feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
github/rest-api-description#7163 ·
Los mantenedores suelen responder en 1 día
Todos los issues de github/rest-api-description
Issues similares
-
Change output crossing a compactsize boundary leaves the fee slightly below the requested feerateAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
bitcoindevkit/bdk_wallet#578 ·
Los mantenedores suelen responder en 8 días
-
Hydraulic gas_pressure omits the reference-density offset, breaking roundtrips and the pressure joinAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ethereum/execution-apis#915 ·
Los mantenedores suelen responder en 1 día
-
enhancement via-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
pingdotgg/t3code#14816 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
rename config parameterAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
OpenConext/OpenConext-access#1015 ·
Los mantenedores suelen responder en 1 día