From c545cbfac2a6a874d1c765535cdd1925fd78c5ad Mon Sep 17 00:00:00 2001 From: J S <49557684+svilupp@users.noreply.github.com> Date: Sun, 19 Nov 2023 21:59:41 +0000 Subject: [PATCH] remove duplication --- src/extraction.jl | 5 +++++ test/extraction.jl | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/extraction.jl b/src/extraction.jl index 74ab48463..b96a290a6 100644 --- a/src/extraction.jl +++ b/src/extraction.jl @@ -162,6 +162,11 @@ function function_call_signature(datastructtype::Type; max_description_length::I ## docstrings docs = extract_docstring(datastructtype; max_description_length) !isempty(docs) && (schema["description"] = docs) + ## remove duplicated Struct docstring in schema + if haskey(schema["parameters"], "description") && + schema["parameters"]["description"] == docs + delete!(schema["parameters"], "description") + end return schema end diff --git a/test/extraction.jl b/test/extraction.jl index 3a21c1964..dc65bd693 100644 --- a/test/extraction.jl +++ b/test/extraction.jl @@ -210,8 +210,7 @@ end "weight" => Dict{String, Any}("type" => "number"), "age" => Dict{String, Any}("type" => "integer")), "required" => ["age"], - "type" => "object", - "description" => "Some docstring\n"), + "type" => "object"), "description" => "Some docstring\n") @test output == expected_output