Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify uniqueItems Tag Parsing to Remove Unnecessary Value Requirement #156

Open
orange-guo opened this issue Oct 22, 2024 · 0 comments
Open

Comments

@orange-guo
Copy link

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

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

No branches or pull requests

1 participant