Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate catalogs from interactive rescore branch #132

Merged
merged 4 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/core/src/resolveMaxItemsFrom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,16 @@ export const ajvKeyword: KeywordDefinition = {
cxt.ok(true)
}
}

/**
* Keyword that can be added to ajv instance with addKeyword()
* to make it aware of `maxPropertiesFrom` keyword in JSON schemas.
*/
export const ajvKeyword2: KeywordDefinition = {
keyword: 'maxPropertiesFrom',
type: 'object',
code (cxt: KeywordCxt) {
// Unable to validate because needs data from outside, so always OK
cxt.ok(true)
}
}
3 changes: 2 additions & 1 deletion packages/core/src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
ICatalog,
IFiles
} from './types'
import { ajvKeyword, resolveMaxItemsFrom } from './resolveMaxItemsFrom'
import { ajvKeyword, ajvKeyword2, resolveMaxItemsFrom } from './resolveMaxItemsFrom'
import { addMoleculeValidation, parseMolecules } from './molecule/addMoleculeValidation'

const ajv = new Ajv({
Expand All @@ -25,6 +25,7 @@ const ajv = new Ajv({
addFormats(ajv)
addMoleculeFormats(ajv)
ajv.addKeyword(ajvKeyword)
ajv.addKeyword(ajvKeyword2)

export interface IvresseErrorObject
extends ErrorObject<string, Record<string, any>, unknown> {
Expand Down
Loading
Loading