Schema isn't being recognised
See original GitHub issueI’m trying to create a plugin and so far it’s working great apart from the schema part.
I have the following manifest.js
file:
module.exports = {
version: '1.0.0',
init: function (pluginContext) {
pluginContext.registerPolicy(require('./policies/blacklist.js'))
}
}
And the following policies/blacklist.js
file:
module.exports = {
name: 'blacklist',
schema: {
$id: 'http://express-gateway.io/schemas/policy/blacklist.json',
type: 'object',
required: ['urls'],
properties: {
urls: {
type: 'array',
items: {
properties: {
method: {
type: 'string'
},
path: {
type: ['string', 'null']
}
}
}
}
}
},
policy: (actionParams) => {
...
The policy works as expected but it’s not validating the schema.
I get the following output from my console:
[EG:config] info: Registered schema for users model.
[EG:config] info: Registered schema for credentials model.
[EG:config] info: Registered schema for applications model.
[EG:config] debug: ConfigPath:
[EG:config] debug: ConfigPath:
[EG:plugins] debug: Loading plugins. Plugin engine version:
[EG:plugins] debug: Loading plugin
[EG:gateway] warn: express-gateway-plugin-bts-blacklist plugin hasn't provided a schema. Validation for this plugin will be skipped.
[EG:plugins] info: Loaded plugin
[EG:gateway] debug: registering policy
Note the specific part:
[EG:gateway] warn: express-gateway-plugin-bts-blacklist plugin hasn't provided a schema. Validation for this plugin will be skipped.
I am confused as I have specified the schema. It’s just ignoring it.
I’m using Express Gateway 1.10.1.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
8 reasons why your structured data is not showing in search
The schema should describe original content that your organization created. Must not cover inappropriate subjects like sexual violence or hate ...
Read more >'.schema' is not recognized as an internal or external ...
I got as far as creating and syncing a DB, but when I type .schema into my command prompt, I get: '.schema' is...
Read more >schema has not been registered for model error showing
it start to show error schema has not been registered. code of my model / Blog.js const mongoose = require('mongoose'); const Schema ......
Read more >kubernetes_manifest resource warns OpenAPI schema not ...
kubernetes_manifest resource warns OpenAPI schema not recognised ... No warning - and for the OpenApi schema defined in CRD to be recognised ......
Read more >How Do I Know If My Schema Markup Is Working?
First, the tool often caches versions of your page. This means that if you are actively making changes to your markup, the latest...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @markwylde
this is not an Express Gateway issue. By default, the JSON Schema are permissive — which means that foreign properties are allowed.
You can fix this in two ways:
method
element required, so if you spell it incorrectly, you get an error:additionalProperties
tofalse
, so that provided objects MUST have only the declared properties:Note: the second one, if I recall correctlu is an
ajv
specific feature.This is fine, it happens to everybody. In case you need any further help you can jump in our Gitter Channel too.