Bugzilla – Attachment 133111 Details for
Bug 30385
Standardize our swagger yaml spec files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Script to generate
Script-to-generate.patch (text/plain), 1.54 KB, created by
Jonathan Druart
on 2022-04-08 10:05:19 UTC
(
hide
)
Description:
Script to generate
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-04-08 10:05:19 UTC
Size:
1.54 KB
patch
obsolete
>From 91ccce896c7533f1b6b22235b45754f30c59ee61 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 8 Apr 2022 12:04:56 +0200 >Subject: [PATCH] Script to generate > >https://bugs.koha-community.org/show_bug.cgi?id=30385 >--- > sort_yaml.pl | 35 +++++++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > create mode 100644 sort_yaml.pl > >diff --git a/sort_yaml.pl b/sort_yaml.pl >new file mode 100644 >index 00000000000..2f0c7aec3dd >--- /dev/null >+++ b/sort_yaml.pl >@@ -0,0 +1,35 @@ >+use Modern::Perl; >+ >+use List::MoreUtils qw( uniq duplicates ); >+use YAML; >+use File::Slurp qw( write_file ); >+ >+my @files = qx{ls api/v1/**/**/*.yaml}; >+for my $file ( @files ) { >+ chomp $file; >+ say "Processing $file"; >+ my $hash = YAML::LoadFile($file); >+ >+ ss($hash); >+ my $yaml = YAML::Dump($hash); >+ $yaml =~ s|-\snull|- "null"|xmsg; >+ write_file($file, $yaml); >+} >+ >+sub ss { >+ my ($hash) = @_; >+ return unless ref($hash); >+ return if ref($hash) eq "ARRAY"; >+ for my $k ( keys %$hash ) { >+ ss($hash->{$k}); >+ } >+ my @sorted_keys = qw( swagger basePath definitions paths info x-mojo-to operationId tags summary produces parameters responses x-koha-authorization); >+ push @sorted_keys, qw( description type properties additionalProperties ); >+ my @existing_keys = sort keys %$hash; >+ my @dup = duplicates( @sorted_keys, @existing_keys ); >+ my @uniq = uniq( @dup, @existing_keys ); >+ push @dup, @uniq; >+ @dup = uniq( @dup ); >+ >+ YAML::Bless($hash)->keys(\@dup); >+} >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30385
:
133110
| 133111