generator
generator copied to clipboard
oneOf is not working in message asyncAPI: 2.3.0
oneOf is not working in message asyncAPI: 2.3.0
While generating spring boot template through npm getting this bellow error
Something went wrong: Template render error: (/usr/lib/node_modules/@asyncapi/generator/node_modules/@asyncapi/java-spring-template/template/src/test/java/com/asyncapi/SimpleKafkaTest.java) [Line 13, Column 64] Error: Unable to call
the return value of (the return value of (channel["subscribe"])["message"])["payload"], which is undefined or falsey at Object._prettifyError (/usr/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/lib.js:36:11) at /usr/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/environment.js:563:19 at Template.root [as rootRenderFunc] (eval at _compile (/usr/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/environment.js:633:18), <anonymous>:651:3) at Template.render (/usr/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/environment.js:552:10) at Environment.renderString (/usr/lib/node_modules/@asyncapi/generator/node_modules/nunjucks/src/environment.js:380:17) at /usr/lib/node_modules/@asyncapi/generator/lib/renderer/nunjucks.js:32:14 at new Promise (<anonymous>) at nunjucksExport.renderNunjucks (/usr/lib/node_modules/@asyncapi/generator/lib/renderer/nunjucks.js:31:10) at Generator.renderFile (/usr/lib/node_modules/@asyncapi/generator/lib/generator.js:703:12) at Generator.renderAndWriteToFile (/usr/lib/node_modules/@asyncapi/generator/lib/generator.js:617:27) at Generator.generateFile (/usr/lib/node_modules/@asyncapi/generator/lib/generator.js:667:5) at Generator.filesGenerationHandler (/usr/lib/node_modules/@asyncapi/generator/lib/generator.js:542:7) at Walker.<anonymous> (/usr/lib/node_modules/@asyncapi/generator/lib/generator.js:466:11)
using this yaml config 'asyncapi: '2.3.0' info: title: Streetlights asddasdas Kafka API version: '1.0.0' description: | The Smartylighting Streetlights API allows you to remotely manage the city lights.
### Check out its awesome features:
* Turn a specific streetlight on/off 🌃
* Dim a specific streetlight 😎
* Receive real-time information about environmental lighting conditions 📈
servers: test: url: test.mykafkacluster.org:8092 protocol: kafka description: Test broker
defaultContentType: application/json
channels:
turnoff:
subscribe:
message:
oneOf:
- $ref: '#/components/messages/turnOnOff'
- $ref: '#/components/messages/dimLight'
- $ref: '#/components/messages/lightMeasured'
components: messages: lightMeasured: name: lightMeasured title: Light measured summary: Inform about environmental lighting conditions of a particular streetlight. contentType: application/json payload: $ref: "#/components/schemas/lightMeasuredPayload" turnOnOff: name: turnOnOff title: Turn on/off summary: Command a particular streetlight to turn the lights on or off. payload: $ref: "#/components/schemas/turnOnOffPayload" dimLight: name: dimLight title: Dim light summary: Command a particular streetlight to dim the lights. payload: $ref: "#/components/schemas/dimLightPayload"
schemas: lightMeasuredPayload: type: object properties: lumens: type: integer minimum: 0 description: Light intensity measured in lumens. sentAt: $ref: "#/components/schemas/sentAt" turnOnOffPayload: type: object properties: command: type: string description: Whether to turn on or off the light. sentAt: $ref: "#/components/schemas/sentAt" dimLightPayload: type: object properties: percentage: type: integer description: Percentage to which the light should be dimmed to. minimum: 0 maximum: 100 sentAt: $ref: "#/components/schemas/sentAt" sentAt: type: string format: date-time description: Date and time when the message was sent.
securitySchemes: saslScram: type: scramSha256 description: Provide your username and password for SASL/SCRAM authentication
parameters: streetlightId: description: The ID of the streetlight. schema: type: string
operationTraits: kafka: bindings: kafka: clientId: my-app-id'
How to Reproduce
Using generator version
'/usr/lib
-- @asyncapi/[email protected]
-- @asyncapi/[email protected]'
node version : v16.14.2 npm version : 8.5.0
I created this on asyncapi studio and it is parsed in studio but giving template error while generating the spring-boot-template.
- Screenshots
- Link to GitHub repository with project that has issues
- Files that can help reproduce the issue, like your AsyncAPI file, either paste inside the issue in a code block or in a sharable gist
Expected behavior
Multiple different message handler for one channel with kafka.