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

Schema Generation: support for "uniqueItems" ? #143

Open
buxel opened this issue Jul 12, 2018 · 2 comments · May be fixed by #212
Open

Schema Generation: support for "uniqueItems" ? #143

buxel opened this issue Jul 12, 2018 · 2 comments · May be fixed by #212

Comments

@buxel
Copy link

buxel commented Jul 12, 2018

Is it possible to add an attribute to a collection so the generated schema has the "uniqueItems" property set?

From this:

[UniqueItems]
public List<string> UniqueStrings { get; set; }

Or

public HashSet<string> UniqueStrings { get; set; }

To this

"UniqueStrings ": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string"
        ]
      }

Other ideas and workarounds are welcome, too!

@simplifiedapplications
Copy link

Is it possible to add an attribute to a collection so the generated schema has the "uniqueItems" property set?

From this:

[UniqueItems]
public List<string> UniqueStrings { get; set; }

Or

public HashSet<string> UniqueStrings { get; set; }

To this

"UniqueStrings ": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string"
        ]
      }

Other ideas and workarounds are welcome, too!

rfrerebe pushed a commit to rfrerebe/Newtonsoft.Json.Schema that referenced this issue May 5, 2020
rfrerebe pushed a commit to rfrerebe/Newtonsoft.Json.Schema that referenced this issue May 5, 2020
rfrerebe pushed a commit to rfrerebe/Newtonsoft.Json.Schema that referenced this issue May 5, 2020
@rfrerebe rfrerebe linked a pull request May 5, 2020 that will close this issue
rfrerebe added a commit to rfrerebe/Newtonsoft.Json.Schema that referenced this issue May 5, 2020
Fixes JamesNK#143
Documentation might be wrong
rfrerebe added a commit to rfrerebe/Newtonsoft.Json.Schema that referenced this issue May 5, 2020
@Collins2000998

This comment was marked as resolved.

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

Successfully merging a pull request may close this issue.

3 participants