Skip to content

Commit 27586dc

Browse files
authored
Merge pull request #14 from gibahjoe/1.1.x
released 1.1.1
2 parents a35cf20 + 4758259 commit 27586dc

File tree

20 files changed

+1106
-122
lines changed

20 files changed

+1106
-122
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Annotate a dart class with @Openapi() annotation
4141
additionalProperties:
4242
AdditionalProperties(pubName: 'petstore_api', pubAuthor: 'Johnny dep'),
4343
inputSpecFile: 'example/openapi-spec.yaml',
44-
generatorName: 'dart',
44+
generatorName: Generator.DART2_API,
4545
outputDirectory: 'api/petstore_api')
4646
class Example extends OpenapiGeneratorConfig {}
4747
```

example/spec/openapi-spec.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,13 @@ paths:
5858
in: query
5959
required: false
6060
schema:
61-
type: integer
62-
format: int64
61+
type: array
62+
items:
63+
type: string
64+
enum:
65+
- IOS
66+
- MAC_OS
67+
- TV_OS
6368
- name: offset
6469
in: query
6570
required: false

openapi-generator-annotations/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 1.1.1
2+
3+
- Fixed build issue
4+
5+
## 1.1.0
6+
7+
- Added support for **_dart2-api_** from [dart-ogurets](https://github.com/dart-ogurets/dart-openapi-maven)
8+
thanks to [Robert Csakany](https://github.com/robertcsakany)
9+
- [Breaking change] - Changed generator name to enum
10+
111
## 1.0.8
212

313
- fixed typo

openapi-generator-annotations/example/example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import 'package:openapi_generator_annotations/openapi_generator_annotations.dart
44
additionalProperties:
55
AdditionalProperties(pubName: 'petstore_api', pubAuthor: 'Johnny dep'),
66
inputSpecFile: 'example/openapi-spec.yaml',
7-
generatorName: 'dart-jaguar',
7+
generatorName: Generator.DART_JAGUAR,
88
outputDirectory: 'api/petstore_api')
99
class Example extends OpenapiGeneratorConfig {}

openapi-generator-annotations/lib/src/openapi_generator_annotations_base.dart

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ class Openapi {
88
/// --additional-properties
99
final AdditionalProperties additionalProperties;
1010

11+
/// The package of the api. defaults to lib.api
12+
///
13+
/// --api-package
14+
final String apiPackage;
15+
1116
/// relative path or url to spec file
1217
///
1318
/// -i
@@ -21,7 +26,7 @@ class Openapi {
2126
/// Generator to use (dart|dart2-api|dart-jaguar|dart-dio)
2227
///
2328
/// -g, --generator-name
24-
final String generatorName;
29+
final Generator generatorName;
2530

2631
/// Where to write the generated files (current dir by default)
2732
///
@@ -36,20 +41,24 @@ class Openapi {
3641
/// Skips the default behavior of validating an input specification.
3742
///
3843
/// --skip-validate-spec
39-
final bool skipValidateSpec;
44+
final bool skipSpecValidation;
4045

4146
/// Tells openapi-generator to always run during the build process
4247
/// if set to false (the default), openapi-generator will skip processing if the [outputDirectory] already exists
4348
final bool alwaysRun;
4449

50+
final Map<String, String> typeMappings;
51+
4552
const Openapi(
4653
{this.additionalProperties,
4754
this.overwriteExistingFiles,
48-
this.skipValidateSpec = false,
55+
this.skipSpecValidation = false,
4956
this.inputSpecFile,
5057
this.templateDirectory,
5158
this.generatorName,
5259
this.outputDirectory,
60+
this.typeMappings,
61+
this.apiPackage,
5362
this.alwaysRun = false});
5463
}
5564

@@ -109,11 +118,14 @@ class AdditionalProperties {
109118
this.sourceFolder});
110119
}
111120

112-
class DartJaguarConfig extends AdditionalProperties {
113-
final String serialization;
121+
class JaguarProperties extends AdditionalProperties {
122+
/// Choose serialization format JSON or PROTO is supported
123+
final SerializationFormat serialization;
124+
125+
/// Is the null fields should be in the JSON payload
114126
final bool nullableFields;
115127

116-
const DartJaguarConfig(
128+
const JaguarProperties(
117129
{this.serialization,
118130
this.nullableFields,
119131
bool allowUnicodeIdentifiers = false,
@@ -144,3 +156,46 @@ class DartJaguarConfig extends AdditionalProperties {
144156
sourceFolder: sourceFolder,
145157
useEnumExtension: useEnumExtension);
146158
}
159+
160+
class DioProperties extends AdditionalProperties {
161+
/// Choose serialization format JSON or PROTO is supported
162+
final DioDateLibrary dateLibrary;
163+
164+
/// Is the null fields should be in the JSON payload
165+
final bool nullableFields;
166+
167+
const DioProperties(
168+
{this.dateLibrary,
169+
this.nullableFields,
170+
bool allowUnicodeIdentifiers = false,
171+
bool ensureUniqueParams = true,
172+
bool prependFormOrBodyParameters = false,
173+
String pubAuthor,
174+
String pubAuthorEmail,
175+
String pubDescription,
176+
String pubHomepage,
177+
String pubName,
178+
String pubVersion,
179+
bool sortModelPropertiesByRequiredFlag = true,
180+
bool sortParamsByRequiredFlag = true,
181+
bool useEnumExtension = true,
182+
String sourceFolder})
183+
: super(
184+
allowUnicodeIdentifiers: allowUnicodeIdentifiers,
185+
ensureUniqueParams: ensureUniqueParams,
186+
prependFormOrBodyParameters: prependFormOrBodyParameters,
187+
pubAuthor: pubAuthor,
188+
pubAuthorEmail: pubAuthorEmail,
189+
pubDescription: pubDescription,
190+
pubHomepage: pubHomepage,
191+
pubVersion: pubVersion,
192+
sortModelPropertiesByRequiredFlag:
193+
sortModelPropertiesByRequiredFlag,
194+
sortParamsByRequiredFlag: sortParamsByRequiredFlag,
195+
sourceFolder: sourceFolder,
196+
useEnumExtension: useEnumExtension);
197+
}
198+
enum DioDateLibrary { core, timemachine }
199+
enum SerializationFormat { JSON, PROTO }
200+
/// The name of the generator to use
201+
enum Generator { DART, DART_DIO, DART2_API, DART_JAGUAR }
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: openapi_generator_annotations
22
description: Annotation package for openapi_generator https://pub.dev/packages/openapi_generator.
3-
version: 1.0.8
3+
version: 1.1.1
44
homepage: https://github.com/gibahjoe/openapi-generator-dart
55

66

77
environment:
88
sdk: '>=2.7.0 <3.0.0'
99

1010
dev_dependencies:
11-
pedantic: ^1.9.0
12-
test: ^1.14.3
11+
pedantic: ^1.9.2
12+
test: ^1.15.3

openapi-generator-cli/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Icon
6666
Network Trash Folder
6767
Temporary Items
6868
.apdisk
69-
69+
target
7070
### Windows template
7171
# Windows thumbnail cache files
7272
Thumbs.db

openapi-generator-cli/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.1.0
2+
3+
- Added support for **_dart2-api_** from [dart-ogurets](https://github.com/dart-ogurets/dart-openapi-maven)
4+
thanks to [Robert Csakany](https://github.com/robertcsakany)
5+
16
## 1.0.8
27

38
- Updated Generator to 4.3.1 [Check here for details](https://github.com/OpenAPITools/openapi-generator)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class Example {}

0 commit comments

Comments
 (0)