openapi_generator
7.0.0, released 6 months ago by devappliance.com
Generator for OpenAPI client SDKs in Dart and Flutter projects.
What it does
Generates API client SDKs directly from local or remote OpenAPI specifications using build_runner. It acts as a wrapper around the Java-based OpenAPI Generator CLI to integrate seamlessly into Dart and Flutter development workflows.
AI-written summary of version 7.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You have an OpenAPI specification (JSON or YAML) and need to generate a matching Dart client SDK.
- You want automated synchronization of your API client when the backend OpenAPI spec updates.
Skip it when
- You do not have Java installed on your system (Java 8 or higher is required).
- You prefer writing your REST API clients manually.
Strengths
- Automates client SDK generation from standard OpenAPI specs.
- Supports both local file and remote URL specifications with caching.
Weaknesses
- Requires Java to be installed and available in the system PATH.
- Issues with generated code often need to be addressed in the base OpenApi library rather than this wrapper.
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- Yes (build_runner)
- Direct dependencies
- 11
Requires Java (version 8 or higher) installed in your system PATH. Add openapi_generator_annotations to dependencies and openapi_generator to dev_dependencies, then run build_runner.
@Openapi(
additionalProperties: DioProperties(pubName: 'petstore_api', pubAuthor: 'Johnny Depp'),
inputSpec: RemoteSpec(path: 'https://petstore3.swagger.io/api/v3/openapi.json'),
generatorName: Generator.dio,
outputDirectory: 'api/petstore_api',
)
class Example {}Alternatives
Packages that do the same job and could replace openapi_generator.
- retrofit_generator
Generates Dio client code from Retrofit‑style annotations.
89Compare - chopper_generator
Generates type‑safe Chopper client code from annotated service interfaces.
78Compare - mason_cli
CLI tool to create and consume reusable template bricks for code generation.
89Compare - tonik
Pure Dart OpenAPI 3.0/3.1 code generator for type-safe API client packages.
74Compare
Works with
Packages commonly used together with openapi_generator: ones it builds on, ones built on it, and its own family.
- analyzeropenapi_generator depends on itPerforms static analysis of Dart code for tool integration and embedding.
- yamlopenapi_generator depends on itA Dart library for parsing YAML documents into Dart data structures.
- cryptoopenapi_generator depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- loggingopenapi_generator depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- buildopenapi_generator depends on itPackage for authoring build_runner compatible code generators.
- source_genopenapi_generator depends on itSource code generation builders and utilities for the Dart build system.
- openapi_generator_annotationsopenapi_generator depends on itAnnotation package for configuring openapi_generator client SDKs.
- openapi_generator_cliopenapi_generator depends on itA Dart CLI wrapper around openapi-generator to generate API client code.