-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
OperationObject: | ||
- '#PathItem[get,put,post,delete,options,head,patch,trace]' | ||
rules: | ||
oas3-valid-media-example: off |
There was a problem hiding this comment.
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
.github/workflows/spectral.yaml
Outdated
@@ -0,0 +1,15 @@ | |||
name: OpenAPI validation | |||
|
There was a problem hiding this comment.
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とかもうちょい直感的にわかる名前にしてほしいかもな
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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変更しといてもらっていいかな?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あ、承知しました!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
346705d こちらにて修正しました🙇♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここもnpm run lint で書き換えてもらえると
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bf68749
こちらにて修正しました!🙇♂️
…o feature/opneapi-linter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
やったこと
npx @stoplight/spectral-cli lint openapi.yaml
を使って、openapiのrules通りになるように修正。(一応vscodeの拡張機能エディター上でもlintの確認ができます https://marketplace.visualstudio.com/items?itemName=stoplight.spectral)
SpectralでOpenAPI Specをlintしたい! を参考に、CIの設定。
やってないこと
npm run build:packages
は差分が多くなりそうだったので後に行います。確認したいこと
OpenApiのルール内容
info部分
servers部分
tags部分