Skip to contents

Write a schema list produced by S7_to_JSONSchema to a JSON file

Usage

write_JSONSchema(schema, file, overwrite = FALSE, verbosity = 1L)

Arguments

schema

Named list: Schema produced by S7_to_JSONSchema.

file

Character: Path to output JSON file.

overwrite

Logical: If TRUE, overwrite an existing file.

verbosity

Integer: Verbosity level.

Value

schema, invisibly.

Author

EDG

Examples

schema <- list(
  `$schema` = "https://json-schema.org/draft/2020-12/schema",
  `$id` = "https://example.org/demo/v1/schema.json",
  title = "Demo",
  type = "object",
  properties = list(n = list(type = "integer", minimum = 1L))
)
tmpfile <- file.path(tempdir(), "demo.schema.json")
write_JSONSchema(schema, tmpfile, overwrite = TRUE, verbosity = 0L)