Open Api Generator having issues with api.github.com.json
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Bắt đầu với lược đồ api.github.com.json được tham chiếu trong issue và tái hiện quá trình tạo bằng OpenAPI Generator 7.11.0 với cấu hình Java đã cho. So sánh model ContentDirectory được tạo với các khai báo content-directory ban đầu và đã sửa đổi; hoàn tất khi quá trình tạo không còn tạo ra utility model có tên sai.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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")
}
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 1.6k
- Fork
- 345
- Merge trung bình
- 6 giờ
- Pull request đã merge (30 ngày)
- 82
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/rest-api-description
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
github/rest-api-description#7266 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
github/rest-api-description#7246 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
github/rest-api-description#7220 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
github/rest-api-description#7201 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/rest-api-description#7163 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của github/rest-api-description
Issue tương tự
-
company delete fails with 500 on any company that has activity (cost events, inbox dismissals)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
paperclipai/paperclip#14982 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
cbor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
FasterXML/jackson-dataformats-binary#844 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
HasBacktrace Priority-Critical
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
azerothcore/azerothcore-wotlk#27921 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
lawndoc/stack-back#123 ·
-
type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày