ajv-validator / ajv-validator/ajv

Schema Mapping Validation Between JSON Schemas

Aperta
#2,338 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
TypeScript
Stelle
14.8k
Fork
1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## What version of Ajv are you using?
8.11.2

## What problem do you want to solve?
I need to validate one JSON schema against another to ensure they map onto each other based on their description. I'll be using one schema for output of a process and another for input into another process in my system, which would necessitate a validation check to ensure they align correctly.

_Note: I considered the idea of doing it dynamically (i.e. checking against the actual output of the process, instead of the schemas). However, I need to detect a possible mismatch before any processing happens._

## What do you think is the correct solution to the problem?
Implementing a Schema Mapping Validation feature between JSON schemas could do it. For instance:
1. A `string` schema `A` maps onto a `string` schema `B` if it meets the length and pattern requirements of `B`.
2. An `object` schema `A` fits onto `object` schema `B` if it encompasses at least the same `required` properties as `B`.
3. A `null` schema `A` maps onto any schema `B` if `B` also includes `null` as an allowable type.

## Will you be able to implement it?
I might be able to implement it, although I am unsure about the complexity within the library's framework. However, I am certainly willing to give it a shot!

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.