Open
Description
I'm having an issue trying to validate the schema for DataStream found here. I'm not sure if the issue is in the schema, or if its in the package, but it seems to be failing at validating. (I'm also struggling a little with the outputs from the functions, so forgive me if there is a better way of compiling the outputs)
Data setup
dt <- tibble::tribble(
~DatasetName, ~MonitoringLocationID, ~MonitoringLocationName, ~MonitoringLocationLatitude, ~MonitoringLocationLongitude, ~MonitoringLocationHorizontalCoordinateReferenceSystem, ~MonitoringLocationHorizontalAccuracyMeasure, ~MonitoringLocationHorizontalAccuracyUnit, ~MonitoringLocationVerticalMeasure, ~MonitoringLocationVerticalUnit, ~MonitoringLocationType, ~ActivityType, ~ActivityMediaName, ~ActivityStartDate, ~ActivityStartTime, ~ActivityEndDate, ~ActivityEndTime, ~ActivityDepthHeightMeasure, ~ActivityDepthHeightUnit, ~SampleCollectionEquipmentName, ~CharacteristicName, ~MethodSpeciation, ~ResultSampleFraction, ~ResultValue, ~ResultUnit, ~ResultValueType, ~ResultDetectionCondition, ~ResultDetectionQuantitationLimitMeasure, ~ResultDetectionQuantitationLimitUnit, ~ResultDetectionQuantitationLimitType, ~ResultStatusID, ~ResultComment, ~ResultAnalyticalMethodID, ~ResultAnalyticalMethodContext, ~ResultAnalyticalMethodName, ~AnalysisStartDate, ~AnalysisStartTime, ~AnalysisStartTimeZone, ~LaboratoryName, ~LaboratorySampleID,
"test", "test-314", "test-314", 43.5895361, -79.9411775, "NAD83", NA, NA, NA, NA, "River/Stream", "Field Msr/Obs", "Surface Water", "2005-07-12", NA, NA, NA, NA, NA, "Probe/Sensor", "Temperature, water", NA, NA, 18, "deg C", "Actual", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA
)
Validate using jsonvalidate::json_schema$new()$serialise
as an input:
dt_json <- jsonlite::toJSON(as.list(dt),digits = 999)
path <- tempfile()
dl <- download.file("https://datastream.org/schema", path,method="curl", quiet =T)
sc <- suppressWarnings(jsonvalidate::json_schema$new(path,strict = T))
json <- sc$serialise(dt_json)
out <- sc$validate(json,verbose=T)
ab <- attr(out,"error")
cbind(ab$schemaPath,ab$keyword,ab$params,ab$message)
and when I validate using jsonvalidate::json_validate()
with serialized input
jsonvalidate::json_validate(json, path,verbose = T, strict = T)
and when I validate without serializing:
out <- sc$validate(dt_json,verbose=T)
ab <- attr(out,"error")
bind_cols(ab$schemaPath,ab$keyword,ab$message)
jsonvalidate::json_validate(dt_json, path,verbose = T, strict = T)
I appreciate any assistance you can provide.
Metadata
Metadata
Assignees
Labels
No labels