Skip to content

Commit 2ea7b27

Browse files
committed
refactored lib
1 parent 54f2201 commit 2ea7b27

40 files changed

+1164
-312
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
## 1.0.0
22

3-
- Initial version, created by Stagehand
3+
- Initial version

LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright 2020 Joseph Gibah
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
4+
conditions are met:
5+
6+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7+
8+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
9+
in the documentation and/or other materials provided with the distribution.
10+
11+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
12+
from this software without specific prior written permission.
13+
14+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
15+
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16+
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
17+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
18+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20+
POSSIBILITY OF SUCH DAMAGE.

example/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,5 @@ fabric.properties
188188

189189
# Android studio 3.1+ serialized cache file
190190
.idea/caches/build_file_checksums.ser
191+
!/api/petstore_api/pubspec.yaml
192+
api/

example/api/petstore_api/.gitignore

-32
This file was deleted.

example/api/petstore_api/.openapi-generator-ignore

-23
This file was deleted.

example/api/petstore_api/.travis.yml

-11
This file was deleted.

example/api/petstore_api/README.md

-130
This file was deleted.

example/api/petstore_api/analysis_options.yaml

-1
This file was deleted.

example/api/petstore_api/git_push.sh

-58
This file was deleted.

example/lib/main.dart

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import 'package:flutter/material.dart';
2-
32
import 'package:petstore_api/api.dart';
4-
import 'package:petstore_api/api/pet_api.dart';
53
import 'package:petstore_api/api/store_api.dart';
6-
import 'package:provider/provider.dart';
74

85
void main() => runApp(MyApp());
96

example/lib/openapi_config.dart

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import 'package:flutter/material.dart';
2-
import 'package:meta/meta.dart';
31
import 'package:openapi_generator_annotations/openapi_generator_annotations.dart';
42

53
@Openapi(
64
additionalProperties:
7-
AdditionalProperties(pubName: 'petstore_api', pubAuthor: 'Johnny dep'),
5+
AdditionalProperties(pubName: 'petstore_api', pubAuthor: 'Johnny depp'),
86
inputSpecFile: 'spec/openapi-spec.yaml',
97
generatorName: 'dart-jaguar',
108
outputDirectory: 'api/petstore_api')
11-
class OpenapiConfig extends OpenapiGeneratorConfig {}
9+
class OpenapiConfig extends OpenapiGeneratorConfig {
10+
}

example/pubspec.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ environment:
1919
dependencies:
2020
flutter:
2121
sdk: flutter
22-
openapi_generator_annotations: ^0.0.2-dev
22+
openapi_generator_annotations: ^1.0.2
2323
petstore_api:
2424
path: api/petstore_api
2525
provider: ^4.0.4
@@ -33,8 +33,7 @@ dev_dependencies:
3333
flutter_test:
3434
sdk: flutter
3535
build_runner: ^1.7.4
36-
openapi_generator:
37-
path: ../openapi-generator
36+
openapi_generator: ^0.1.2
3837

3938

4039
# For information on the generic Dart part of this file, see the

openapi-generator-annotations/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.2
2+
3+
- Updated documentation
4+
15
## 0.0.2-dev
26

37
- Changed version to dev since this package is still in active development

openapi-generator-annotations/README.md

+26-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
Annotation library for dart/flutter implementation of openapi client code generation.
2+
To be used together with [openapi-generator](https://pub.dev/packages/openapi_generator)
23

3-
Created from templates made available by Stagehand under a BSD-style
4-
[license](https://github.com/dart-lang/stagehand/blob/master/LICENSE).
4+
[license](https://github.com/gibahjoe/openapi-generator-dart/blob/master/openapi-generator-annotations/LICENSE).
55

66
## Usage
77

8-
A simple usage example:
8+
Include [openapi-generator-annotations](https://pub.dev/packages/openapi_generator_annotations) as a dependency in the dependencies section of your pubspec.yaml file :
9+
10+
```yaml
11+
dependencies:
12+
openapi_generator_annotations: ^1.0.0
13+
```
14+
15+
16+
Add [openapi-generator](https://pub.dev/packages/openapi_generator) in the dev dependencies section of your pubspec.yaml file:
17+
18+
```yaml
19+
dev_dependencies:
20+
openapi_generator: ^0.0.2-beta
21+
```
22+
23+
24+
Annotate a dart class with @Openapi() annotation
925
1026
```dart
1127
@Openapi(
@@ -17,6 +33,13 @@ A simple usage example:
1733
class Example extends OpenapiGeneratorConfig {}
1834
```
1935

36+
Run command below to generate open api client sdk from spec file specified in annotation.
37+
```cmd
38+
flutter pub run build_runner build --delete-conflicting-outputs
39+
```
40+
41+
The api sdk will be generated in the folder specified in the annotation. See examples for more details
42+
2043
## Features and bugs
2144

2245
Please file feature requests and bugs at the [issue tracker][tracker].

0 commit comments

Comments
 (0)