Generate dart client code for OpenAPI specifications
IMPORTANT: At the moment this code generator works only with JSON formatted OpenAPI files!
- Add this library to your dev_dependencies (Needs access to this repository via SSH):
dev_dependencies:
dart_openapi_codegen:
git: [email protected]:famedly/dart_openapi_codegen.git
-
Run
dart pub get
-
Start the code generator and pass the necessary arguments:
dart_openapi_codegen <OUTPUT_DIRECTORY> <PATH_TO_OPENAPI_FILE> <OPTIONAL_RULES_FILE>
Examples:
// Create a simple client SDK from an openapi file:
pub run dart_openapi_codegen ./lib/src/generated ./openapi.json
To update the generated code in matrix_api_lite, use the script:
./scripts/matrix.sh ../dart_matrix_api_lite/lib/src/generated
The script clones and patches matrix-doc
and generates code using the rules in rules/matrix.yaml
.