@@ -226,49 +226,29 @@ public function getParamExample(array $param): string
226226        $ type$ param'type ' ] ?? '' ;
227227        $ example$ param'example ' ] ?? '' ;
228228
229-         $ output '' ;
229+         $ hasExample ! empty ( $ example ) ||  $ example  ===  0  ||  $ example  ===  false ;
230230
231-         if  (empty ($ example$ example0  && $ examplefalse ) {
232-             switch  ($ type
233-                 case  self ::TYPE_FILE :
234-                     $ output'InputFile(path:  \'./path-to-files/image.jpg \', filename:  \'image.jpg \') ' ;
235-                     break ;
236-                 case  self ::TYPE_NUMBER :
237-                 case  self ::TYPE_INTEGER :
238-                     $ output'0 ' ;
239-                     break ;
240-                 case  self ::TYPE_BOOLEAN :
241-                     $ output'false ' ;
242-                     break ;
243-                 case  self ::TYPE_STRING :
244-                     $ output"'' " ;
245-                     break ;
246-                 case  self ::TYPE_OBJECT :
247-                     $ output'{} ' ;
248-                     break ;
249-                 case  self ::TYPE_ARRAY :
250-                     $ output'[] ' ;
251-                     break ;
252-             }
253-         } else  {
254-             switch  ($ type
255-                 case  self ::TYPE_OBJECT :
256-                 case  self ::TYPE_FILE :
257-                 case  self ::TYPE_NUMBER :
258-                 case  self ::TYPE_INTEGER :
259-                 case  self ::TYPE_ARRAY :
260-                     $ output$ example
261-                     break ;
262-                 case  self ::TYPE_BOOLEAN :
263-                     $ output$ example'true '  : 'false ' ;
264-                     break ;
265-                 case  self ::TYPE_STRING :
266-                     $ output"' {$ example' " ;
267-                     break ;
268-             }
231+         if  (!$ hasExample
232+             return  match  ($ type
233+                 self ::TYPE_OBJECT  => '{} ' ,
234+                 self ::TYPE_ARRAY  => '[] ' ,
235+                 self ::TYPE_BOOLEAN  => 'false ' ,
236+                 self ::TYPE_FILE  => 'InputFile(path:  \'./path-to-files/image.jpg \', filename:  \'image.jpg \') ' ,
237+                 self ::TYPE_INTEGER , self ::TYPE_NUMBER  => '0 ' ,
238+                 self ::TYPE_STRING  => "'' " ,
239+             };
269240        }
270241
271-         return  $ output
242+         return  match  ($ type
243+             self ::TYPE_ARRAY , self ::TYPE_FILE , self ::TYPE_INTEGER , self ::TYPE_NUMBER  => $ example
244+             self ::TYPE_BOOLEAN  => ($ example'true '  : 'false ' ,
245+             self ::TYPE_OBJECT  => ($ decodedjson_decode ($ exampletrue )) !== null 
246+             ? (empty ($ decoded$ example'{} ' 
247+                 ? '{} ' 
248+                 : preg_replace ('/\n/ ' , "\n     " , json_encode ($ decodedJSON_PRETTY_PRINT )))
249+             : $ example
250+             self ::TYPE_STRING  => "' {$ example' " ,
251+         };
272252    }
273253
274254    /** 
@@ -372,6 +352,11 @@ public function getFiles(): array
372352                'destination '    => '/pubspec.yaml ' ,
373353                'template '       => 'dart/pubspec.yaml.twig ' ,
374354            ],
355+             [
356+                 'scope '          => 'default ' ,
357+                 'destination '    => '/analysis_options.yaml ' ,
358+                 'template '       => 'dart/analysis_options.yaml.twig ' ,
359+             ],
375360            [
376361                'scope '          => 'default ' ,
377362                'destination '    => '/lib/client_io.dart ' ,
@@ -409,7 +394,7 @@ public function getFiles(): array
409394            ],
410395            [
411396                'scope '          => 'service ' ,
412-                 'destination '    => '/lib/services/{{service.name | caseDash }}.dart ' ,
397+                 'destination '    => '/lib/services/{{service.name | caseSnake }}.dart ' ,
413398                'template '       => 'dart/lib/services/service.dart.twig ' ,
414399            ],
415400            [
@@ -419,12 +404,12 @@ public function getFiles(): array
419404            ],
420405            [
421406                'scope '          => 'method ' ,
422-                 'destination '    => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseDash }}.md ' ,
407+                 'destination '    => 'docs/examples/{{service.name | caseLower}}/{{method.name | caseKebab }}.md ' ,
423408                'template '       => 'dart/docs/example.md.twig ' ,
424409            ],
425410            [
426411                'scope '          => 'service ' ,
427-                 'destination '    => '/test/services/{{service.name | caseDash }}_test.dart ' ,
412+                 'destination '    => '/test/services/{{service.name | caseSnake }}_test.dart ' ,
428413                'template '       => 'dart/test/services/service_test.dart.twig ' ,
429414            ],
430415            [
@@ -487,6 +472,11 @@ public function getFiles(): array
487472                'destination '    => '.github/workflows/format.yml ' ,
488473                'template '       => 'dart/.github/workflows/format.yml.twig ' ,
489474            ],
475+             [
476+                 'scope '          => 'default ' ,
477+                 'destination '    => '.github/workflows/test.yml ' ,
478+                 'template '       => 'dart/.github/workflows/test.yml ' ,
479+             ],
490480            [
491481                'scope '          => 'default ' ,
492482                'destination '    => 'lib/src/input_file.dart ' ,
@@ -506,7 +496,7 @@ public function getFilters(): array
506496            new  TwigFilter ('dartComment ' , function  ($ value
507497                $ valueexplode ("\n" , $ value
508498                foreach  ($ valueas  $ key$ line
509-                     $ value$ key"     ///  "  . wordwrap ($ value$ key75 , "\n     ///  );
499+                     $ value$ key"  ///  "  . wordwrap ($ value$ key75 , "\n  ///  " );
510500                }
511501                return  implode ("\n" , $ value
512502            }, ['is_safe '  => ['html ' ]]),
0 commit comments