How to Validate Uploaded File: OpenAPI, Swagger, Postman
To ensure that the specified upload file will be correctly read and processed, follow these rules:
OpenAPI/Swagger Schema
- Specify a Target Server (Host)
- OpenAPI 3+: Include the
servers
property. Example:"servers": [ {"url": "https://development.gigantic-server.com/v1", "description": "Development server"}, {"url": "https://staging.gigantic-server.com/v1", "description": "Staging server"}, {"url": "https://api.gigantic-server.com/v1", "description": "Production server"} ]
- Swagger 2: Include the
host
property. - Multiple Servers: List the primary server first.
- OpenAPI 3+: Include the
- Parameter Values
- Ensure all parameters have values.
- Add values in the raw schema or Value fields in the smart view.
- Define Variable Substitutions (OAS 3)
- Specify substitutions for variables.
Postman Collection
- URL Specification
- Ensure the URL item is properly specified. Example:
{ "url": { "raw": "{{url}}/.well-known/openid-configuration?client_id={{clientId}}", "host": ["{{url}}"], "path": [".well-known", "openid-configuration"], "query": [ {"key": "client_id", "value": "{{clientId}}"} ] } }
- Avoid incomplete URL structures. Example of incorrect URL:
"url": {"raw": "{{url}}/.well-known/openid-configuration?client_id={{clientId}}"}
- Ensure the URL item is properly specified. Example:
- Ensure every environmental variable has a value.
- Use dynamic variables to generate random values per request.
"variable": [ {"key": "batchResultId", "value": "{{$guid}}"} ]
Updated about 2 months ago