openapi_generator_annotations
7.0.0, released 6 months ago by devappliance.com
Annotation package for configuring openapi_generator client SDKs.
What it does
Provides annotations like @Openapi to configure the generation of client SDKs from OpenAPI specifications. Works in conjunction with the openapi_generator package.
AI-written summary of version 7.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are using openapi_generator to generate client SDKs from OpenAPI specs in your Dart or Flutter project
Skip it when
- You are not using code generation for OpenAPI specs
Strengths
- Enables clean configuration of OpenAPI generators via annotations
- Integrates with build_runner workflows
Weaknesses
- Dependent on external OpenApi generator tools and specifications
- Requires build_runner setup
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 2
Add openapi_generator_annotations to dependencies and openapi_generator to dev_dependencies, then configure with annotations and run build_runner.
import 'package:openapi_generator_annotations/openapi_generator_annotations.dart';
@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_annotations.
- envied_generator
Generates compile‑time Dart constants from .env files for the Envied package.
79Compare - retrofit_generator
Generates Dio client code from Retrofit‑style annotations.
89Compare - swagger_parser
Generate Dart models and HTTP clients from Swagger and OpenAPI schemas.
87Compare - riverpod_annotation
Annotations for riverpod_generator to enable code generation
85Compare
Works with
Packages commonly used together with openapi_generator_annotations: ones it builds on, ones built on it, and its own family.
- cryptoopenapi_generator_annotations depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- openapi_generator_cliSame familyA Dart CLI wrapper around openapi-generator to generate API client code.
- openapi_generatorBuilt on openapi_generator_annotationsGenerator for OpenAPI client SDKs in Dart and Flutter projects.