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

Array of objects turns to array of strings #53

Open
idoshamun opened this issue Nov 1, 2015 · 1 comment
Open

Array of objects turns to array of strings #53

idoshamun opened this issue Nov 1, 2015 · 1 comment

Comments

@idoshamun
Copy link

I define my response schema as follows:

    response: {
        schema: Joi.object().keys({
            code: models.familyCode,
            familyName: models.name.required().description('Family name'),
            accessToken: models.accessToken,
            members: Joi.array(models.familyMember)
        }).meta({ className: 'Login output' }),
        status: {
            400: models.error,
            500: models.error
        }
    }

where models.familyMember is as follows:

familyMember: Joi.object().keys({
        firstName: name.required(),
        lastName: name.required(),
        lastAlive: Joi.date().required(),
        battery: Joi.number().required().min(-1).max(100)
    }).meta({ className: 'Family member' })

Swagger shows the input as follows:

{
  "code": "string",
  "familyName": "string",
  "accessToken": {
    "token": "string",
    "expiration": "2015-11-01T16:18:44.613Z"
  },
  "members": [
    "string"
  ]
}

I can't figure how to solve this issue

@fluky
Copy link

fluky commented Apr 9, 2016

I'm seeing this as well. I have an object that is returned for a /path/id (let's call it testObject) and for /path/ I specify the response as joi.array ().items (testObject) but the doc generates array [ string ].

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