Skip to content

Commit

Permalink
Docstring fix for function call signatures
Browse files Browse the repository at this point in the history
Remove duplicated docstring in the function call signature
  • Loading branch information
svilupp authored Nov 19, 2023
2 parents 8a7a578 + c545cbf commit 95a5282
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/extraction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions test/extraction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 95a5282

Please sign in to comment.