Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

openapi.yamlに関してのlinterを設定 #25

Merged
merged 8 commits into from
Nov 28, 2022
Merged

Conversation

yossydev
Copy link

@yossydev yossydev commented Nov 24, 2022

やったこと

やってないこと

  • npm run build:packagesは差分が多くなりそうだったので後に行います。

確認したいこと

  • 設定したopenapi lint内容
    • tagsを必須に
    • operationIdをキャメルケースに統一

OpenApiのルール内容

  • info部分

    • description必須
    • contact必須 ⇦ 一旦Anycloudで設定していますが、必要なければoffにします🙇‍♂️
  • servers部分

    • urlとdescriptionが必須 ⇦ 一旦mockserverのurlのみ追加
  • tags部分

    • グローバルにnameとdescriptionの設定が必要
    • 設定したものをそれぞれのapiの箇所で使う

@yossydev yossydev self-assigned this Nov 24, 2022
OperationObject:
- '#PathItem[get,put,post,delete,options,head,patch,trace]'
rules:
oas3-valid-media-example: off
Copy link
Author

@yossydev yossydev Nov 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stoplightのバグで、

OpenAPIが定義しているexampleオブジェクトについて知らないので、idをスキーマidとして解釈している

というものがあり、色々試しましたが解消ができなかったのでlintをoffにしています。

対象 Issue

@@ -0,0 +1,15 @@
name: OpenAPI validation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spectral.yamlってファイル名だと何やってるかよくわからないので、check_openapi_format.yamlとかもうちょい直感的にわかる名前にしてほしいかもな

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f713f9b こちらにて、check_openapi_format.yamlに修正しました🙇‍♂️

- uses: actions/checkout@v2

- name: Lint OpenAPI
run: npx @stoplight/spectral-cli lint openapi.yaml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これをローカルでもnpm run lint で走らせられるようにpackage.json変更しといてもらっていいかな?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あ、承知しました!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

346705d こちらにて修正しました🙇‍♂️

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここもnpm run lint で書き換えてもらえると

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bf68749 こちらにて修正しました!🙇‍♂️

Copy link
Collaborator

@muraikenta muraikenta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@yossydev yossydev merged commit 73e2a47 into main Nov 28, 2022
@yossydev yossydev deleted the feature/opneapi-linter branch November 28, 2022 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants