Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add support for custom format validators #1

Open
skonves opened this issue Mar 15, 2017 · 0 comments
Open

Add support for custom format validators #1

skonves opened this issue Mar 15, 2017 · 0 comments

Comments

@skonves
Copy link
Contributor

skonves commented Mar 15, 2017

When using the request validation middleware, support should be added for formats not defined at http://json-schema.org/latest/json-schema-validation.html#rfc.section.7. The proposed syntax would add a customFormats property to the middleware options:

app.use(gangplank.requests({
    swaggerDefinition: spec,
    customFormats: {
        uuid: value => validateUuid(value)
    }
}));

The validation error message could read similar to: "Validation failed per custom format 'uuid'" or further consideration could be given to allowing custom formatters to defined their own error messages.

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

No branches or pull requests

1 participant