From 887ded5714b9d79e14ef96a0ca16914840eb9e3c Mon Sep 17 00:00:00 2001 From: Eric Schubert Date: Thu, 12 Feb 2026 11:05:18 +0100 Subject: [PATCH] [#71358] fixed version read model usage - improved description of API spec --- app/services/mcp_tools/search_versions.rb | 2 +- .../custom_field_linked_properties.yml | 2 +- .../schemas/custom_field_properties.yml | 3 ++- .../components/schemas/version_read_model.yml | 18 ++++++++----- .../schemas/version_write_model.yml | 26 +++++++++++++++++-- .../version_representer_rendering_spec.rb | 2 +- .../mcp/mcp_resources/version_spec.rb | 2 +- .../mcp/mcp_tools/search_versions_spec.rb | 2 +- 8 files changed, 43 insertions(+), 14 deletions(-) diff --git a/app/services/mcp_tools/search_versions.rb b/app/services/mcp_tools/search_versions.rb index 7f30bf1f135..2d7f8701af4 100644 --- a/app/services/mcp_tools/search_versions.rb +++ b/app/services/mcp_tools/search_versions.rb @@ -61,7 +61,7 @@ module McpTools properties: { items: { type: :array, - items: JsonSchemaLoader.new.load("version_model") + items: JsonSchemaLoader.new.load("version_read_model") } } ) diff --git a/docs/api/apiv3/components/schemas/custom_field_linked_properties.yml b/docs/api/apiv3/components/schemas/custom_field_linked_properties.yml index bb109392211..0f3a86421ff 100644 --- a/docs/api/apiv3/components/schemas/custom_field_linked_properties.yml +++ b/docs/api/apiv3/components/schemas/custom_field_linked_properties.yml @@ -2,7 +2,7 @@ --- type: object patternProperties: - "^customField\\d+": + "^customField\\d+$": allOf: - $ref: "./link.yml" - description: |- diff --git a/docs/api/apiv3/components/schemas/custom_field_properties.yml b/docs/api/apiv3/components/schemas/custom_field_properties.yml index b3aab87897d..c7e1dc07c52 100644 --- a/docs/api/apiv3/components/schemas/custom_field_properties.yml +++ b/docs/api/apiv3/components/schemas/custom_field_properties.yml @@ -2,12 +2,13 @@ --- type: object patternProperties: - "^customField\\d+": + "^customField\\d+$": type: - "null" - number - boolean - string + - object description: |- A custom field value, that belongs to a custom field of a simple type: diff --git a/docs/api/apiv3/components/schemas/version_read_model.yml b/docs/api/apiv3/components/schemas/version_read_model.yml index f9608a13ef2..e435541f954 100644 --- a/docs/api/apiv3/components/schemas/version_read_model.yml +++ b/docs/api/apiv3/components/schemas/version_read_model.yml @@ -40,7 +40,12 @@ properties: format: date status: type: string - description: The current status of the version + description: |- + The current status of the version. This could be: + + - *open*: if the version is available to be assigned to work packages in all shared projects + - *locked*: if the version is not finished, but locked for further assignments to work packages + - *closed*: if the version is finished enum: - open - locked @@ -49,11 +54,12 @@ properties: type: string description: |- The indicator of how the version is shared between projects. This could be: - - *none*: if the version is only available in the defining project - - *descendants*: if the version is shared with the descendants of the defining project - - *hierarchy*: if the version is shared with the descendants and the ancestors of the defining project - - *tree*: if the version is shared with the root project of the defining project and all descendants of the root project - - *system*: if the version is shared globally + + - *none*: if the version is only available in the defining project + - *descendants*: if the version is shared with the descendants of the defining project + - *hierarchy*: if the version is shared with the descendants and the ancestors of the defining project + - *tree*: if the version is shared with the root project of the defining project and all descendants of the root project + - *system*: if the version is shared globally enum: - none - descendants diff --git a/docs/api/apiv3/components/schemas/version_write_model.yml b/docs/api/apiv3/components/schemas/version_write_model.yml index 859de21214b..9fc4bba482c 100644 --- a/docs/api/apiv3/components/schemas/version_write_model.yml +++ b/docs/api/apiv3/components/schemas/version_write_model.yml @@ -21,10 +21,32 @@ properties: format: date status: type: string - description: The current status of the version + description: |- + The current status of the version. This could be: + + - *open*: if the version is available to be assigned to work packages in all shared projects + - *locked*: if the version is not finished, but locked for further assignments to work packages + - *closed*: if the version is finished + enum: + - open + - locked + - closed sharing: type: string - description: The current status of the version + description: |- + The indicator of how the version is shared between projects. This could be: + + - *none*: if the version is only available in the defining project + - *descendants*: if the version is shared with the descendants of the defining project + - *hierarchy*: if the version is shared with the descendants and the ancestors of the defining project + - *tree*: if the version is shared with the root project of the defining project and all descendants of the root project + - *system*: if the version is shared globally + enum: + - none + - descendants + - hierarchy + - tree + - system _links: type: object allOf: diff --git a/spec/lib/api/v3/versions/version_representer_rendering_spec.rb b/spec/lib/api/v3/versions/version_representer_rendering_spec.rb index 291e8ac769c..f7ab0ececc3 100644 --- a/spec/lib/api/v3/versions/version_representer_rendering_spec.rb +++ b/spec/lib/api/v3/versions/version_representer_rendering_spec.rb @@ -49,7 +49,7 @@ RSpec.describe API::V3::Versions::VersionRepresenter, "rendering" do end it "fulfills the documented schema" do - expect(generated).to match_json_schema.from_docs("version_model") + expect(generated).to match_json_schema.from_docs("version_read_model") end it { is_expected.to include_json("Version".to_json).at_path("_type") } diff --git a/spec/requests/mcp/mcp_resources/version_spec.rb b/spec/requests/mcp/mcp_resources/version_spec.rb index ad75e06c0b6..94d04b1fc69 100644 --- a/spec/requests/mcp/mcp_resources/version_spec.rb +++ b/spec/requests/mcp/mcp_resources/version_spec.rb @@ -69,7 +69,7 @@ RSpec.describe McpResources::Version, with_flag: { mcp_server: true } do subject text_content = parsed_results.fetch("contents").first version = text_content.fetch("text") - expect(version).to match_json_schema.from_docs("version_model") + expect(version).to match_json_schema.from_docs("version_read_model") end context "when the resource is disabled via configuration" do diff --git a/spec/requests/mcp/mcp_tools/search_versions_spec.rb b/spec/requests/mcp/mcp_tools/search_versions_spec.rb index aa91187e22d..7da6cdf1cbf 100644 --- a/spec/requests/mcp/mcp_tools/search_versions_spec.rb +++ b/spec/requests/mcp/mcp_tools/search_versions_spec.rb @@ -78,7 +78,7 @@ RSpec.describe McpTools::SearchVersions, with_flag: { mcp_server: true } do it "responds with properly formatted versions" do subject parsed_results.dig("structuredContent", "items").each do |version| - expect(version.to_json).to match_json_schema.from_docs("version_model") + expect(version.to_json).to match_json_schema.from_docs("version_read_model") end end