Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.8%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
R package to validate JSON with schemas
Basic Info
- Host: GitHub
- Owner: mpadge
- License: mit
- Language: C++
- Default Branch: main
- Size: 238 KB
Statistics
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
- Releases: 0
Created over 3 years ago
· Last pushed over 2 years ago
Metadata Files
Readme
License
Codemeta
README.Rmd
---
title: "jsonschema"
output:
md_document:
variant: gfm
rmarkdown::html_vignette:
self_contained: no
---
# jsonschema
[](https://github.com/mpadge/jsonschema/actions?query=workflow%3AR-CMD-check)
[](https://codecov.io/gh/mpadge/jsonschema)
[](https://www.repostatus.org/#wip)
The `jsonschema` R package validates 'JSON' (JavaScript Object Notation) files
against a specified [JSON schema](https://json-schema.org/). Most functionality
comes directly from [Patrick Boettcher's 'json-schema-validator' C++
library](https://github.com/pboettch/json-schema-validator/),
along with [Neils Lohmann's 'Modern JSON for C++'
library](https://github.com/nlohmann/json). Both of these libraries are
included here.
The 'json-schema-validator' library, and hence this package, validates against
[JSON Schema Draft
7](https://json-schema.org/specification-links.html#draft-7).
## Example
This example is modified from [the `pboettch/json-schema-validator/`
README](https://github.com/pboettch/json-schema-validator/). The schema
illustrates the general structure of JSON schemas:
```{r}
schema <- '{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "A person",
"properties": {
"id": {
"description": "Unique identifier",
"type": "integer"
},
"date": {
"type": "string",
"format": "date"
},
"name": {
"description": "Name",
"type": "string"
},
"age": {
"description": "Age of the person",
"type": "number",
"minimum": 2,
"maximum": 200
}
},
"required": [
"id",
"date",
"name",
"age"
],
"type": "object"
}'
```
That repository then provides the following examples of JSON input to validate
against that schema:
```{r}
person_bad <- '{
"id": "nope",
"date": "2022-02",
"age": 42
}'
person_good <- '{
"id": 1,
"date": "2022-02-02",
"name": "Albert",
"age": 42
}'
```
This package works exclusively with locally-stored files. The following lines
save those three items to local files.
```{r}
writeLines (schema, "schema.json")
writeLines (person_bad, "person_bad.json")
writeLines (person_good, "person_good.json")
```
The JSON files can then be validated by loading the package and running its
single function:
```{r}
library (jsonschema)
jsonschema_validate ("schema.json", "person_good.json") # no output
jsonschema_validate ("schema.json", "person_bad.json")
```
The results can be captured in a `data.frame` object like this:
```{r}
x <- jsonschema_validate ("schema.json", "person_bad.json", quiet = TRUE)
print (x)
```
## Prior Art
The ['jsonvalidate' package](https://docs.ropensci.org/jsonvalidate/) also
validates JSON files against schemas, through wrapping two JavaScript
libraries.
## Code of Conduct
Please note that this package is released with a [Contributor Code of
Conduct](https://ropensci.org/code-of-conduct/). By contributing to this
project, you agree to abide by its terms.
Owner
- Name: mark padgham
- Login: mpadge
- Kind: user
- Location: Münster, Germany
- Company: @rOpenSci
- Website: https://mpadge.github.io
- Repositories: 194
- Profile: https://github.com/mpadge
rOpenSci software review lead
CodeMeta (codemeta.json)
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"identifier": "jsonschema",
"description": "Use a 'JSON' schema to validate a local 'JSON' file.",
"name": "jsonschema: Use a 'JSON' schema to validate a local 'JSON' file",
"license": "https://spdx.org/licenses/MIT",
"version": "0.0.1.038",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.2.2 (2022-10-31)",
"author": [
{
"@type": "Person",
"givenName": "Mark",
"familyName": "Padgham",
"email": "mark.padgham@email.com",
"@id": "https://orcid.org/0000-0003-2172-5265"
}
],
"copyrightHolder": [
{
"@type": "Person",
"givenName": "Patrick",
"familyName": "Boettcher"
},
{
"@type": "Person",
"givenName": "Niels",
"familyName": "Lohmann"
}
],
"maintainer": [
{
"@type": "Person",
"givenName": "Mark",
"familyName": "Padgham",
"email": "mark.padgham@email.com",
"@id": "https://orcid.org/0000-0003-2172-5265"
}
],
"softwareSuggestions": [
{
"@type": "SoftwareApplication",
"identifier": "testthat",
"name": "testthat",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=testthat"
}
],
"softwareRequirements": {
"1": {
"@type": "SoftwareApplication",
"identifier": "Rcpp",
"name": "Rcpp",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=Rcpp"
},
"SystemRequirements": {}
},
"fileSize": "21733.031KB",
"codeRepository": "https://github.com/mpadge/jsonschema",
"contIntegration": [
"https://github.com/mpadge/jsonschema/actions?query=workflow%3AR-CMD-check",
"https://codecov.io/gh/mpadge/jsonschema"
],
"developmentStatus": "https://www.repostatus.org/#wip"
}
GitHub Events
Total
Last Year
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 1
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 1
- Total pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- mpadge (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Dependencies
.github/workflows/check-extra-os.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/check-standard.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v3 composite
- actions/upload-artifact v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.hooks/description
cran
DESCRIPTION
cran
- Rcpp * imports
- jsonlite * imports
- fs * suggests
- testthat * suggests