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

Support array's 'uniqueItems' #22

Open
tomfitzhenry opened this issue Nov 10, 2014 · 5 comments
Open

Support array's 'uniqueItems' #22

tomfitzhenry opened this issue Nov 10, 2014 · 5 comments

Comments

@tomfitzhenry
Copy link

uniqueItems, as described on https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md is not supported.

Example usage:

Steps to reproduce

curl 'http://uniqueitems-support.swaggerific.io/

Expected

One of: [], ["foo"], ["bar"], ["foo", "bar"]

Actual

Sometimes I get duplicate entries, e.g. ["foo","foo","foo","bar"]

Swagger spec

Here's the swagger file for uniqueitems-support.swaggerific.io

---
swagger: "2.0"
info:
  title: Demo of uniqueItems functionality
  version: 1.0.0
paths:
  /:
    get:
      summary: Get list of enum (unique elems)
      responses:
        200:
          description: List of enum (unique elems)
          schema:
            title: myEnums
            type: array
            uniqueItems: true # <<< This guy.
            items:
              type: string
              enum: [foo, bar]
@tomfitzhenry
Copy link
Author

Oops. I raised this against the wrong project. See blinkboxbooks/genny#10

@jphastings
Copy link
Contributor

Thanks @tomfitzhenry, I've pushed PR blinkboxbooks/genny#12 to fix this, once that's tested & available I'll update swaggerific to follow suit :)

@jphastings
Copy link
Contributor

PR #24 fixes this :)

@tomfitzhenry
Copy link
Author

I think there's a bug because I can't seem to get any lists with size greater than 1.

$ for i in $(seq 20); do curl 'http://uniqueitems-support.swaggerific.io/'; done
["foo"]["bar"]["foo"]["bar"]["foo"]["bar"]["bar"]["bar"]["bar"]["bar"]["bar"]["bar"]["foo"]["foo"]["foo"]["bar"]["foo"]["bar"]["foo"]["bar"]

I suspect this is a bug, but looking at the PR, I can't see where it is...

Maybe it's a case of http://i.imgur.com/U8eTUIw.jpg

@tomfitzhenry tomfitzhenry reopened this Nov 10, 2014
@jphastings
Copy link
Contributor

I think it probably is :P Yeah, the tests pass but your use case still isn't working. Will check it out today :)

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

2 participants