[OPEN-ILS-DEV] Different OSRF response format from different servers?

Ken Cox kenstir at gmail.com
Thu Jan 26 08:00:15 EST 2017


Thank you, that helps.  I implemented a generic string-or-int-to-integer
method, and will be on the lookout for other places where it might be
needed.  I guess it goes without saying that it feels a bit awkward to be
dealing with Perl vagaries when consuming the API from a different
language.  (I'm looking at you, open-ils.pcrud.retrieve.mra, and your
devilish perlishness)

Ken

On Wed, Jan 25, 2017 at 12:21 PM, Mike Rylander <mrylander at gmail.com> wrote:

> Ken,
>
> Any time a variable is used as a string (or a number), perl starts
> treating it that way for stringification purposes.  As the code
> changes version to version, and even as different code paths are taken
> within one version depending on settings, perl may change the variable
> type.  Like Bill says, if you expect a number it's best to just use,
> say, parseInt() from JS or it's equiv.
>
> HTH,
>
> --
> Mike Rylander
>  | President
>  | Equinox Software, Inc. / Open Your Library
>  | phone:  1-877-OPEN-ILS (673-6457)
>  | email:  miker at esilibrary.com
>  | web:  http://www.esilibrary.com
>
>
> On Wed, Jan 25, 2017 at 10:38 AM, Bill Erickson <berickxx at gmail.com>
> wrote:
> > Hi Ken,
> >
> > I can't say why they vary in this specific case, but it's not uncommon
> for
> > numbers to be packaged as JSON strings throughout Evergreen / OpenSRF.
> > Generally, Perl and JavaScript don't care and the OpenSRF JSON C library
> is
> > well-equipped to handle it.  It's probably best to assume that any number
> > might be delivered as a JSON number or a JSON string.
> >
> > -b
> >
> >
> >
> >
> > On Tue, Jan 24, 2017 at 5:03 PM, Ken Cox <kenstir at gmail.com> wrote:
> >>
> >> I have a bug report that searching the Missouri Evergreen catalog
> crashes
> >> the Android Hemlock App.  I tracked it down to different results from
> the
> >> open-ils.search.biblio.multiclass.query .  The server at
> >> issourievergreen.org returns an "ids" list containing integers, and the
> >> other servers I tried return an "ids" list containing strings.
> >>
> >> Is this expected?  Handling this one mismatch is straightforward, but
> I'm
> >> wondering how many similar issues lurk behind this one.
> >>
> >> Sample search queries and excerpted results for "pride and prejudice":
> >>
> >> missourievergreen, version 2-11-0
> >>
> >>
> >> https://missourievergreen.org/osrf-gateway-v1?service=open-
> ils.search&method=open-ils.search.biblio.multiclass.
> query&param=%7B%22org_unit%22:1,%22default_class%22:%
> 22keyword%22,%22offset%22:0,%22limit%22:2,%22depth%22:0%7D&
> param=%22pride%20and%20prejudice%22&param=1
> >> ...
> >> "ids":[[32673,null,"0.0"],[886843,null,"0.0"]]
> >>
> >> gapines, version 2-11-1
> >>
> >>
> >> https://gapines.org/osrf-gateway-v1?service=open-ils.
> search&method=open-ils.search.biblio.multiclass.query&param=
> %7B%22org_unit%22:1,%22default_class%22:%22keyword%
> 22,%22offset%22:0,%22limit%22:2,%22depth%22:0%7D&param=%
> 22pride%20and%20prejudice%22&param=1
> >> ...
> >> "ids":[["503610",null,"0.0"],["502717",null,"0.0"]]
> >>
> >> cwmars, version 2-10-7
> >>
> >>
> >> http://bark.cwmars.org/osrf-gateway-v1?service=open-ils.
> search&method=open-ils.search.biblio.multiclass.query&param=
> %7B%22org_unit%22:1,%22default_class%22:%22keyword%
> 22,%22offset%22:0,%22limit%22:2,%22depth%22:0%7D&param=%
> 22pride%20and%20prejudice%22&param=1
> >> ...
> >> "ids":[["1805532"],["2385399"]]
> >>
> >>
> >>
> >> --
> >> -Ken
> >
> >
>



-- 
-Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libmail.georgialibraries.org/pipermail/open-ils-dev/attachments/20170126/eeae7215/attachment-0001.html>


More information about the Open-ils-dev mailing list