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

Add field constraint indicator for uniqueItems #1423

Merged
merged 2 commits into from
Oct 27, 2020
Merged

Add field constraint indicator for uniqueItems #1423

merged 2 commits into from
Oct 27, 2020

Conversation

miqh
Copy link
Contributor

@miqh miqh commented Oct 18, 2020

Hello,

Fixes #1353.

Schemas which define uniqueItems should now generate a field constraint indicator.

For the example provided in the linked issue, the visual output looks like the following:

Screenshot from 2020-10-18 09-42-51


I also noticed ArraySchema tries to indicate array-type constraints. Specifically, it only covers the minItems and maxItems constraints.

const minMaxItems = humanizeConstraints(itemConstraintSchema(itemsSchema.schema.minItems, itemsSchema.schema.maxItems));

I haven't dug too deeply into this, but with a simple schema such as:

type: array
  items:
    type: number
  minItems: 1

I'd expect to see something like the following (based on the code), but I don't:

Screenshot from 2020-10-18 10-13-56

Anyway, I'm happy to follow-up and do something about the latter if it's indeed unexpected behaviour.

Copy link
Member

@RomanHotsiy RomanHotsiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/components/Fields/FieldContstraints.tsx Outdated Show resolved Hide resolved
@RomanHotsiy RomanHotsiy merged commit d4ae371 into Redocly:master Oct 27, 2020
RomanHotsiy added a commit that referenced this pull request Oct 27, 2020
* Add field constraint indicator for uniqueItems

Resolves #1353

* Update src/components/Fields/FieldContstraints.tsx

Co-authored-by: Roman Hotsiy <gotsijroman@gmail.com>
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 this pull request may close these issues.

uniqueItems: true is not exposed in generated docs
2 participants