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

Proposal - export (or move to a separate module) the internal objects\parameters validation mechanism that used by the validator middleware #148

Closed
borisirota opened this issue Feb 12, 2015 · 4 comments

Comments

@borisirota
Copy link

This will make it usable by other projects as well. For example, it will be possible to add client side validation in the awesome swagger-js-codegen project :)

@whitlockjc
Copy link
Member

I actually think this stuff will be going away soon. If you look at #135, you'll see I'm already in the process of reviewing the internal/manual validation stuff because it's basically a subset of what you'd get with real JSON Schema validation. I'm going to close this but do keep an eye out for #135 and what we do with it. Whatever I do, I'll expose it.

@whitlockjc
Copy link
Member

Also, if you wanted to use it right now, you can do something like this:

var validators = require('swagger-tools/lib/validators');

validators.validateSchemaConstraints('2.0', someSchema, somePath, someValue);

@whitlockjc
Copy link
Member

So just to summarize: You should be able to use this code already but it might change soon as a result of #135. This is not an officially exposed API so if #135 changes it, your code might need to be updated in the future. Also, #135 may change how much of this actually implemented in swagger-tools but the same concepts will happen because I use this to validate default values at minimum.

@borisirota
Copy link
Author

Cool thanks !

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

No branches or pull requests

2 participants