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

Refactor app/schema.js #7

Closed
bsingr opened this issue Apr 29, 2016 · 3 comments
Closed

Refactor app/schema.js #7

bsingr opened this issue Apr 29, 2016 · 3 comments

Comments

@bsingr
Copy link
Contributor

bsingr commented Apr 29, 2016

There are a lot of type checks etc. in https://github.com/jotaen/j4n.io/blob/master/app/schema.js

Could it help to use Joi there?

@jotaen jotaen changed the title Suggestion: Use Joi in app/schema.js Use Joi in app/schema.js Apr 29, 2016
@jotaen
Copy link
Owner

jotaen commented Apr 29, 2016

That could be worth a try.

The input/output functions are used for object manipulation and casting. I think Joi would not be the best choice here.

The validation function is currently only used in the tests to verify the responses, it is not used by the application itself. Perhaps it’s generally in the wrong place and it would be better to move it to the tests.

@jotaen jotaen changed the title Use Joi in app/schema.js Refactor app/schema.js Apr 29, 2016
@jotaen
Copy link
Owner

jotaen commented Apr 29, 2016

@bsingr see d405812

@bsingr
Copy link
Contributor Author

bsingr commented Apr 29, 2016

Okay, got it. Naming is important ;-)

+1 for rename to input/output
+1 for moving validation functions into tests (very important)

@bsingr bsingr closed this as completed Apr 29, 2016
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