설명
표준 숫자 format을 지정할 때는 integer에 int32 또는 int64를, number에 float 또는 double을 사용하세요. format은 생략할 수 있습니다.
잠재적 영향
도구가 형식을 인식하지 못하면 SDK가 예상과 다른 숫자 타입을 생성할 수 있습니다.
해결 방법
실제 값에 맞는 형식을 선택하세요. 사용자 정의 형식을 사용한다면 대표 값으로 검증 결과와 생성된 SDK의 직렬화 결과를 확인하세요.
예시
예시는 정수 id의 형식을 int64로, 숫자 percentage의 형식을 float로 바꿉니다.
변경 전
json
{
"openapi": "3.0.0",
"components": {
"schemas": {
"MyObject": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "double"
},
"percentage": {
"type": "number",
"format": "int32"
}
}
}
}
}
}
변경 후
json
{
"openapi": "3.0.0",
"components": {
"schemas": {
"MyObject": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"percentage": {
"type": "number",
"format": "float"
}
}
}
}
}
}