🇺🇸 English | 🇷🇺 Русский | 🇨🇳 中文
You need to add a folder with the name of the newly created rule to the src/rules directory with 6 files:
index.ts- main file with rule logic - must export:processor(default export) andconfigSchema(named export)index.test.ts- tests for the rule covering all configuration fields and usage examples/docs/{lang}/_description.md- file with rule description/docs/{lang}/_motivation.md- file with description of rule motivation with examples (in which cases it can be useful in practice)/docs/{lang}/_config.md- file with rule configuration description
For detailed logs needed for debugging see "Debugging" section.
All rule names must start with an action designation.
src/
├── cli/ # CLI interface
├── config.ts # Configuration and validation
├── core/ # Core logic
├── logger/ # Logging system
├── openapi.ts # OpenAPI file handling
├── rules/ # Modification rules
└── index.ts # Entry point
npm installnpm run buildnpm testnpm run clear- Clean build directoriesnpm run format- Code formattingnpm run tools:generate-readme- Documentation generationnpm run tools:generate-rule-types- Rule types generation
Internally uses the npm package debug for detailed logging
To output all debug logs:
DEBUG=openapi-modifier:* openapi-modifierTo output debug logs for a specific rule, for example for the remove-operation-id rule:
DEBUG=openapi-modifier:rule:remove-operation-id openapi-modifier