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

validator: running request and response validator in standalone mode #201

Open
mbana opened this issue Sep 13, 2018 · 3 comments
Open

validator: running request and response validator in standalone mode #201

mbana opened this issue Sep 13, 2018 · 3 comments

Comments

@mbana
Copy link

mbana commented Sep 13, 2018

hi,

is it possible to run the validators for request and response in some sort of standalone mode?

I don't want to run it in test mode or as a plug either.

effectively something like: https://github.com/apigee-127/sway/blob/master/docs/API.md

@mbuhot
Copy link
Contributor

mbuhot commented Sep 13, 2018

You can call ConnValidator.validate/1 or Validator.validate/2 directly. Is that what you mean by standalone mode?

@mbana
Copy link
Author

mbana commented Sep 13, 2018

Can you please update the docs to include examples of using these API methods.

@mbuhot
Copy link
Contributor

mbuhot commented Sep 13, 2018

The validation guide has an example of Validator.validate/2: https://hexdocs.pm/phoenix_swagger/schema-validation.html

ConnValidator.validate/1 simply uses the Conn struct, see the usage in the validate plug: https://github.com/xerions/phoenix_swagger/blob/v0.8.1/lib/phoenix_swagger/plug/validate_plug.ex#L27

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

No branches or pull requests

2 participants