cancel
Showing results for 
Search instead for 
Did you mean: 

Generate javascript client validation from swagger.json

Occasional Visitor

Generate javascript client validation from swagger.json

Is it possible to generate client side validation rules from swagger.json, which has validation parameters in definitions section?

 

Our Swagger.json has following section:

 

    "definitions": {
        "API.Controllers.AccountsController": {
            "description": "Company information",
            "required": [
                "name"
            ],
            "type": "object",
            "properties": {
                "name": {
                    "description": "Name of company",
                    "maxLength": 100,
                    "minLength": 0,
                    "type": "string"
                },

but the maxLength and minLength are ignored when creating the client files with http://editor.swagger.io/#

 

Same goes for Swaggers own Petstore server sample.

 

                    {
                        "name": "orderId",
                        "in": "path",
                        "description": "ID of pet that needs to be fetched",
                        "required": true,
                        "type": "integer",
                        "maximum": 10,
                        "minimum": 1,
                        "format": "int64"
                    }

Maximum and minimum are not processed.

 

Any help on creating client side validations from server configurations is very much appreciated.

Thanks for great tooling!

 

Tags (1)
New Here?
Join us and watch the welcome video: