001  (ns dog-and-duck.quack.picky.control-variables
                
                002    "Control variables for the picky validator.")
                
                003  
                
                004  ;;;     Copyright (C) Simon Brooke, 2022
                
                005  
                
                006  ;;;     This program is free software; you can redistribute it and/or
                
                007  ;;;     modify it under the terms of the GNU General Public License
                
                008  ;;;     as published by the Free Software Foundation; either version 2
                
                009  ;;;     of the License, or (at your option) any later version.
                
                010  
                
                011  ;;;     This program is distributed in the hope that it will be useful,
                
                012  ;;;     but WITHOUT ANY WARRANTY; without even the implied warranty of
                
                013  ;;;     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                
                014  ;;;     GNU General Public License for more details.
                
                015  
                
                016  ;;;     You should have received a copy of the GNU General Public License
                
                017  ;;;     along with this program; if not, write to the Free Software
                
                018  ;;;     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
                
                019  
                
                020  (def ^:dynamic *reify-refs*
                
                021    "If `true`, references to objects in fields will be reified and validated. 
                
                022     If `false`, they won't, but an `:info` level fault report will be generated.
                
                023     
                
                024     There are several things in the spec which, in a document, may correctly be
                
                025     either
                
                026     
                
                027     1. a fully fleshed out object, or
                
                028     2. a URI pointing to such an object.
                
                029     
                
                030     Obviously to fully validate a document we ought to reify all the refs and 
                
                031     check that they are themselves valid, but
                
                032     
                
                033     a. in some of the published test documents the URIs do not reference a
                
                034        valid document;
                
                035     b. there will be performance costs to reifying all the refs;
                
                036     c. in perverse cases, reifying refs might result in runaway recursion.
                
                037     
                
                038     TODO: I think that in production this should default to `true`."
                
                039    false)
                
                040  
                
                041  (def ^:dynamic *reject-severity*
                
                042    "The severity at which the binary validator will return `false`.
                
                043     
                
                044     In practice documents seen in the wild do not typically appear to be 
                
                045     fully valid, and this does not matter. This allows the sensitivity of
                
                046     the binary validator (`dog-and-duck.quack.quack`) to be tuned. It's in
                
                047     this (`dog-and-duck.quack.picky`) namespace, not that one, because this
                
                048     namespace is where concerns about severity are handled."
                
                049    :must)