π OpenAPI specification for the KhulnaSoft API, providing a clear, standardized contract for developers. Includes endpoints, schemas, authentication, and examples to enable seamless integration, testing, and SDK generation. π
This repository contains the OpenAPI 3.0 specification for the KhulnaSoft API and tools to generate client SDKs in various programming languages. The specification defines all available endpoints, request/response schemas, authentication methods, and provides examples for easy integration.
Before you begin, ensure you have the following installed:
- Python 3.7+ - For running the SDK generation script
- PyYAML - Python YAML parser (install via
pip3 install pyyaml) - OpenAPI Generator - Tool for generating SDKs from OpenAPI specs
You can install OpenAPI Generator using either Homebrew or npm:
brew install openapi-generatornpm install -g @openapitools/openapi-generator-cliThe SDK generation script automatically detects which installation method you used.
- Clone this repository:
git clone https://github.com/khulnasoft/khulnasoft-openapi.git
cd khulnasoft-openapi- Install Python dependencies:
pip3 install pyyaml- Install OpenAPI Generator (see Prerequisites)
Generate a TypeScript SDK using the Makefile:
make sdkThis will create a TypeScript/Axios SDK in generated_sdks/typescript/.
You can also use the Python script directly for more control:
python3 scripts/generate_sdk.py --sdk node --output ./my-custom-outputArguments:
-s, --sdk- SDK type to generate (currently supported:node)-o, --output- Output directory for the generated SDK
Remove all generated SDK files:
make cleanThis repository includes automatic integration with Stainless for advanced SDK generation.
The OpenAPI spec is automatically uploaded to Stainless when:
- Changes are pushed to the
mainbranch that modifyopenapi.yaml - The workflow is manually triggered
To enable Stainless integration:
- Get your Stainless API key from stainlessapi.com
- Add it as a repository secret named
STAINLESS_API_KEY:- Go to repository Settings β Secrets and variables β Actions
- Click "New repository secret"
- Name:
STAINLESS_API_KEY - Value: Your Stainless API key
Once configured, the workflow will automatically upload the sanitized OpenAPI spec to Stainless on every update.
khulnasoft-openapi/
βββ openapi.yaml # Main OpenAPI 3.0 specification
βββ scripts/
β βββ generate_sdk.py # SDK generation script
βββ sdk-template-overrides/
β βββ typescript-axios/ # Custom templates for TypeScript SDK
β βββ apiInner.mustache
β βββ configuration.mustache
βββ generated_sdks/ # Generated SDKs (gitignored)
βββ Makefile # Convenience commands
βββ .gitignore # Git ignore rules
βββ README.md # This file
-
Sanitization: The script reads
openapi.yamland performs sanitization:- Removes custom
oai*keys (used for documentation) - Fixes null defaults for objects/arrays
- Handles nested array types
- Removes custom
-
Generation: Uses OpenAPI Generator to create SDK code from the sanitized spec
-
Cleanup: Removes temporary files automatically
Edit openapi.yaml to add or modify API endpoints. The spec follows OpenAPI 3.0 standards.
Custom metadata can be added using keys starting with oai - these will be automatically filtered out during SDK generation.
To add support for additional SDK languages, modify scripts/generate_sdk.py:
- Add a new condition in the
generate_sdk()function - Specify the appropriate OpenAPI Generator language flag
- Optionally add custom templates in
sdk-template-overrides/
Example:
elif sdk_type == "python":
command = [
generator_cmd, "generate",
"-i", str(sanitized_spec_path),
"-g", "python",
"-o", str(output_dir),
]Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
See the LICENSE file for details.