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

Blows up when passed a joi schema type with certain unsupported rules #18

Open
samueljoli opened this issue Dec 30, 2017 · 2 comments
Open
Assignees

Comments

@samueljoli
Copy link
Contributor

Context

  • node version: 8
  • environment (node, browser): node

What are you trying to achieve or the steps to reproduce ?

const Joi2GQL = require('joi2gql');
const Joi = require('joi');
const schema = Joi.object().keys({
    prop1: Joi.string().lowercase(),
    prop2: Joi.number().integer(),
    prop3: Joi.object().keys({
        key1: Joi.string(),
        key2: Joi.string()
    })
});

const Schema = Joi2GQL.transmuteType(schema);
const gqlschema = {
    query: {
        schema: Schema
    }
}
const mySchema = Joi2GQL.transmuteSchema(gqlschema);

What result did you expect ?

For a valid GraphQL object to be returned

What result did you observe ?

// Anon.prop1 field type must be Output Type but got: undefined
@samueljoli samueljoli changed the title Blows up when passed a joi schema type with rules Blows up when passed a joi schema type with certain unsupported rules Dec 30, 2017
@samueljoli samueljoli self-assigned this Dec 30, 2017
@gino8080
Copy link

gino8080 commented Feb 11, 2018

i have same problems with date, regex, uri
my schema is:

  • node : 8.1.2
  • hapi 17 : ^17.2.0
  • joi : 13.1.2,
  • joi2gql : ^1.3.1
schema = Joi.object({
   firstname: Joi.string(), //this the only that works
  fiscalCode: Joi.string().regex(fiscal_code_regex),
  birthdate : Joi.string().isoDate().default(new Date()),
  photo: Joi.string().uri(),
})

for each field fiscalCode, birthdate and photo i got this error:

Unhandled promise rejection (rejection id: 2): Error: Patient.photo field type must be Output Type but got: undefined.

@samueljoli
Copy link
Contributor Author

@gino8080 Hey, I'll try and get around to this sometime this weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants