Skip to content

Commit

Permalink
Merge pull request #125 from icapps/feature/#123-show-files-are-gener…
Browse files Browse the repository at this point in the history
…ated

Feature/#123 show files are generated
  • Loading branch information
ikbendewilliam committed Dec 27, 2022
2 parents 210342f + c426729 commit 56812f2
Show file tree
Hide file tree
Showing 60 changed files with 124 additions and 1 deletion.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions example/lib/model/article/no_custom_base_directory_obj.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions example/lib/model/ogm.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions example/lib/model/user/person/gender.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions example/lib/model/user/person/person.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions example/lib/model/user/profile/admin_profile_data.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions example/lib/model/user/profile/user_profile_data.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions example/lib/model/user/project/project.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions example/lib/model/user/testing.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/writer/enum_model_writer.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:model_generator/model/model/enum_model.dart';
import 'package:model_generator/writer/object_model_writer.dart';

class EnumModelWriter {
final EnumModel jsonModel;
Expand All @@ -7,6 +8,8 @@ class EnumModelWriter {

String write() {
final sb = StringBuffer()
..writeln(ObjectModelWriter.autoGeneratedWarning)
..writeln()
..writeln("import 'package:json_annotation/json_annotation.dart';")
..writeln();

Expand Down
6 changes: 5 additions & 1 deletion lib/writer/object_model_writer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import '../util/case_util.dart';
import '../util/type_checker.dart';

class ObjectModelWriter {
static const autoGeneratedWarning =
'// GENERATED CODE - DO NOT MODIFY BY HAND';
final PubspecConfig pubspecConfig;
final ObjectModel jsonModel;
final List<Field> extendsFields;
Expand All @@ -24,7 +26,9 @@ class ObjectModelWriter {
);

String write() {
final sb = StringBuffer();
final sb = StringBuffer()
..writeln(autoGeneratedWarning)
..writeln();
final imports = <String>{}
..add("import 'package:json_annotation/json_annotation.dart';");
for (final element
Expand Down
2 changes: 2 additions & 0 deletions test/writer/enum_model_writer/custom-value-map-extension.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

enum MyEnumModel {
Expand Down
2 changes: 2 additions & 0 deletions test/writer/enum_model_writer/custom-value-map.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

enum MyEnumModel {
Expand Down
2 changes: 2 additions & 0 deletions test/writer/enum_model_writer/custom-value.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

enum MyEnumModel {
Expand Down
2 changes: 2 additions & 0 deletions test/writer/enum_model_writer/no-fields.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

enum MyEnumModel {
Expand Down
2 changes: 2 additions & 0 deletions test/writer/enum_model_writer/normal-description.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

///A good description of this enum
Expand Down
2 changes: 2 additions & 0 deletions test/writer/enum_model_writer/normal.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

enum MyEnumModel {
Expand Down
2 changes: 2 additions & 0 deletions test/writer/enum_model_writer/null-value.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

enum MyEnumModel {
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/array/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/converter/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'package:model_generator_example/model/user/person/date_time_converter.dart';

Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/custom-from-to/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'package:model_generator_example/model/user/person/time.dart';

Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/dart-import/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'package:model_generator_example/model/user/custom_address.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'package:shared/user/custom_address.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/default-field/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'package:model_generator_example/model/user/person/user.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'package:model_generator_example/model/user/custom_address.dart';
import 'package:model_generator_example/model/user/person/person.dart';
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/extend-fields/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'package:model_generator_example/model/user/person/person.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'testing:package.dart';

Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/extra-imports/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:flutter/foundation.dart';
import 'package:json_annotation/json_annotation.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/ignore/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/import_sorting/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:aaaaaa_application/model/user/a_model/a_model.dart';
import 'package:json_annotation/json_annotation.dart';

Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/include-if-null/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/map-reference/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'package:model_generator_example/model/user/person/person.dart';

Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/map/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/non-final/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/normal-to-string/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/normal/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/nullsafety/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/package-import/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'package:shared/user/custom_address/address.dart';

Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/required/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/sort/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';

part 'person.g.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'package:model_generator_example/model/address.dart';
import 'testing:handler.dart';
Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/to-json-from-json/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'package:model_generator_example/model/address.dart';

Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/unknown-enum-value/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'package:model_generator_example/model/user/person/gender.dart';

Expand Down
2 changes: 2 additions & 0 deletions test/writer/object_model_writer/without-path/output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

import 'package:json_annotation/json_annotation.dart';
import 'package:model_generator_example/model/address.dart';

Expand Down

0 comments on commit 56812f2

Please sign in to comment.