GithubHelp home page GithubHelp logo

francescoberardi / openapi-generator-dart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gibahjoe/openapi-generator-dart

0.0 0.0 0.0 50.42 MB

Openapi Generator for Dart/Flutter

License: BSD 3-Clause "New" or "Revised" License

Shell 0.38% Objective-C 0.09% Kotlin 0.31% Dart 88.62% Swift 1.01% HTML 9.58%

openapi-generator-dart's Introduction

This codebase houses the dart/flutter implementations of the openapi client sdk code generation libraries.

With this project, you can generate openapi client sdk libraries for your openapi specification right in your flutter/dart projects. (see example)

license.

This repo contains the following dart libraries

Library Description latest version
openapi-generator Dev dependency for generating openapi sdk via dart source gen see here for usage pub package
openapi-generator-annotations Annotations for annotating dart class with instructions for generating openapi sdk see here for usage pub package
openapi-generator-cli Cli code openapi sdk generator for dart see here for usage pub package

Usage

Include openapi-generator-annotations as a dependency in the dependencies section of your pubspec.yaml file :

dependencies:
  openapi_generator_annotations: ^[latest-version]

For testing out the beta features in openapi generator, use the beta branch like below. This is not recommended for production builds

dependencies:
  openapi_generator_annotations: 
    git:
      url: https://github.com/gibahjoe/openapi-generator-dart.git
      ref: beta
      path: openapi-generator-annotations

Add openapi-generator in the dev dependencies section of your pubspec.yaml file:

dev_dependencies:
  openapi_generator: ^[latest version]

For testing out the beta features in openapi generator, use the beta branch like below. This is not recommended for production builds

dev_dependencies:
  openapi_generator: 
    git:
      url: https://github.com/gibahjoe/openapi-generator-dart.git
      ref: beta
      path: openapi-generator

Annotate a dart class with @Openapi() annotation

@Openapi(
    additionalProperties:
    AdditionalProperties(pubName: 'petstore_api', pubAuthor: 'Johnny dep'),
    inputSpecFile: 'example/openapi-spec.yaml',
    generatorName: Generator.dart,
    outputDirectory: 'api/petstore_api')
class Example extends OpenapiGeneratorConfig {}

Run

flutter pub run build_runner build --delete-conflicting-outputs

to generate open api client sdk from spec file specified in annotation. The api sdk will be generated in the folder specified in the annotation. See examples for more details

Features and bugs

Please file feature requests and bugs at the issue tracker.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.