Comments (8)
@WaleedAshraf Ouch. Ok got it! Thanks man.
from asyncapi-validator.
@trsh Your message in the "subscribe" operation doesn't have msgIdentifier
. Add it at line 34 in the above code ^.
from asyncapi-validator.
@WaleedAshraf I am not validating "subscribe", only "publish"
va.validate(this.key, value, '/', 'publish');
and it was working before I added "oneOf": [ ...
from asyncapi-validator.
All messages should have specified msgIdentifier
present. @trsh
Also, I have tested, you'll get the same error if you remove "oneOf" without adding msgIdentifier
from asyncapi-validator.
Ok. Right. So I added:
"x-CreatedRoomResponse-key": "CreatedRoomReponse",
for subscribe
part. And now when I run validation it shows same error: "msgIdentifier \"x-CreateRoomPayload-key\" does not exist"
. I should be able to add different key
values for different messages? To validate different messages, no? @WaleedAshraf
from asyncapi-validator.
Can you share your updated schema? @trsh
from asyncapi-validator.
@WaleedAshraf https://pastebin.com/ce4fV8PQ
from asyncapi-validator.
@trsh The msgIdentifier
Key should be same in all messages. The Value can be different and should be unique.
for example,
subscribe:
message:
x-identifier-key: "CreatedRoomReponse"
publish:
message:
x-identifier-key: "CreateRoomPayload"
const AsyncApiValidator = require('asyncapi-validator')
let va = await AsyncApiValidator.fromSource('schema.yaml', {msgIdentifier: 'x-identifier-key'})
va.validate('CreateRoomPayload', value, '/', 'publish');
from asyncapi-validator.
Related Issues (20)
- Parser expects there to be a components/messages property in the main schema HOT 3
- unknown format "int32" is used in schema HOT 6
- 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
- [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.