Giter Site home page Giter Site logo

Comments (8)

trsh avatar trsh commented on May 28, 2024 1

@WaleedAshraf Ouch. Ok got it! Thanks man.

from asyncapi-validator.

WaleedAshraf avatar WaleedAshraf commented on May 28, 2024

@trsh Your message in the "subscribe" operation doesn't have msgIdentifier. Add it at line 34 in the above code ^.

from asyncapi-validator.

trsh avatar trsh commented on May 28, 2024

@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.

WaleedAshraf avatar WaleedAshraf commented on May 28, 2024

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.

trsh avatar trsh commented on May 28, 2024

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.

WaleedAshraf avatar WaleedAshraf commented on May 28, 2024

Can you share your updated schema? @trsh

from asyncapi-validator.

trsh avatar trsh commented on May 28, 2024

@WaleedAshraf https://pastebin.com/ce4fV8PQ

from asyncapi-validator.

WaleedAshraf avatar WaleedAshraf commented on May 28, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.