OpenAPITools / OpenAPITools/openapi-generator
[BUG][Java][Spring] implicitHeaders replace the - in header name by a camelCased name
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 26.8k
- Fork
- 7.7k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- 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?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Using the maven plugin configuration with implicitHeaders and with this API specification :
openapi: 3.0.2
info:
title: Whatever
version: 1.0.0
paths:
/Whatever:
summary: Get Whatever
parameters:
- name: 'X-Whatever-Code'
in: header
required: true
description: Whatever
allowEmptyValue: false
schema:
type: string
get:
responses:
'200':
description: Whatever
content:
application/json:
schema:
type: string
The name of the implicit param is defined to xWhateverCode instead of X-Whatever-Code
@ApiImplicitParams({
@ApiImplicitParam(name = "xWhateverCode", value = "Whatever", required=true, dataType = "String", paramType = "header"),
})
openapi-generator version
4.3.1
OpenAPI declaration file content or url
openapi: 3.0.2
info:
title: Whatever
version: 1.0.0
paths:
/Whatever:
summary: Get Whatever
parameters:
- name: 'X-Whatever-Code'
in: header
required: true
description: Whatever
allowEmptyValue: false
schema:
type: string
get:
responses:
'200':
description: Whatever
content:
application/json:
schema:
type: string
Generation Details
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.3.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<output>${openapi.generation.directory}</output>
<inputSpec>src/main/resources/openapi.yaml</inputSpec>
<generatorName>spring</generatorName>
<apiPackage>com.whatever.api.controller</apiPackage>
<modelPackage>com.whatever.api.model</modelPackage>
<generateSupportingFiles>false</generateSupportingFiles>
<configOptions>
<sourceFolder>.</sourceFolder>
<groupId>whatever</groupId>
<invokerPackage>com.whatever.api</invokerPackage>
<dateLibrary>java8</dateLibrary>
<artifactId>whatever-api</artifactId>
<artifactVersion>1.0.0</artifactVersion>
<configPackage>com.whatever.configuration</configPackage>
<basePackage>com.whatever</basePackage>
<reactive>true</reactive>
<interfaceOnly>true</interfaceOnly>
<skipDefaultInterface>true</skipDefaultInterface>
<implicitHeaders>true</implicitHeaders>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Steps to reproduce
Simply generate the source code with the configurations above
Related issues/PRs
Seems to be a similar problem with Kotlin generation : https://github.com/OpenAPITools/openapi-generator/issues/7322
Suggest a fix
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.
Hướng nghiên cứu
Bắt đầu từ điểm đầu vào của Spring generator được Maven plugin sử dụng và theo dõi cách tùy chọn implicitHeaders chuyển đổi tên header OpenAPI X-Whatever-Code. Tái hiện vấn đề bằng đặc tả OpenAPI 3.0.2 và cấu hình Spring được cung cấp, sau đó xác minh rằng metadata @ApiImplicitParam được tạo ra vẫn giữ nguyên tên header như mong đợi và thêm hoặc cập nhật generator test liên quan nếu tìm thấy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java, spring
- Lĩnh vực
- api, backend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100