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

Sample program not working🐛 #13

Open
aneeskA opened this issue Sep 15, 2019 · 2 comments
Open

Sample program not working🐛 #13

aneeskA opened this issue Sep 15, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@aneeskA
Copy link

aneeskA commented Sep 15, 2019

Describe the bug
A clear and concise description of what the bug is.

Example given not working. Sample output.

D:\Work\oas2joi.sample\node_modules\enjoi\index.js:18
const validateOptions = Joi.validate(options, optionsSchema);
^

TypeError: Joi.validate is not a function
at validate (D:\Work\oas2joi.sample\node_modules\enjoi\index.js:18:33)
at Object.exports.schema (D:\Work\oas2joi.sample\node_modules\enjoi\index.js:49:15)
at parseSchema (D:\Work\oas2joi.sample\node_modules\oas2joi\index.js:11:16)
at Object.keys.forEach.schemaName (D:\Work\oas2joi.sample\node_modules\oas2joi\index.js:20:30)
at Array.forEach ()
at module.exports.filePath (D:\Work\oas2joi.sample\node_modules\oas2joi\index.js:19:27)
at Object. (D:\Work\oas2joi.sample\app.js:31:17)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)

To Reproduce
Steps to reproduce the behavior.

const oas2joi = require('oas2joi');
const Joi = require('@hapi/joi');

const schemas = oas2joi('./open-api.yml');

console.log(schemas)

const someObject = {
  foo: 'bar'
};

const { error } = Joi.validate(someObject, schemas.someObject);

Expected behavior
A clear and concise description of what you expected to happen.

execution without errors

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@aneeskA aneeskA added the bug Something isn't working label Sep 15, 2019
@JoeScho
Copy link
Owner

JoeScho commented Feb 21, 2020

Thanks for pointing this out. It looks like this is due to a bug in enjoi. tlivings/enjoi#79

I'll leave this issue open as I'll need to version bump enjoi when fixed

@JoeScho JoeScho mentioned this issue Feb 21, 2020
15 tasks
@JoeScho
Copy link
Owner

JoeScho commented Feb 21, 2020

Depends on tlivings/enjoi#84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants