pksunkara / alpaca

Given a web API, Generate client libraries in node, php, python, ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validation

jonathanrdelgado opened this issue · comments

Fantastic project, firstly.

I think it would benefit greatly from basic validations on parameters. For example, if you require an integer cost to be submitted in the request, the following would be added to the api.json

"purchase": {
    "args": ["id"],
    "list": {
        "path": "/purchases/"
    },
    "update": {
        "path": "/purchases/:id/",
        "method": "post",
        "params": [
            {
                "name": "cost",
                "validation": "integer",
                "required": true
            }
        ]
    }
}

This cuts down on requests that will automatically be rejected by the API anyway, and most libraries include them.

Any comment on this? Open to a PR?

Yes, I am open to Pull Requests. I have been planning to include a type for generating libraries n static type programming languages too.

Going to close this, this has been sitting in my issues list for years. I wish you my best on the project.