Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Improve validator to validate body content #154

Closed
3 tasks
kylef opened this issue Jul 26, 2014 · 2 comments
Closed
3 tasks

Improve validator to validate body content #154

kylef opened this issue Jul 26, 2014 · 2 comments
Labels

Comments

@kylef
Copy link
Member

kylef commented Jul 26, 2014

Chucking this up here for discussion, maybe this isn't the tool to do this but we've noticed people slipping bad JSON into the body of a HTTP payload. It's mostly undetected until you try and connect with a client and notice it fails to deserialise the JSON. Would be good to catch this early with the validator.

For example, here's a bad JSON body (notice the trailing ,):

+ Body

        {
            "message": "Hello",
        }

Known types:

  • JSON/JavaScript
  • XML
  • YAML
@zdne zdne added the question label Jul 26, 2014
@zdne
Copy link
Contributor

zdne commented Aug 3, 2014

This is a good point @kylef however the current behavior is intentional to allow stubbing payloads (JSONs, XML) for example in the moment you are designing your API and can't be bothered by well formatting JSONs:

+ body

        { ... }

So I was thinking about parser, or perhaps more preferably, parser harness flag to switch the validation on and off.

Also related: http://support.apiary.io/forums/120125-general/suggestions/3345747-json-validation

@zdne
Copy link
Contributor

zdne commented Sep 15, 2014

I am closing this issue as Snow Crash by itself should not provide any sort of payload validation – this is either task for subsequent tooling or the parser harness in the pipeline.

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

No branches or pull requests

2 participants