Skip to content

Conversation

yuji38kwmt
Copy link
Collaborator

@yuji38kwmt yuji38kwmt commented Sep 10, 2025

generated_api.py

以下のメソッドが追加されました。

get_editor_annotations_in_bulk
get_input_data_in_bulk
get_supplementary_data_in_bulk
get_tasks_in_bulk

@yuji38kwmt yuji38kwmt changed the title Add api Annofab v0.206.0対応 Sep 10, 2025
@yuji38kwmt yuji38kwmt requested a review from Copilot September 10, 2025 17:21
@kci-pr-agent
Copy link

kci-pr-agent bot commented Sep 10, 2025

Title

Add api


Description

・バルク取得APIとレスポンスモデルを追加
・ドキュメントリンクを#section→#tagに更新
・認証スキームEveryoneAnnofabUserに統一
・Swaggerバージョンを0.206.0へ更新


Changes walkthrough 📝

Relevant files
Enhancement
generated_api.py
Bulk取得メソッド追加とドキュメントリンク修正                                                                 
+147/-30
models.py
Bulk取得用型定義を追加                                                                                       
+112/-12
get_supplementary_data_in_bulk_response.py
補助情報バルクレスポンスモデル追加                                                                               
+105/-0 
get_editor_annotations_in_bulk_response.py
アノテーションバルクレスポンスモデル追加                                                                         
+105/-0 
get_input_data_in_bulk_response.py
入力データバルクレスポンスモデル追加                                                                             
+103/-0 
get_tasks_in_bulk_response.py
タスクバルクレスポンスモデル追加                                                                                 
+103/-0 
annotations_by_input_data_id_identifier.py
アノテーション所属先型定義追加                                                                                   
+82/-0   
supplementary_data_by_input_data_id_identifier.py
補助情報所属先型定義追加                                                                                         
+81/-0   
input_data_identifier.py
入力データ識別子型定義追加                                                                                       
+81/-0   
task_identifier.py
タスク識別子型定義追加                                                                                           
+81/-0   
user_cache_record.py
キャッシュモデルから`projects`削除                                                                     
+2/-5     
organization_cache_record.py
キャッシュモデルから不要プロパティ削除                                                                           
+2/-6     
Documentation
plugin_detail_task_assignment.py
カスタム割当URL説明文リンク修正                                                                               
+1/-1     
generated_api2.py
v2APIドキュメントリンクタグ化修正                                                                           
+5/-40   
plugin_detail_extended_annotation_specs.py
ユーザー定義型リンク修正                                                                                         
+1/-1     
annotation_specs.py
Simple Annotationリンク修正                                                                     
+2/-2     
internationalization_message.py
Annotation ZIPリンクタグ化                                                                         
+1/-1     
label_v3.py
フィールド定義リンクタグ化修正                                                                                   
+1/-1     
put_annotation_thumbnail_body.py
Thumbnail更新APIリンク修正                                                                           
+1/-1     
Configuration changes
swagger-api-components.yaml
認証スキーム`Everyone`を`AnnofabUser`に置換                                               
+136/-43
swagger.v2.yaml
Swaggerバージョンを0.206.0へ更新                                                                   
+10/-113
Additional files
pydantic_models.rst +64/-0   
swagger.yaml +232/-56

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • Copy link

    @Copilot Copilot AI left a 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
    Copy link
    Preview

    Copilot AI Sep 10, 2025

    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`を指定して、所属組織変更を実施した場合
    Copy link
    Preview

    Copilot AI Sep 10, 2025

    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.

    Suggested change
    description: クエリパラメータに`v=2`を指定して、所属組織変更を実施した場合
    description: クエリパラメータに`v=2`を指定し、かつ実際に所属組織の変更が行われた場合に返されます。

    Copilot uses AI. Check for mistakes.

    @kci-pr-agent
    Copy link

    kci-pr-agent bot commented Sep 10, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    ドキュメント誤記

    get_project_inputs_url のドキュメント文字列に「SON構造」とあり、正しくは「JSON構造」と推測されます。説明文を修正してください。

    入力データ全件ファイルにアクセスするための認証済み一時URLを取得します取得したURLは1時間で失効しアクセスできなくなります入力データ全件ファイルはすべての入力データが記載されたJSONファイルですSON構造は、[InputData](#tag/x-data-types/InputData)の配列です。 ただしInputData中のurlは常にnullです。  毎日AM02:00(JST)頃に更新されます。 [postProjectInputsUpdate](#operation/postProjectInputsUpdate) APIを利用すれば、手動で入力データ全件ファイルを更新できます。
    Bulk APIドキュメント整合性

    新規追加されたbulk取得メソッド(例: get_tasks_in_bulk)の query_params 引数説明で list[str] と記載されていますが、関数シグネチャは dict[str, Any] です。型や使用例の整合性を確認してください。

    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)

    Comment on lines +238 to +267
    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)
    Copy link

    Choose a reason for hiding this comment

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

    Suggestion: query_paramsNone または必須キー input_data_id を含まない場合に早期に例外を投げるようバリデーションを追加してください。API 呼び出し前に必須パラメータの漏れを検知できます。 [possible issue, importance: 5]

    Suggested change
    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)

    Comment on lines +642 to +668
    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)
    Copy link

    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]

    Suggested change
    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)

    Comment on lines +2760 to +2788
    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)
    Copy link

    Choose a reason for hiding this comment

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

    Suggestion: query_paramsNone または input_data_id が空の場合に例外を投げるチェックを入れてください。不正な呼び出しを防げます。 [possible issue, importance: 5]

    Suggested change
    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)

    Comment on lines +3027 to +3053
    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)
    Copy link

    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]

    Suggested change
    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]
    Copy link

    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]

    Suggested change
    example: [task_1,task_2,task_3]
    example: ["task_1","task_2","task_3"]

    Comment on lines 2910 to 2911
    security:
    - AllProjectMember: []
    Copy link

    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]

    Suggested change
    security:
    - AllProjectMember: []
    security:
    - AllProjectMember: []

    Comment on lines +42 to +45
    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())
    Copy link

    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]

    Suggested change
    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)

    @yuji38kwmt yuji38kwmt merged commit 93506e0 into main Sep 10, 2025
    8 checks passed
    @yuji38kwmt yuji38kwmt deleted the add-api branch September 10, 2025 17:26
    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.

    1 participant