Created
May 6, 2023 07:56
-
-
Save rogpeppe/a787476feb4ab5db35b63a2395bd21ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// derived from the doc in https://atproto.com/specs/lexicon | |
package lexicon | |
#LexiconDoc: { | |
lexicon!: 1 | |
id!: string | |
revision?: number | |
description?: string | |
defs!: [string]: #LexUserType | | |
#LexPrimitive | | |
#LexArray | | |
#LexUnion | | |
[...#LexRef] | |
} | |
#Common: { | |
type!: string | |
description?: string | |
} | |
#LexRef: string | { | |
type!: "ref" | |
ref: =~ ".*#" | |
} | |
#LexUnion: { | |
type!: "union" | |
refs: [... #LexRef] | |
} | |
#LexUserType: #LexXrpcQuery | | |
#LexXrpcProcedure | | |
#LexRecord | | |
#LexToken | | |
#LexObject | | |
#LexBlob | | |
#LexImage | | |
#LexVideo | | |
#LexAudio | |
#LexToken: { | |
#Common | |
type!: "token" | |
} | |
#LexObject: { | |
#Common | |
type!: "object" | |
required?: [... string] | |
properties!: [string]: #LexRef | | |
#LexArray | | |
#LexPrimitive | | |
#LexUnion | | |
[... #LexRef] | |
} | |
// database | |
// = | |
#LexRecord: { | |
#Common | |
type!: "record" | |
key?: string | |
record!: #LexObject | |
} | |
// XRPC | |
// = | |
#LexXrpcQuery: { | |
#Common | |
type!: "query" | |
parameters?: [string]: #LexPrimitive | |
output?: #LexXrpcBody | |
errors?: [... #LexXrpcError] | |
} | |
#LexXrpcProcedure: { | |
#Common | |
type!: "procedure" | |
parameters?: [string]: #LexPrimitive | |
input?: #LexXrpcBody | |
output?: #LexXrpcBody | |
errors?: [... #LexXrpcError] | |
} | |
#LexXrpcBody: { | |
description?: string | |
encoding!: string | [... string] | |
schema!: #LexObject | |
} | |
#LexXrpcError: { | |
name!: string | |
description?: string | |
} | |
// blobs | |
// = | |
#LexBlob: { | |
#Common | |
type!: "blob" | |
accept?: [... string] | |
maxSize?: number | |
} | |
#LexImage: { | |
#Common | |
type!: "image" | |
accept?: [... string] | |
maxSize?: number | |
maxWidth?: number | |
maxHeight?: number | |
} | |
#LexVideo: { | |
#Common | |
type!: "video" | |
accept?: [... string] | |
maxSize?: number | |
maxWidth?: number | |
maxHeight?: number | |
maxLength?: number | |
} | |
#LexAudio: { | |
#Common | |
type!: "audio" | |
accept?: [... string] | |
maxSize?: number | |
maxLength?: number | |
} | |
// primitives | |
// = | |
#LexArray: { | |
#Common | |
type!: "array" | |
items: #LexRef | #LexPrimitive | [... #LexRef] | |
minLength?: number | |
maxLength?: number | |
} | |
#LexPrimitive: #LexBoolean | #LexNumber | #LexInteger | #LexString | #LexUnknown | |
#LexBoolean: { | |
#Common | |
type!: "bool" | |
default?: bool | |
const?: bool | |
} | |
#LexNumber: { | |
#Common | |
type!: "number" | |
default?: number | |
minimum?: number | |
maximum?: number | |
enum?: [... number] | |
const?: number | |
} | |
#LexInteger: { | |
#Common | |
type!: "integer" | |
default?: number | |
minimum?: number | |
maximum?: number | |
enum?: [... number] | |
const?: number | |
} | |
#LexString: { | |
#Common | |
type!: "string" | |
format?: string // TODO rog | |
default?: string | |
minLength?: number | |
maxLength?: number | |
enum?: [... string] | |
const?: string | |
knownValues?: [... string] | |
} | |
#LexUnknown: type!: "unknown" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment