https://schemas.wur.nl/betula/core/identifier/0.6.0/schema.json
A short, stable identifier/label string: a sequence identifier, a GFF3 feature ID, a BLAST accession, etc.
string (minLength 1)
Valid examples¶
simple.json
"seq1"
Invalid examples¶
empty.json
""
Schema source
identifier.schema.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.wur.nl/betula/core/identifier/0.6.0/schema.json",
"title": "Identifier",
"description": "A short, stable identifier/label string: a sequence identifier, a GFF3 feature ID, a BLAST accession, etc.",
"type": "string",
"minLength": 1
}
Usage¶
Read a JSON document and parse it as a Identifier. CI runs this exact code against the first valid example above; see Getting started to install the bindings.
Python
TypeScript
Rust
identifier.py
from betula_schema import Identifier, parse_json
with open("identifier.json") as f:
identifier = parse_json(Identifier, f.read())
# Identifier is a RootModel; identifier.root is the plain value
print(identifier)
identifier.ts
import { readFileSync } from "node:fs";
import { parseJson, type Identifier } from "betula-schema";
const identifier: Identifier = parseJson("Identifier", readFileSync("identifier.json", "utf8"));
console.log(identifier);
identifier.rs
fn main() -> Result<(), Box<dyn std::error::Error>> {
let text = std::fs::read_to_string("identifier.json")?;
let identifier: betula_schema::Identifier = betula_schema::parse_str(&text)?;
// Identifier is a newtype; deref it (&*identifier) for the inner value
println!("{identifier:?}");
Ok(())
}