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

Look into the Joi objects #15

Open
samhstn opened this issue Sep 21, 2016 · 2 comments
Open

Look into the Joi objects #15

samhstn opened this issue Sep 21, 2016 · 2 comments

Comments

@samhstn
Copy link
Member

samhstn commented Sep 21, 2016

Identify the interface the Joi objects provide in order to render the html form and input into our database

@eliasmalik
Copy link
Contributor

On the DB side, we will need to look at the schema provided by the developer in order to infer what data-types each field needs to be. For example

var schema = {
  username: Joi.string().min(2).max(15),
  email: Joi.string().email(),
}

If this is the schema object the backend has to rely on, in order to find out what datatype username has to be, we would have to access

schema.username._type

The underscore prefix suggests this is intended to be a private member. All the other properties that tell us about restrictions are also private. Do we want to be coupling this module/plugin to the internal implementation of Joi objects?

Does anyone know of a better way to infer data-type? @nelsonic ?

@nelsonic
Copy link
Member

nelsonic commented Sep 22, 2016

@eliasCodes our initial discussion of Joi's limitations specifically regarding our need for defining access controls in the model lead me to think we may want to write our own JSON format ...

It might be worth taking a look at: https://github.com/json-schema-org/json-schema-spec

relates to: #19 & #26

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

3 participants