Comments (6)
@jkuehnemundt @oBJIADo I'm working on PR to fix these issues. These will be addressed in the coming major version.
from asyncapi-validator.
Hi, @jkuehnemundt . I'll take a look at this.
Meanwhile, can you provide more details?
What exact error are you getting?
What version of the asyncapi-validator are you using?
What version of AsyncAPI are you using?
from asyncapi-validator.
@jkuehnemundt I'd suggest that for now you use minimum
and maximum
fields. That's how AsyncAPI adds supports for int32
and other openapi formats. See here: https://github.com/openapi-contrib/openapi-schema-to-json-schema/blob/master/lib/converters/schema.js#L182
from asyncapi-validator.
Hi @WaleedAshraf.
I had the same problem, but for int64. And I can provide a little more information about the error.
-
Version of the asyncapi-validator: 2.5.0
-
The error I had:
(node:24384) UnhandledPromiseRejectionWarning: Error: unknown format "int64" is used in schema at path "#/properties/phone"
at Object.generate_format [as code] (/node_modules/ajv/lib/dotjs/format.js:69:15)
at Object.generate_validate [as validate] (/node_modules/ajv/lib/dotjs/validate.js:374:35)
at Object.generate_properties [as code] (/node_modules/ajv/lib/dotjs/properties.js:201:26)
at generate_validate (/node_modules/ajv/lib/dotjs/validate.js:374:35)
at localCompile (/node_modules/ajv/lib/compile/index.js:88:22)
at Ajv.compile (/node_modules/ajv/lib/compile/index.js:55:13)
at Ajv._compile (/node_modules/ajv/lib/ajv.js:348:27)
at Ajv.compile (/node_modules/ajv/lib/ajv.js:114:37)
at MessageValidator.validate (/node_modules/asyncapi-validator/src/MessageValidator.js:58:33)
at /asyncApiValidation.js:5:15
- Api from your example with the new one field:
asyncapi: 2.0.0
info:
title: User Events
version: 1.0.0
channels:
user-events:
description: user related events
publish:
message:
name: UserDeletedMessage
x-custom-key: UserDeleted
payload:
type: object
properties:
userEmail:
type: string
userId:
type: string
phone:
type: integer
format: int64
description: User phone
- The code I use:
const AsyncApiValidator = require('asyncapi-validator')
// validate 'UserDeleted' on channel 'user-events' with operation 'publish'
AsyncApiValidator.fromSource('./api.yml', {msgIdentifier: 'x-custom-key'}).then(validator => {
validator.validate('UserDeleted', {
userId: '123456789',
userEmail: '[email protected]',
phone: 123456789
}, 'user-events', 'publish')
});
from asyncapi-validator.
Can you test against this branch and see if it address your concern.
https://github.com/WaleedAshraf/asyncapi-validator/tree/v3
from asyncapi-validator.
Fixed in v3: https://github.com/WaleedAshraf/asyncapi-validator/releases/tag/v3.0.0
from asyncapi-validator.
Related Issues (20)
- Parser expects there to be a components/messages property in the main schema HOT 3
- Feature: Support for operationId HOT 3
- custom validation: how to call validate() HOT 5
- What's the preferred way to handle invalid messages? HOT 2
- Question - CLI wrapper HOT 3
- Package asyncapi is deprecated HOT 1
- JSON references to external files are not resolved correctly HOT 1
- How to use validate() with channel with parameter? HOT 4
- Expose TypeScript types HOT 1
- Bug: Validation fails with exclusiveMinimum / exclusiveMaximum in schema HOT 1
- Can find msgIdentifier for fallowing schema HOT 8
- [QA] how to get property from Error object? HOT 7
- Feature: Use ajv-formats to validate data formats
- Invalid message gets marked valid? HOT 3
- Question: Circular References in the scheme HOT 5
- How to determine message from topic, with variables? HOT 1
- Does not support avro in AsynApi HOT 1
- Question: How to validate messages with Headers HOT 1
- Does not support version 3.0.0 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asyncapi-validator.