सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
एक डार्ट एनोटेशन पैकेज जिसे openapi_generator टूल के साथ काम करने के लिए डिज़ाइन किया गया है, जिससे डेवलपर्स ओपनएपीआई विनिर्माण स्पेसिफिकेशन से सीधे डार्ट मॉडल और एपीआई क्लाइंट बना सकते हैं। यह मानकीकृत एपीआई परिभाषाओं के आधार पर स्वचालित कोड उत्पादन के माध्यम से फ्लटर और अन्य डार्ट एप्लिकेशन में आरईएस्टफुल एपीआई के एकीकरण को सरल बनाता है। एनोटेशन जनरेटर को ओपनएपीआई 3.0+ मानकों के अनुरूप साफ और प्रकार-सुरक्षित कोड उत्पन्न करने के लिए निर्देश देते हैं। यह पैकेज एपीआई-प्रथम विकास अभ्यास का पालन करने वाली टीमों के लिए आदर्श है।
उपयोग
OpenAPI विनिर्माण स्पेस से क्लाइंट कोड उत्पन्न करना
API मॉडल निर्माण को स्वचालित करना
API-पहले विकास कार्यप्रवाह सक्षम करें
Flutter ऐप्स में REST APIs का एकीकरण
बैकएंड-फ्रंटएंड सिंक्रनाइजेशन को आसान बनाना
मुख्य विशेषताएँ
OpenAPI स्कीमा परिभाषा के लिए टिप्पणियाँ
openapi_generator उपकरण के साथ एकीकरण
OpenAPI 3.0+ का समर्थन
प्रकार सुरक्षित उत्पन्न कोड
प्लेटफॉर्म के अनुकूलता
इनके लिए उपयुक्त
API-प्रथम विकास टीमें
Flutter ऐप्स REST APIs का उपयोग कर रहे हैं
OpenAPI विनिर्माण का उपयोग करने वाले प्रोजेक्ट
स्वचालित कोड जनरेशन की खोज कर रहे विकासकर्मी
स्थिर API अनुबंध की आवश्यकता वाली टीमें
विचार योग्य बातें
openapi_generator उपकरण सेटअप की आवश्यकता है
सटीक OpenAPI विनिर्माण पर निर्भर
उत्पन्न कोड में हस्तकला समायोजन की आवश्यकता हो सकती है
रनटाइम API संशोधन के लिए उपयुक्त नहीं
स्थिर कोड उत्पादन तक सीमित
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
openapi-generator-dart
Like this library? Give us a star or a like!
⚠️ Java Requirement
Java is required to use this library.
The OpenAPI Generator CLI is a Java application.
Please ensure you have Java (version 8 or higher) installed and available in your system PATH.
You can check your Java installation with:
java -version
If you do not have Java installed, download it from Adoptium or Oracle.
⚠️ Deprecation & Breaking Change Notice
skipIfSpecIsUnchanged is Deprecated
The skipIfSpecIsUnchanged option is now deprecated and will be removed in the next major release.
Local OpenAPI specs are now automatically watched for changes.
If your spec file is in the lib/ folder, this works out of the box.
If your spec file is outside lib/, you must update or add a build.yaml to include your spec file as a source.
Example:
targets:$default:sources:-$package$-lib/**-openapi.yaml# or your spec file path
Remote specs:
Use the forceAlwaysRun (defaults to false) option to ensure the generator always runs.
This option is ignored for local specs.
When enabled, it modifies the annotated file to force regeneration. This might cause issues such as merge conflicts
Overview
This repository provides Dart/Flutter libraries for generating OpenAPI client SDKs directly from your OpenAPI specification. Inspired by Openapi Generator Cli (npm), it enables seamless integration into Dart and Flutter projects.
Libraries
Library
Description
Latest Version
openapi-generator
Dev dependency for generating OpenAPI client SDK via Dart source gen (usage)
openapi-generator-annotations
Annotations for configuring OpenAPI client SDK generation (usage)
If you are having issues with the generated code, this is not an problem with this package and creating an issue here will not help solve it. Its best to create the issue in the base OpenApi library since this package is a wrapper around that library for ease of use with Flutter/dart.
Below are some advanced configurations you may try.
Custom Templates:
Use the templateDirectory parameter to specify a custom code generation template.
Type & Import Mappings:
Use typeMappings and importMappings to control how OpenAPI types and models are mapped in Dart.
Reserved Words:
Use reservedWordsMappings to avoid conflicts with Dart reserved words.
Dependency Conflicts:
Use dependency_overrides in the generated package's pubspec.yaml and add pubspec.yaml to .openapi-generator-ignore to prevent overwrites.
Incorrect Generated Code:
Fix your OpenAPI spec (preferred).
Manually edit the generated code and add the files to .openapi-generator-ignore to prevent them from being overwritten.
.openapi-generator-ignore Example:
# Ignore all test files
test/*
# Ignore pubspec.yaml to preserve manual changes
pubspec.yaml