Current Behavior
Currently, the uniqueItems tag in the schema parsing function requires a value to be present, even though the value itself serves no actual purpose.
This results in redundant code and unnecessary tag declarations.
For example, the current declaration looks like this:
type HPC资源申请 struct {
A_集群类型 []集群类型 `json:"集群类型" jsonschema:"title=集群类型,uniqueItems=true"`
}
Expected behavior
It should allow a more simplified version of the declaration:
type HPC资源申请 struct {
A_集群类型 []集群类型 `json:"集群类型" jsonschema:"title=集群类型,uniqueItems"`
}
Solution
Modify the arrayKeywords function to handle the uniqueItems tag as a flag.
Others
To ensure backward compatibility and that the old logic still works properly, it may be necessary to introduce new branches in the code to handle the new functionality.
If needed, I can submit a follow-up MR