You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When developing a RESTful server using Express.js, Fastify.js, etc. in a Node environment, it uses json-schema to validate API request inputs. If you're using json-schema to validate request inputs, integrating multiple schemas can be more manageable as the number of APIs grows.
It's useful to have a structured schema like this.
Problem
I'm looking for an way to configure a schema registry per API in one json-schema store. For example, I'm looking for a way to access the contents inside definitions in two schema stores, https://json.schemastore.org/eslintrc.json and https://json.schemastore.org/partial-eslint-plugins.json.
Hi @imjuni, after digging into the error messages when trying to load the refs (or actually I tested using ajv.getSchema as it was simpler) I found that the original schemas were not loading correctly because of missing formats that are being used in those schemas.
I fixed this by adding ajv-formats to the example.
import Ajv from 'ajv';
import addFormats from "ajv-formats";
const ajv = new Ajv();
addFormats(ajv);
From here you can see which of your ref syntax works properly.
Motivation
When developing a RESTful server using Express.js, Fastify.js, etc. in a Node environment, it uses json-schema to validate API request inputs. If you're using json-schema to validate request inputs, integrating multiple schemas can be more manageable as the number of APIs grows.
The example above is in typescript, but it can also be expressed in json-schema.
It's useful to have a structured schema like this.
Problem
I'm looking for an way to configure a schema registry per API in one json-schema store. For example, I'm looking for a way to access the contents inside
definitions
in two schema stores,https://json.schemastore.org/eslintrc.json
andhttps://json.schemastore.org/partial-eslint-plugins.json
.Expectation
How do I access the above
eslintrc.json/definitions
?Environments
The text was updated successfully, but these errors were encountered: