possum/nsid
Namespaced Identifiers (NSIDs) are used to reference Lexicon schemas for
records, XRPC endpoints, and more. For example, com.atproto.sync.getRecord.
The basic structure and semantics of an NSID are a fully-qualified hostname in reverse domain-name order, followed by an additional name segment. The hostname part is the domain authority, and the final segment is the name.
Lexicon
Lexicon is a schema language. It’s used in the Atmosphere to describe data records and HTTP APIs. Functionally it’s very similar to JSON-Schema and OpenAPI. Lexicon’s sole purpose is to help developers build compatible software.
Documentation: Namespaced Identifiers
Types
pub type ParseError {
InvalidRegexPattern(pattern: String)
InvalidSyntax(value: String)
}
Constructors
-
InvalidRegexPattern(pattern: String)Regex failed to compile
-
InvalidSyntax(value: String)String does not have a valid NSID format
Values
pub fn parse(content: String) -> Result(Nsid, ParseError)
Parse a string into a valid Nsid type
If the value is not a valid string then an error is returned.
Examples
import possum/nsid
let string = "com.atproto.sync.getRecord."
let assert Ok(nsid) = nsid.parse(string)
See also: Nsid