herbsjs / buchu

Use Cases - Uniform, auditable and secure use case library
Other
24 stars 22 forks source link

Incorret schema validation for Object Types #2

Closed jhomarolo closed 5 years ago

jhomarolo commented 5 years ago

When using Extended Class Objects schema validation returns an error for all Object fields. By removing schema validation use case will function normally again

Generic error message:

key:"id"
msg:"Key ["id"] does not exist on schema."
type:"invalid value"

Request in use case:

request: { boleta: Object }

Lines commented in usecase.js - starting from line 51

        if (request) {
            //const requestSchema = schema(this._requestSchema)
            //requestSchema.validate(request)
           // if (!requestSchema.isValid) return Err(requestSchema.errors)
            this._mainStep.context.req = request
        }
dalssoft commented 5 years ago

when executing your usecase, try run it with a request object with the same schema described.

so, for request: { boleta: Object } try usecase.run({boleta: boleta})