forked from loafle/openapi-generator-original
[Dart] Annotate required named parameters in model (#6798)
This commit is contained in:
parent
454ceb45fa
commit
df2c927dcb
@ -3,6 +3,7 @@ library {{pubName}}.api;
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
part 'api_client.dart';
|
||||
part 'api_helper.dart';
|
||||
|
@ -9,7 +9,7 @@ class {{classname}} {
|
||||
|
||||
{{classname}}({
|
||||
{{#vars}}
|
||||
this.{{name}},
|
||||
{{#required}}@required this.{{name}},{{/required}}{{^required}}this.{{name}},{{/required}}
|
||||
{{/vars}}
|
||||
});
|
||||
|
||||
|
@ -8,5 +8,6 @@ environment:
|
||||
sdk: '>=2.0.0 <3.0.0'
|
||||
dependencies:
|
||||
http: '>=0.12.0 <0.13.0'
|
||||
meta: ^1.1.8
|
||||
dev_dependencies:
|
||||
test: ^1.3.0
|
||||
|
@ -26,13 +26,13 @@ void main() {
|
||||
..name = 'Jose'
|
||||
];
|
||||
return Pet(
|
||||
id : id,
|
||||
category: category,
|
||||
tags: tags,
|
||||
name: name,
|
||||
id : id,
|
||||
category: category,
|
||||
name: name, //required field
|
||||
photoUrls: ['https://petstore.com/sample/photo1.jpg'] //required field
|
||||
)
|
||||
..status = status
|
||||
..photoUrls = ['https://petstore.com/sample/photo1.jpg'];
|
||||
..tags = tags
|
||||
..status = '';
|
||||
}
|
||||
|
||||
group('Pet API with live client', () {
|
||||
|
@ -3,6 +3,7 @@ library openapi.api;
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
part 'api_client.dart';
|
||||
part 'api_helper.dart';
|
||||
|
@ -18,8 +18,8 @@ class Pet {
|
||||
Pet({
|
||||
this.id,
|
||||
this.category,
|
||||
this.name,
|
||||
this.photoUrls,
|
||||
@required this.name,
|
||||
@required this.photoUrls,
|
||||
this.tags,
|
||||
this.status,
|
||||
});
|
||||
|
@ -8,5 +8,6 @@ environment:
|
||||
sdk: '>=2.0.0 <3.0.0'
|
||||
dependencies:
|
||||
http: '>=0.12.0 <0.13.0'
|
||||
meta: ^1.1.8
|
||||
dev_dependencies:
|
||||
test: ^1.3.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user