ajv-validator / ajv-validator/ajv

User defined formats with standalone validation code

Aperta
#1,470 17 commenti 0 reazioni 0 assegnatari Vedi su GitHub
docs enhancement limitation
Lingua principale
TypeScript
Stelle
14.8k
Fork
1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**The error we're seeing is:**

`Error: CodeGen: "code" for formats0 not defined`

Oddly this error does not occur if we use Ajv in our app, it only occurs if we try to make a standalone validator script.

**What version of Ajv are you using? Does the issue happen if you use the latest version?** 7.1.1 (latest)

**Ajv options object**

```javascript
const ajv = new Ajv({
code: {
source: true, // this option is required to generate standalone code
},
removeAdditional: true,
});
```

**JSON Schema**

```js
const demoSchema = {
$id: 'demoSchema',
additionalProperties: false,
properties: {
test: hexCodeValidator,
},
};
```

**Sample data**

N/A - bug occurs during compilation of standalone Ajv.

**Your code**

### [Repro](https://runkit.com/slapbox/603ad69eba5c45001c1d550f)

**Are you going to resolve the issue?**

I cannot resolve the issue.

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.