Skip to content
pubscout

openapi_generator_annotations

7.0.0, released 6 months ago by devappliance.com

Annotation package for configuring openapi_generator client SDKs.

$ flutter pub add openapi_generator_annotations
Source repository

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.

Works with

Packages commonly used together with openapi_generator_annotations: ones it builds on, ones built on it, and its own family.