{"id":13660645,"url":"https://github.com/antonk52/swaggerlint","last_synced_at":"2025-04-15T23:25:07.793Z","repository":{"id":40730286,"uuid":"227476747","full_name":"antonk52/swaggerlint","owner":"antonk52","description":"Keep your API consistent","archived":false,"fork":false,"pushed_at":"2023-04-24T18:12:04.000Z","size":1196,"stargazers_count":20,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T02:34:34.480Z","etag":null,"topics":["linter","openapi","openapi3","swagger","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antonk52.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-12-11T23:03:15.000Z","updated_at":"2023-08-22T16:29:55.000Z","dependencies_parsed_at":"2024-01-15T20:50:34.716Z","dependency_job_id":"b28baeda-be14-4c39-bd3b-e731bc2f7c95","html_url":"https://github.com/antonk52/swaggerlint","commit_stats":{"total_commits":221,"total_committers":4,"mean_commits":55.25,"dds":0.4434389140271493,"last_synced_commit":"9108a3059eb3eef0c5135886f72744f7b3f379e2"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonk52%2Fswaggerlint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonk52%2Fswaggerlint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonk52%2Fswaggerlint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonk52%2Fswaggerlint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonk52","download_url":"https://codeload.github.com/antonk52/swaggerlint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248680685,"owners_count":21144694,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linter","openapi","openapi3","swagger","typescript"],"created_at":"2024-08-02T05:01:24.072Z","updated_at":"2025-04-15T23:25:07.771Z","avatar_url":"https://github.com/antonk52.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Swaggerlint\n\n`Swaggerlint` helps you to have a consistent API style by linting your swagger / OpenAPI Scheme.\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/5817809/72013495-0b443700-326f-11ea-9549-84dce1ec861e.png\" width=\"750\" alt=\"npm command\"\u003e\u003c/p\u003e\n\n## Installation\n\nInstall it in your project\n\n```sh\nnpm install swaggerlint\n```\n\nInstall it globally\n\n```sh\nnpm install --global swaggerlint\n```\n\n## Usage\n\n### CLI\n\nYou can lint your swagger scheme by path\n\n```sh\nswaggerlint /path/to/swagger.json\n```\n\nOr by providing a URL\n\n```sh\nswaggerlint https://...\n```\n\n#### Config flag\n\n`swaggerlint` will automatically search up the directory tree for a `swaggerlint.config.js` file. Or you can specify it explicitly\n\n```sh\nswaggerlint --config /path/to/swaggerlint.config.js\n```\n\n### Nodejs\n\n```js\nconst {swaggerlint} = require('swaggerlint');\nconst config = require('./configs/swaggerlint.config.js');\nconst swaggerScheme = require('./swagger.json');\n\nconst result = swaggerlint(swaggerScheme, config);\n\nconsole.log(result); // an array or errors\n\n/**\n * [{\n *   name: 'string', // rule name\n *   msg: 'string', // message from the rule checker\n *   location: ['path', 'to', 'error'] // what caused an error\n * }]\n */\n```\n\n### Docker image\n\nIf you do not have nodejs installed you can use the [swaggerlint docker image](https://hub.docker.com/r/antonk52/alpine-swaggerlint).\n\n## Config\n\n```js\n// swaggerlint.config.js\nmodule.exports = {\n    rules: {\n        'object-prop-casing': ['camel'],\n        'properties-for-object-type': true,\n        'latin-definitions-only': true,\n    },\n};\n```\n\n## Rules\n\nYou can set any rule value to `false` to disable it or to `true` to enable and set its setting to default value.\n\n\u003c!-- GENERATED_START(id:rulestable;hash:78f3b724d8ef667a4bcef20d6c92d22e) This is generated content, do not modify by hand, to regenerate run \"npm run updateDocs\" --\u003e\n\n| rule name                                                                                | description                                                                    | default                                     |\n| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------------- |\n| [`expressive-path-summary`](./src/rules/expressive-path-summary/readme.md)               | Enforces an intentional path summary                                           |                                             |\n| [`latin-definitions-only`](./src/rules/latin-definitions-only/readme.md)                 | Bans non Latin characters usage in definition names                            | [\"placeholder_to_be_removed\",{\"ignore\":[]}] |\n| [`no-empty-object-type`](./src/rules/no-empty-object-type/readme.md)                     | Object types have to have their properties specified explicitly                |                                             |\n| [`no-external-refs`](./src/rules/no-external-refs/readme.md)                             | Forbids the usage of external ReferenceObjects                                 |                                             |\n| [`no-inline-enums`](./src/rules/no-inline-enums/readme.md)                               | Enums must be in `DefinitionsObject` or `ComponentsObject`                     |                                             |\n| [`no-ref-properties`](./src/rules/no-ref-properties/readme.md)                           | Disallows to have additional properties in Reference objects                   |                                             |\n| [`no-single-allof`](./src/rules/no-single-allof/readme.md)                               | Object types should not have a redundant single `allOf` property               |                                             |\n| [`no-trailing-slash`](./src/rules/no-trailing-slash/readme.md)                           | URLs must NOT end with a slash                                                 |                                             |\n| [`object-prop-casing`](./src/rules/object-prop-casing/readme.md)                         | Casing for your object property names                                          | [\"camel\"]                                   |\n| [`only-valid-mime-types`](./src/rules/only-valid-mime-types/readme.md)                   | Checks mime types against known from [`mime-db`](https://npm.im/mime-db)       |                                             |\n| [`parameter-casing`](./src/rules/parameter-casing/readme.md)                             | Casing for your parameters                                                     | [\"camel\",{\"header\":\"kebab\"}]                |\n| [`path-param-required-field`](./src/rules/path-param-required-field/readme.md)           | Helps to keep consistently set optional `required` property in path parameters |                                             |\n| [`required-operation-tags`](./src/rules/required-operation-tags/readme.md)               | All operations must have tags                                                  |                                             |\n| [`required-parameter-description`](./src/rules/required-parameter-description/readme.md) | All parameters must have description                                           |                                             |\n| [`required-tag-description`](./src/rules/required-tag-description/readme.md)             | All tags must have description                                                 |                                             |\n\n\u003c!-- GENERATED_END(id:rulestable) --\u003e\n\n## Documentation\n\n-   [How to write a rule](./docs/how-to-write-a-rule.md)\n\n### Acknowledgments\n\nThis tool has been inspired by already existing swagger validation checkers:\n\n-   [api lint](https://github.com/danielgtaylor/apilint)\n-   [speccy](https://github.com/wework/speccy)\n-   [zally](https://github.com/zalando/zally)\n-   [openapi-validator](https://github.com/IBM/openapi-validator)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonk52%2Fswaggerlint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonk52%2Fswaggerlint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonk52%2Fswaggerlint/lists"}