main-file-known-format
Overview
This rule belongs to the import-validation
ruleset and states that:
For a single file upload, that file is the main file. However, for multi-file upload the main file is one which is preferably an API description format like OpenAPI, Swagger, API Blueprint, RAML, Postman, Insomnia, WSDL, WADL etc. If no API description file is found, the first recognizable data description file like JSON, JSON Schema, YAML, XML, XML Schema, etc. may be chosen as the main file. A main file in a recognized format must exist in the uploaded file(s).
Property | Value |
---|---|
Severity | Blocking |
Message | Main file could not be identified as the provided file(s) are either invalid or are in an unrecognized or unsupported format. |
Code | IMPORT_V102 |
Type | Validation |
Rule System | Semantic |
Broad Category | File I/O Content |
Tags | import api specification api file validation main file file format api description format data description format |
Suggested Fixes
- Ensure that all files are in one of the supported formats only.
- The main file must either be a supported API description format or a data description format.
- API description files are given precedence over data description files.
- Make sure that the file contents are complete as that can hinder identification.
- Try placing the main file in the root directory to avoid issues.
- The first file encountered in the directory whose format is recognizable is picked up as the main file. Therefore, make sure that the main file is discoverable.
- The main file identifier first looks for the main file in the files of the root directory. If the main file is not found there, it then looks within the sub-directories of the root directory. The same process goes on for the sub-directories as well until a main file is found or no other files/directories are available for searching.