Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Swagger.json operation Id needs naming rule #21

Closed
SungWoongz opened this issue Jul 5, 2024 · 4 comments
Closed

Swagger.json operation Id needs naming rule #21

SungWoongz opened this issue Jul 5, 2024 · 4 comments

Comments

@SungWoongz
Copy link

https://github.com/cloud-barista/cb-tumblebug/blob/70b65fbf530be0f8553602a82ad480f2fe756f0a/src/api/rest/docs/swagger.json

  • opration id가 id외에 불필요한 부가정보가 포함되어 있는 것들이 있습니다.
  • operation Id가 단순한 형태로 표현이 되었으면 좋겠습니다.
  • id에 특수문자는 배제 바랍니다.
    • GetMCISObject(Option-Status,AccessInfo,VmId): -> ( ) , - 포함됨
    • SetAK8sNodeGroupsAutoscalingOn/Off: -> / 포함됨
  • id가 복잡한 형태라 적절한 형태로 변경이 필요해 보입니다.
    • GetMCISObject(Option-Status,AccessInfo,VmId): -> GetMCISObject 정도면 되지 않을까요
    • CreateAndAddHomogeneousVMs(SubGroup)ToASpecifiedMCIS(SetSubGroupSizeForMultipleVMs) -> 너무길고 두가지 이상의 action이 있는 것 같아 단순하고 적절한 의미 부여된 형태로 변경 필요
  • 확인 부탁드립니다.
@seokho-son
Copy link
Member

@SungWoongz 안녕하세요. 의견 공유 감사합니다.

일단, 말씀하신 항목을 ooperationId에서 제가 검색할 수 없네요. 해당 라인 링크를 공유해주실 수 있으실까요?
4건 모두 검색이 안 됩니다.

        "/ns/{nsId}/mcis/{mcisId}/vm": {
            "post": {
                "description": "Create and add homogeneous VMs(subGroup) to a specified MCIS (Set subGroupSize for multiple VMs)",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "[Infra service] MCIS Provisioning management"
                ],
                "summary": "Create and add homogeneous VMs(subGroup) to a specified MCIS (Set subGroupSize for multiple VMs)",
                "operationId": "PostMcisVm",
                "parameters": [

Create and add homogeneous VMs(sub ... 관련 text도 summary/description에는 명시되어 있는데,

해당 api의 "operationId": "PostMcisVm", 로 지정되어 있는 것 같고요.

추가적으로 operationId 의 활용처도 문의 드립니다.
현재 cb-tb의 swagger api에서 operationId 는 단순 구분자 (api path가 복잡하므로, cli에서 api 구분 지원을 위한)를 지원하기 위해 제공하고 있으며, 현재는 내부 핸들러 함수명과 동일하게 하여 identification 되도록 만들어두었습니다.
Id 이며, 사용자급 휴먼 리더빌리티를 고려하지 않았음을 알려드립니다.

@seokho-son
Copy link
Member

@SungWoongz 안녕하세요. 상기 내용에 대한 답변 부탁드립니다.

@raccoon-mh
Copy link
Member

raccoon-mh commented Jul 9, 2024

@seokho-son 안녕하세요.

우선 이 이슈는 cm-mayfly (mc-admin-cli) 에서 API swagger.json 을 api.yaml 로 변환하며 찾았던 이슈 입니다.
해당 변환된 api.yaml 을 통해, webconsole 에서 operationId를 통해 엔드포인트를 찾기위한 방법으로 사용됩니다.(admincli와 비슷한 방식)

상기 이슈는 이전버전 swagger.json 을 참조해서 생겼던 것 같습니다.

아래는 현 swagger 를 변환했을때 보이는 api.yaml 입니다.

....
GetCloudInfo:
  method: get
  resourcePath: /cloudInfo
  description: "Get cloud information"
GetControlMcisVm:
  method: get
  resourcePath: /ns/{nsId}/control/mcis/{mcisId}/vm/{vmId}
  description: "Control the lifecycle of VM (suspend, resume, reboot, terminate)"
CheckHTTPVersion:
  method: get
  resourcePath: /httpVersion
  description: "Checks and logs the HTTP version of the incoming request to the server console."
....

현재로서는 이슈는 발견되지 않습니다.

@seokho-son
Copy link
Member

@SungWoongz @raccoon-mh
피드백 감사합니다. 그럼 이슈가 아닌 것으로 판단하고, close 하겠습니다. :)
혹시 관련 다른 사항이 있으면, 다시 reopen 해주세요.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants