-
Notifications
You must be signed in to change notification settings - Fork 635
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lexicon schema for lexicon schema records (meta) (#3286)
* lexicon schema for lexicon schema records (meta) * defs are object/unknown, not array * simplify just to 'lexicon' field * codegen lexicon schema
- Loading branch information
Showing
13 changed files
with
330 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.lexicon.schema", | ||
"defs": { | ||
"main": { | ||
"type": "record", | ||
"description": "Representation of Lexicon schemas themselves, when published as atproto records. Note that the schema language is not defined in Lexicon; this meta schema currently only includes a single version field ('lexicon'). See the atproto specifications for description of the other expected top-level fields ('id', 'defs', etc).", | ||
"key": "nsid", | ||
"record": { | ||
"type": "object", | ||
"required": ["lexicon"], | ||
"properties": { | ||
"lexicon": { | ||
"type": "integer", | ||
"description": "Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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
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
26 changes: 26 additions & 0 deletions
26
packages/api/src/client/types/com/atproto/lexicon/schema.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* GENERATED CODE - DO NOT MODIFY | ||
*/ | ||
import { ValidationResult, BlobRef } from '@atproto/lexicon' | ||
import { isObj, hasProp } from '../../../../util' | ||
import { lexicons } from '../../../../lexicons' | ||
import { CID } from 'multiformats/cid' | ||
|
||
export interface Record { | ||
/** Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system. */ | ||
lexicon: number | ||
[k: string]: unknown | ||
} | ||
|
||
export function isRecord(v: unknown): v is Record { | ||
return ( | ||
isObj(v) && | ||
hasProp(v, '$type') && | ||
(v.$type === 'com.atproto.lexicon.schema#main' || | ||
v.$type === 'com.atproto.lexicon.schema') | ||
) | ||
} | ||
|
||
export function validateRecord(v: unknown): ValidationResult { | ||
return lexicons.validate('com.atproto.lexicon.schema#main', v) | ||
} |
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
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
26 changes: 26 additions & 0 deletions
26
packages/bsky/src/lexicon/types/com/atproto/lexicon/schema.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* GENERATED CODE - DO NOT MODIFY | ||
*/ | ||
import { ValidationResult, BlobRef } from '@atproto/lexicon' | ||
import { lexicons } from '../../../../lexicons' | ||
import { isObj, hasProp } from '../../../../util' | ||
import { CID } from 'multiformats/cid' | ||
|
||
export interface Record { | ||
/** Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system. */ | ||
lexicon: number | ||
[k: string]: unknown | ||
} | ||
|
||
export function isRecord(v: unknown): v is Record { | ||
return ( | ||
isObj(v) && | ||
hasProp(v, '$type') && | ||
(v.$type === 'com.atproto.lexicon.schema#main' || | ||
v.$type === 'com.atproto.lexicon.schema') | ||
) | ||
} | ||
|
||
export function validateRecord(v: unknown): ValidationResult { | ||
return lexicons.validate('com.atproto.lexicon.schema#main', v) | ||
} |
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
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
26 changes: 26 additions & 0 deletions
26
packages/ozone/src/lexicon/types/com/atproto/lexicon/schema.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* GENERATED CODE - DO NOT MODIFY | ||
*/ | ||
import { ValidationResult, BlobRef } from '@atproto/lexicon' | ||
import { lexicons } from '../../../../lexicons' | ||
import { isObj, hasProp } from '../../../../util' | ||
import { CID } from 'multiformats/cid' | ||
|
||
export interface Record { | ||
/** Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system. */ | ||
lexicon: number | ||
[k: string]: unknown | ||
} | ||
|
||
export function isRecord(v: unknown): v is Record { | ||
return ( | ||
isObj(v) && | ||
hasProp(v, '$type') && | ||
(v.$type === 'com.atproto.lexicon.schema#main' || | ||
v.$type === 'com.atproto.lexicon.schema') | ||
) | ||
} | ||
|
||
export function validateRecord(v: unknown): ValidationResult { | ||
return lexicons.validate('com.atproto.lexicon.schema#main', v) | ||
} |
Oops, something went wrong.