<div dir="ltr">That sounds like a nice idea! I'd love to hear what Jonathan thinks!<div><br></div><div>Kyle</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><a href="https://secure2.convio.net/cffh/site/Donation2?df_id=1395&FR_ID=4715&PROXY_ID=2706639&PROXY_TYPE=20&1395.donation=form1&s_src=CHORUS&s_subsrc=CHAADOEB" target="_blank"><img src="http://widgets.ch-or.us/badge/convio/cff/4715/2706639"></a><br></div><div><br></div><div><a href="http://www.kylehall.info" target="_blank">http://www.kylehall.info</a><br>ByWater Solutions ( <a href="http://bywatersolutions.com" target="_blank">http://bywatersolutions.com</a> )<br>Meadville Public Library ( <a href="http://www.meadvillelibrary.org" target="_blank">http://www.meadvillelibrary.org</a> )<br>Crawford County Federated Library System ( <a href="http://www.ccfls.org" target="_blank">http://www.ccfls.org</a> )<br></div></div></div></div></div></div>
<br><div class="gmail_quote">On Thu, Jan 5, 2017 at 2:32 PM, Tomas Cohen Arazi <span dir="ltr"><<a href="mailto:tomascohen@gmail.com" target="_blank">tomascohen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">In the process of writing a script for generating swagger object definitions our of DBIC schemas (for sort-of scaffolding them making easier to add REST endpoints) I resumed some talks we had at Marseille, and also picked some previous work from Lari on automating the Koha::Object <-> Swagger translation.<div><br></div><div>One thing that would be handy for this process, is to add the column descriptions to the schema files. This can be accomplished like this example (for Koha::Schema::Result::<wbr>BorrowerAttributeType):</div><div><br></div><div><div>+__PACKAGE__->add_columns(</div><div>+    "+code" => {</div><div>+        koha_description => "Unique key used to identify the attribute type"</div><div>+    },</div><div>+    "+description" =></div><div>+        { koha_description => "Description for the attribute type" },</div><div>+    "+repeatable" => {</div><div>+        koha_description =></div><div>+            "Defines if a patron can have multiple values for the attribute type"</div><div>+    },</div><div>+    "+unique_id" => {</div><div>+        koha_description => "Defines if the assinged value need to be unique"</div><div>+    },</div><div>+    "+opac_display" => {</div><div>+        koha_description =></div><div>+            "Defines if the attribute is visible to patrons on their account in the OPAC or not"</div><div>+    },</div><div>+    "+opac_editable" => {</div><div>+        koha_description =></div><div>+            "Defines if the attribute is editable by patrons on their account in the OPAC or not"</div><div>+    },</div><div>+    "+staff_searchable" => {</div><div>+        koha_description =></div><div>+            "Defines if the attribute is searchable via the patron search in the staff client"</div><div>+    },</div><div>+    "+authorised_value_category" => {</div><div>+        koha_description =></div><div>+            "Foreign key from authorised_values that links this attribute to an authorized value category"</div><div>+    },</div><div>+    "+display_checkout" => {</div><div>+        koha_description =></div><div>+            "Defines if the attribute  is displayed in checkout screens"</div><div>+    },</div><div>+    "+category_code" => {</div><div>+        koha_description =></div><div>+            "Defines a constraint on a patron category for the attribute type"</div><div>+    },</div><div>+    "+class" =></div><div>+        { koha_description => "Defines a class for grouping attributes" }</div><div>+);</div></div><div><br></div><div>This way we can have really simple access to those descriptions we already have in kohastructure.sql:</div><div><br></div><div><div>my $columns_info = Koha::Database->new->schema-><wbr>resultset('<wbr>BorrowerAttributeType')</div><div>    ->result_source->columns_info;</div></div><div><br></div><div>foreach $key ( keys %{ $columns_info } ) {</div><div>    print "Column: $key | Description: " . $columns_info->{$key}->{koha_<wbr>description};</div><div>}</div><div><br></div><div>This could be an easy initial task for academy bugs.</div><div><br></div><div>Opinions? We will need this at some point if we would change our workflow and have DB structure handled by DBIC.</div><div><br></div><div>Anyway, I'll send a pull request to Jonathan so he adds this handy (and perfectible) script to his koha-misc4dev repository. This will make it available on kohadevbox right out-of-the-box. I'll then try to document it on Kyle's Koha Developer Handbook, which we all should add our bits of knowledge!</div><div><br></div><div>Looking forward to your feedback!</div><span class="HOEnZb"><font color="#888888"><div><br></div></font></span></div><span class="HOEnZb"><font color="#888888"><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr"><div style="color:rgb(117,117,117);font-family:"helvetica neue",helvetica,arial,sans-serif;font-size:12.8px">Tomás Cohen Arazi</div><div style="color:rgb(117,117,117);font-family:"helvetica neue",helvetica,arial,sans-serif;font-size:12.8px">Theke Solutions (<a href="http://theke.io/" target="_blank">https://theke.io</a>)<br>✆ <a href="tel:+54%209%20351%20351-3384" value="+5493513513384" target="_blank">+54 9351 3513384</a><br>GPG: B2F3C15F</div></div></div>
</font></span><br>______________________________<wbr>_________________<br>
Koha-devel mailing list<br>
<a href="mailto:Koha-devel@lists.koha-community.org">Koha-devel@lists.koha-<wbr>community.org</a><br>
<a href="http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" rel="noreferrer" target="_blank">http://lists.koha-community.<wbr>org/cgi-bin/mailman/listinfo/<wbr>koha-devel</a><br>
website : <a href="http://www.koha-community.org/" rel="noreferrer" target="_blank">http://www.koha-community.org/</a><br>
git : <a href="http://git.koha-community.org/" rel="noreferrer" target="_blank">http://git.koha-community.org/</a><br>
bugs : <a href="http://bugs.koha-community.org/" rel="noreferrer" target="_blank">http://bugs.koha-community.<wbr>org/</a><br></blockquote></div><br></div>