Quickly Fix Lint Errors for your OpenAPI Specification
To generate your first set of high quality SDKs you need to pass Konfig's
Linter. But manually updating your OAS is tedious. Use konfig
fix to expedite the process. Today konfig fix
will:
- Add missing global tags
- Add missing OpenAPI object info description
- Add missing response descriptions
- Add missing security schemes
- Remove disallowed header names
- Define OpenAPI schemas request/response bodies
- Detect possible misuse of security requirements
- Ensure tags follow proper naming convention
- Fix empty request body content
- Fix missing 2xx response
- Fix object type schemas with no properties
- Fix unstructured request bodies
- Fix empty response body schema
- Fix parameters that should be security requirements
- Fix paths that end with a slash
- Fix redundant security requirements and request parameters
- Fix invalid examples in media objects and schemas
- Help you quickly create or update operation IDs following best convention
- Ignores potentially incorrect data types if confirmed
How to use
Run konfig fix -s <PATH_TO_SPEC>
.
_48❯ konfig fix -s api.yaml_48┌────── Summary ───────┐_48│ │_48│ Driver's License │_48│ │_48└──────────────────────┘_48┌─────── Path - Method ───────┐_48│ │_48│ /api/v1/gh/kyc/dl - GET │_48│ │_48└─────────────────────────────┘_48┌── Summary ───┐_48│ │_48│ Passport │_48│ │_48└──────────────┘_48┌────────── Path - Method ──────────┐_48│ │_48│ /api/v1/gh/kyc/passport - GET │_48│ │_48└───────────────────────────────────┘_48# You will be prompted to assign operations IDs if they are missing or not following best practice_48┌ Fixed 59 Issues ────────────────────────────────────────────┐_48│ │_48│ Updated 34 operation IDs │_48│ Renamed 0 improperly named tags │_48│ Removed 0 disallowed headers removed │_48│ Added 0 potential-incorrect-type ignore rule │_48│ Added 1 object-with-no-properties ignore rule │_48│ Added 0 missing info description │_48│ Added 0 missing response descriptions │_48│ Added 9 missing tags │_48│ Added 1 empty response body schemas │_48│ Added 14 named schemas │_48│ Added 0 missing 2xx responses │_48│ Fixed 0 duplicate tag names fixed │_48│ Fixed 0 unstructured request bodies │_48│ Fixed 0 objects with no properties │_48│ Fixed 0 redundant "example" & "examples" fields │_48│ Fixed 0 examples with invalid schemas │_48│ Fixed 0 parameters that should be security requirements │_48│ Fixed 0 list usages of security │_48│ Removed 0 trailing slashes │_48│ Removed 0 redundant security requirement and parameters │_48│ Removed 0 parameters replace with security requirement │_48│ Removed 0 empty request bodies │_48│ │_48└─────────────────────────────────────────────────────────────┘
Saving Progress
konfig fix
will automatically save progress upon any manual input so your work
can be resumed if interrupted. Optionally pass the -Y
flag to automatically
confirm using saved progress.
Successful Output
An OAS with no fixes will produce the following output:
_27❯ konfig fix -s api.yaml_27┌ Fixed 0 Issues ─────────────────────────────────────────────┐_27│ │_27│ Updated 0 operation IDs │_27│ Renamed 0 improperly named tags │_27│ Removed 0 disallowed headers removed │_27│ Added 0 potential-incorrect-type ignore rule │_27│ Added 0 object-with-no-properties ignore rule │_27│ Added 0 missing info description │_27│ Added 0 missing response descriptions │_27│ Added 0 missing tags │_27│ Added 0 empty response body schemas │_27│ Added 0 named schemas │_27│ Added 0 missing 2xx responses │_27│ Fixed 0 duplicate tag names fixed │_27│ Fixed 0 unstructured request bodies │_27│ Fixed 0 objects with no properties │_27│ Fixed 0 redundant "example" & "examples" fields │_27│ Fixed 0 examples with invalid schemas │_27│ Fixed 0 parameters that should be security requirements │_27│ Fixed 0 list usages of security │_27│ Removed 0 trailing slashes │_27│ Removed 0 redundant security requirement and parameters │_27│ Removed 0 parameters replace with security requirement │_27│ Removed 0 empty request bodies │_27│ │_27└─────────────────────────────────────────────────────────────┘