-
Notifications
You must be signed in to change notification settings - Fork 0
進捗報告 #1
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
base: main
Are you sure you want to change the base?
進捗報告 #1
Conversation
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.
[ほめ] 56グリッドシステム、JTCらしさが出ていていいですね。しっかり再現していてわかりやすいです。一般的には2と3を素因数に持っていてほしいのですが、まあもっと大事なこと考えてない故の方眼紙なので、これも味としましょう。
[必須] C13:C14
が空欄です。
[ノート]全体的に何を狙ったコードなのかが分からないです。コードを見る限り /examplePath
に 一つ get
と 200
を生やした程度のJSONファイルを出力しているように見えます。ベンダー Xxxxxxxxx
社とか XXX
社の形式が悪いといえばそれまでなのですが、OpenAPIのゴールと照らし合わせれば、これの存在意義はないと解さざるを得ません。GitHubは要件含む仕様以上の問題を解決する機能はないので、今後一緒に詰めていけたらと存じます。
} | ||
else: | ||
nested_property = { | ||
row['項目(英名)']: { |
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.
[質問]
Sample.xlsx.csvを読み取らせたとき、下記のようなエラーが表示されました。キーがなくなる原因、または正しいファイルを頂けますか?内部で回して頂いて構いません。
KeyError: '項目(英名)'
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.
こちらの環境でもcsvファイルによって発生することがあり疑問だったのですが、確認したところ、このJSONへの変換プログラムはOfficeスクリプトでcsvを整形せずに出力する場合で試した際のプログラムでした。今回のpushにはcsvを整形して出力するようなOfficeスクリプトと、そのスクリプトで生成したcsvファイルをサンプルとして格納しているため、実行がうまくいかなかったのだと思います。期待した結果通り実行できるcsvファイルをDiscordでお送りします。
ただ、csvを読み取る方式から変更しようとしているため実装として変わる可能性が高いです。
@@ -0,0 +1,6 @@ | |||
No,階層,項目名(日本語),項目名(英語),データ型,桁数,必須,入出力区分,種別,項目の説明,値の例 | |||
1,1,コンテンツタイプ,content-type,string,y,入力,HEADER,レスポンスヘッダーのコンテンツタイプ,application/json;charset=utf-8 |
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.
[推奨]CSVのカラム数が一致しません。一部の実装系で正しく処理できず、表示ができないので、目視で対応するのが大変だなと思います。
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.
Officeスクリプトを使ってcsv化した際に、Excel方眼紙に対して実行すると一部項目が抜けてしまう(うまく変換できない)ことは理解しており、その点pandasを使えばわざわざExcelをcsvに変換せずにpandas.DataFrameとしてうまく処理ができそうということもあり、Pythonだけでの実装を現在進めています。
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.
第二弾
|
||
for row in reader: | ||
hierarchy = row['階層'].split('.') | ||
if row['項目(英名)'] == 'Content-Type': |
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.
[推奨]カラム「種別区分」を適切に使用して処理をしていただきたいです
[推奨]Content-Typeはヘッダには定義しないでいただきたいです。仕様上は合っていますが、それを含めるとヘッダを出力するようなコードをバックエンド側で書かなければならないと、自動生成コードの都合上なってしまいます。レスポンスMIMEタイプはレスポンスボディの方で定義に入れてください。
reader = csv.DictReader(file) | ||
components_schemas = {} | ||
path_specs = { | ||
"/examplePath": { |
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.
[必須]パス名を変更できるようにしてください
[必須]複数のパス名とメソッドの組を定義してください
path_specs = { | ||
"/examplePath": { | ||
"get": { | ||
"summary": "Example summary", |
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.
[必須]operationIdを記載してください。CSVカラムも追加してください。
} | ||
|
||
current_level[next_level]["properties"].update(properties) | ||
return current_level |
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.
[任意]current_levelがdictなら、参照渡しになるので、in-placeでアップデートする関数であるとした方が私は好みだな
if not hierarchy: | ||
return properties | ||
|
||
next_level = hierarchy.pop(0) |
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.
[質問] hierarchyはどんな変数ですか?ドキュメンテーションを行うことで回答に代えてもよいです。
else: | ||
nested_property = { | ||
row['項目(英名)']: { | ||
"type": "string" if row['データ型'] == 'string' else "integer", |
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.
[必須]objectやarrayにも対応してください。
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.
第二弾
@yuki-js |
を含みます。
今後の方向性として考えているのは、pandasでExcelを入力できるようなので、Officeスクリプトを使わずにすべてPythonで完結させることを考えています。
pd_read_excel.pyはExcelの特定シートを読み込むスクリプトです。