-
Notifications
You must be signed in to change notification settings - Fork 1
Annofab v0.206.0対応 #725
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
Annofab v0.206.0対応 #725
Conversation
TitleAdd api Description・バルク取得APIとレスポンスモデルを追加 Changes walkthrough 📝
|
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.
Pull Request Overview
このPRはAnnofab Web APIのv0.206.0への対応を行うもので、主にAPI仕様の更新とドキュメンテーションの改善を含んでいます。
- バージョンの更新: 0.203.1から0.206.0へ
- セキュリティスキーマの統合と簡素化(EveryoneからAnnofabUserへ)
- 新しいバルク取得APIエンドポイントの追加
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
generate/swagger/swagger.yaml | APIバージョン更新、セキュリティスキーマ統合、新規バルクAPIエンドポイント追加 |
generate/swagger/swagger.v2.yaml | バージョン更新とセキュリティスキーマ統合、一部エンドポイント削除 |
generate/swagger/swagger-api-components.yaml | セキュリティスキーマ統合、新規データモデル追加、ドキュメントリンク更新 |
docs/api_reference/pydantic_models.rst | 新規Pydanticモデルのドキュメント追加 |
annofabapi/pydantic_models/*.py | 新規バルク操作用のPydanticモデル実装、既存モデルの更新 |
annofabapi/models.py | 新規データ型定義の追加とドキュメントリンク更新 |
annofabapi/generated_api*.py | 新規APIメソッド追加と既存APIの更新 |
annofabapi/dataclass/annotation_specs.py | ドキュメントリンクの更新 |
Comments suppressed due to low confidence (1)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
また、AggregationResultの集約の件数は、合計で10000件以下に制限されており、それを超える件数がある場合は上位10000件が取得されます。もし、省略された部分を取得したい場合は、検索条件を縛って結果に上る集約の数を減らしてください。 | ||
version: 0.203.1 | ||
version: 0.206.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.
The typo 'SON構造' should be corrected to 'JSON構造' in line 2097.
Copilot uses AI. Check for mistakes.
$ref: "swagger-api-components.yaml#/components/schemas/Project" | ||
"202": | ||
description: 組織変更実施時 | ||
description: クエリパラメータに`v=2`を指定して、所属組織変更を実施した場合 |
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.
The description for the 202 response should be more specific about when this response occurs. It currently only mentions the query parameter but doesn't clarify that this only applies when an organization change is actually performed.
description: クエリパラメータに`v=2`を指定して、所属組織変更を実施した場合 | |
description: クエリパラメータに`v=2`を指定し、かつ実際に所属組織の変更が行われた場合に返されます。 |
Copilot uses AI. Check for mistakes.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
def get_editor_annotations_in_bulk( | ||
self, project_id: str, task_id: str, query_params: Optional[dict[str, Any]] = None, **kwargs | ||
) -> tuple[Any, requests.Response]: | ||
"""アノテーションのバルク取得 | ||
https://annofab.com/docs/api/#operation/getEditorAnnotationsInBulk | ||
authorizations: AllProjectMember | ||
アノテーションをバルク取得します。 このAPIは、[getEditorAnnotation](#operation/getEditorAnnotation) APIと似た機能を持ちますが、`input_data_id`を複数指定できる点が異なります。 | ||
Args: | ||
project_id (str): プロジェクトID (required) | ||
task_id (str): タスクID (required) | ||
query_params (dict[str, Any]): Query Parameters | ||
input_data_id (list[str]): 入力データID (required) | ||
Returns: | ||
tuple[GetEditorAnnotationsInBulkResponse, requests.Response] | ||
""" | ||
url_path = f"/projects/{project_id}/tasks/{task_id}/annotations-in-bulk" | ||
http_method = "GET" | ||
keyword_params: dict[str, Any] = { | ||
"query_params": query_params, | ||
} | ||
keyword_params.update(**kwargs) | ||
return self._request_wrapper(http_method, url_path, **keyword_params) |
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.
Suggestion: query_params
が None
または必須キー input_data_id
を含まない場合に早期に例外を投げるようバリデーションを追加してください。API 呼び出し前に必須パラメータの漏れを検知できます。 [possible issue, importance: 5]
def get_editor_annotations_in_bulk( | |
self, project_id: str, task_id: str, query_params: Optional[dict[str, Any]] = None, **kwargs | |
) -> tuple[Any, requests.Response]: | |
"""アノテーションのバルク取得 | |
https://annofab.com/docs/api/#operation/getEditorAnnotationsInBulk | |
authorizations: AllProjectMember | |
アノテーションをバルク取得します。 このAPIは、[getEditorAnnotation](#operation/getEditorAnnotation) APIと似た機能を持ちますが、`input_data_id`を複数指定できる点が異なります。 | |
Args: | |
project_id (str): プロジェクトID (required) | |
task_id (str): タスクID (required) | |
query_params (dict[str, Any]): Query Parameters | |
input_data_id (list[str]): 入力データID (required) | |
Returns: | |
tuple[GetEditorAnnotationsInBulkResponse, requests.Response] | |
""" | |
url_path = f"/projects/{project_id}/tasks/{task_id}/annotations-in-bulk" | |
http_method = "GET" | |
keyword_params: dict[str, Any] = { | |
"query_params": query_params, | |
} | |
keyword_params.update(**kwargs) | |
return self._request_wrapper(http_method, url_path, **keyword_params) | |
def get_editor_annotations_in_bulk( | |
self, project_id: str, task_id: str, query_params: Optional[dict[str, Any]] = None, **kwargs | |
) -> tuple[Any, requests.Response]: | |
"""アノテーションのバルク取得 ...""" | |
if not query_params or "input_data_id" not in query_params: | |
raise ValueError("`query_params` に必須キー `input_data_id` を含めて指定してください") | |
url_path = f"/projects/{project_id}/tasks/{task_id}/annotations-in-bulk" | |
http_method = "GET" | |
keyword_params: dict[str, Any] = {"query_params": query_params} | |
keyword_params.update(**kwargs) | |
return self._request_wrapper(http_method, url_path, **keyword_params) |
def get_input_data_in_bulk(self, project_id: str, query_params: Optional[dict[str, Any]] = None, **kwargs) -> tuple[Any, requests.Response]: | ||
"""入力データのバルク取得 | ||
https://annofab.com/docs/api/#operation/getInputDataInBulk | ||
authorizations: AllProjectMember | ||
入力データをバルク取得します。 このAPIは、[getInputData](#operation/getInputData) APIと似た機能を持ちますが、`input_data_id`を複数指定できる点が異なります。 | ||
Args: | ||
project_id (str): プロジェクトID (required) | ||
query_params (dict[str, Any]): Query Parameters | ||
input_data_id (list[str]): 入力データIDのカンマ区切りリスト (required) | ||
Returns: | ||
tuple[GetInputDataInBulkResponse, requests.Response] | ||
""" | ||
url_path = f"/projects/{project_id}/input-data-in-bulk" | ||
http_method = "GET" | ||
keyword_params: dict[str, Any] = { | ||
"query_params": query_params, | ||
} | ||
keyword_params.update(**kwargs) | ||
return self._request_wrapper(http_method, url_path, **keyword_params) |
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.
Suggestion: query_params
が指定されていない場合や input_data_id
キーがない場合に ValueError を投げるバリデーションを追加してください。不正リクエストを防止できます。 [possible issue, importance: 5]
def get_input_data_in_bulk(self, project_id: str, query_params: Optional[dict[str, Any]] = None, **kwargs) -> tuple[Any, requests.Response]: | |
"""入力データのバルク取得 | |
https://annofab.com/docs/api/#operation/getInputDataInBulk | |
authorizations: AllProjectMember | |
入力データをバルク取得します。 このAPIは、[getInputData](#operation/getInputData) APIと似た機能を持ちますが、`input_data_id`を複数指定できる点が異なります。 | |
Args: | |
project_id (str): プロジェクトID (required) | |
query_params (dict[str, Any]): Query Parameters | |
input_data_id (list[str]): 入力データIDのカンマ区切りリスト (required) | |
Returns: | |
tuple[GetInputDataInBulkResponse, requests.Response] | |
""" | |
url_path = f"/projects/{project_id}/input-data-in-bulk" | |
http_method = "GET" | |
keyword_params: dict[str, Any] = { | |
"query_params": query_params, | |
} | |
keyword_params.update(**kwargs) | |
return self._request_wrapper(http_method, url_path, **keyword_params) | |
def get_input_data_in_bulk( | |
self, project_id: str, query_params: Optional[dict[str, Any]] = None, **kwargs | |
) -> tuple[Any, requests.Response]: | |
"""入力データのバルク取得 ...""" | |
if not query_params or "input_data_id" not in query_params: | |
raise ValueError("`query_params` に必須キー `input_data_id` を含めて指定してください") | |
url_path = f"/projects/{project_id}/input-data-in-bulk" | |
http_method = "GET" | |
keyword_params: dict[str, Any] = {"query_params": query_params} | |
keyword_params.update(**kwargs) | |
return self._request_wrapper(http_method, url_path, **keyword_params) |
def get_supplementary_data_in_bulk( | ||
self, project_id: str, query_params: Optional[dict[str, Any]] = None, **kwargs | ||
) -> tuple[Any, requests.Response]: | ||
"""補助情報のバルク取得 | ||
https://annofab.com/docs/api/#operation/getSupplementaryDataInBulk | ||
authorizations: AllProjectMember | ||
補助情報をバルク取得します。 このAPIは、[getSupplementaryDataList](#operation/getSupplementaryDataList) APIと似た機能を持ちますが、`input_data_id`を複数指定できる点が異なります。 | ||
Args: | ||
project_id (str): プロジェクトID (required) | ||
query_params (dict[str, Any]): Query Parameters | ||
input_data_id (list[str]): 入力データIDのカンマ区切りリスト (required) | ||
Returns: | ||
tuple[GetSupplementaryDataInBulkResponse, requests.Response] | ||
""" | ||
url_path = f"/projects/{project_id}/supplementary-data-in-bulk" | ||
http_method = "GET" | ||
keyword_params: dict[str, Any] = { | ||
"query_params": query_params, | ||
} | ||
keyword_params.update(**kwargs) | ||
return self._request_wrapper(http_method, url_path, **keyword_params) |
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.
Suggestion: query_params
が None
または input_data_id
が空の場合に例外を投げるチェックを入れてください。不正な呼び出しを防げます。 [possible issue, importance: 5]
def get_supplementary_data_in_bulk( | |
self, project_id: str, query_params: Optional[dict[str, Any]] = None, **kwargs | |
) -> tuple[Any, requests.Response]: | |
"""補助情報のバルク取得 | |
https://annofab.com/docs/api/#operation/getSupplementaryDataInBulk | |
authorizations: AllProjectMember | |
補助情報をバルク取得します。 このAPIは、[getSupplementaryDataList](#operation/getSupplementaryDataList) APIと似た機能を持ちますが、`input_data_id`を複数指定できる点が異なります。 | |
Args: | |
project_id (str): プロジェクトID (required) | |
query_params (dict[str, Any]): Query Parameters | |
input_data_id (list[str]): 入力データIDのカンマ区切りリスト (required) | |
Returns: | |
tuple[GetSupplementaryDataInBulkResponse, requests.Response] | |
""" | |
url_path = f"/projects/{project_id}/supplementary-data-in-bulk" | |
http_method = "GET" | |
keyword_params: dict[str, Any] = { | |
"query_params": query_params, | |
} | |
keyword_params.update(**kwargs) | |
return self._request_wrapper(http_method, url_path, **keyword_params) | |
def get_supplementary_data_in_bulk( | |
self, project_id: str, query_params: Optional[dict[str, Any]] = None, **kwargs | |
) -> tuple[Any, requests.Response]: | |
"""補助情報のバルク取得 ...""" | |
if not query_params or "input_data_id" not in query_params: | |
raise ValueError("`query_params` に必須キー `input_data_id` を含めて指定してください") | |
url_path = f"/projects/{project_id}/supplementary-data-in-bulk" | |
http_method = "GET" | |
keyword_params: dict[str, Any] = {"query_params": query_params} | |
keyword_params.update(**kwargs) | |
return self._request_wrapper(http_method, url_path, **keyword_params) |
def get_tasks_in_bulk(self, project_id: str, query_params: Optional[dict[str, Any]] = None, **kwargs) -> tuple[Any, requests.Response]: | ||
"""タスクのバルク取得 | ||
https://annofab.com/docs/api/#operation/getTasksInBulk | ||
authorizations: AllProjectMember | ||
タスクをバルク取得します。 このAPIは、[getTask](#operation/getTask) APIと似た機能を持ちますが、`task_id`を複数指定できる点が異なります。 | ||
Args: | ||
project_id (str): プロジェクトID (required) | ||
query_params (dict[str, Any]): Query Parameters | ||
task_id (list[str]): タスクIDのカンマ区切りリスト (required) | ||
Returns: | ||
tuple[GetTasksInBulkResponse, requests.Response] | ||
""" | ||
url_path = f"/projects/{project_id}/tasks-in-bulk" | ||
http_method = "GET" | ||
keyword_params: dict[str, Any] = { | ||
"query_params": query_params, | ||
} | ||
keyword_params.update(**kwargs) | ||
return self._request_wrapper(http_method, url_path, **keyword_params) |
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.
Suggestion: query_params
に必須の task_id
が含まれているかをチェックし、欠如時は早期にエラーを返すバリデーションを追加してください。 [possible issue, importance: 5]
def get_tasks_in_bulk(self, project_id: str, query_params: Optional[dict[str, Any]] = None, **kwargs) -> tuple[Any, requests.Response]: | |
"""タスクのバルク取得 | |
https://annofab.com/docs/api/#operation/getTasksInBulk | |
authorizations: AllProjectMember | |
タスクをバルク取得します。 このAPIは、[getTask](#operation/getTask) APIと似た機能を持ちますが、`task_id`を複数指定できる点が異なります。 | |
Args: | |
project_id (str): プロジェクトID (required) | |
query_params (dict[str, Any]): Query Parameters | |
task_id (list[str]): タスクIDのカンマ区切りリスト (required) | |
Returns: | |
tuple[GetTasksInBulkResponse, requests.Response] | |
""" | |
url_path = f"/projects/{project_id}/tasks-in-bulk" | |
http_method = "GET" | |
keyword_params: dict[str, Any] = { | |
"query_params": query_params, | |
} | |
keyword_params.update(**kwargs) | |
return self._request_wrapper(http_method, url_path, **keyword_params) | |
def get_tasks_in_bulk( | |
self, project_id: str, query_params: Optional[dict[str, Any]] = None, **kwargs | |
) -> tuple[Any, requests.Response]: | |
"""タスクのバルク取得 ...""" | |
if not query_params or "task_id" not in query_params: | |
raise ValueError("`query_params` に必須キー `task_id` を含めて指定してください") | |
url_path = f"/projects/{project_id}/tasks-in-bulk" | |
http_method = "GET" | |
keyword_params: dict[str, Any] = {"query_params": query_params} | |
keyword_params.update(**kwargs) | |
return self._request_wrapper(http_method, url_path, **keyword_params) |
type: array | ||
items: | ||
$ref: "swagger-api-components.yaml#/components/schemas/TaskId" | ||
example: [task_1,task_2,task_3] |
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.
Suggestion: example
の配列要素は有効なJSON文字列として引用符で囲みます。他のbulk取得エンドポイントのexample
も同様に修正してください。 [general, importance: 7]
example: [task_1,task_2,task_3] | |
example: ["task_1","task_2","task_3"] |
security: | ||
- AllProjectMember: [] |
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.
Suggestion: security
下のリスト要素はインデントを2スペース深くして正しくネストしてください。 [possible issue, importance: 4]
security: | |
- AllProjectMember: [] | |
security: | |
- AllProjectMember: [] |
def to_json(self) -> str: | ||
"""Returns the JSON representation of the model using alias""" | ||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead | ||
return json.dumps(self.to_dict()) |
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.
Suggestion: TODOの通り、model_dump_json
を直接使用してJSON文字列を生成すると余計なjson.dumps
を避けられます。 [general, importance: 5]
def to_json(self) -> str: | |
"""Returns the JSON representation of the model using alias""" | |
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead | |
return json.dumps(self.to_dict()) | |
def to_json(self) -> str: | |
"""Returns the JSON representation of the model using alias""" | |
return self.model_dump_json(by_alias=True, exclude_unset=True) |
generated_api.py
以下のメソッドが追加されました。