asyncapi / go-watermill-template

Go template for the AsyncAPI Generator using Watermill module
Apache License 2.0
49 stars 16 forks source link

TypeError: renderer.nameField is not a function #209

Closed tobiasjaster closed 1 year ago

tobiasjaster commented 1 year ago

Describe the bug

Trying to render simple Example code produce error during generating payload.go

How to Reproduce

Steps to reproduce the issue. Attach all resources that can help us understand the issue:

docker run --rm -it -v ~\asyncapi2.yaml:/app/asyncapi.yaml -v ~\out:/app/output asyncapi/generator -o /app/output /app/asyncapi.yaml @asyncapi/go-watermill-template --force-write

asyncapi: 2.4.0

info:
  title: Streetlights API
  version: 1.0.0
  description: |
    The Smartylighting Streetlights API allows you
    to remotely manage the city lights.
  license:
    name: Apache 2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0'

defaultContentType: application/json

servers:
  local:
    url: localhost:5672
    protocol: amqp
    security:
      - user-password: []

channels:
  light/measured:
    bindings:
      amqp:
        is: routingKey
        queue:
          name: light/measured
          durable: true
          exclusive: true
          autoDelete: false
          vhost: /
        bindingVersion: 0.2.0
    publish:
      summary: Inform about environmental lighting conditions for a particular streetlight.
      operationId: onLightMeasured
      message:
        $ref: '#/components/messages/LightMeasured'
    subscribe:
      summary: publishes light measurements
      operationId: publishLumens
      message:
        $ref: '#/components/messages/LightMeasured'

components:
  securitySchemes:
    user-password:
      type: userPassword
  messages:
    LightMeasured:
      name: LightMeasured
      payload:
        $id: LightMeasured
        type: object
        additionalProperties: false
        properties:
          id:
            type: integer
            minimum: 0
            description: Id of the streetlight.
          lumens:
            type: integer
            minimum: 0
            description: Light intensity measured in lumens.
          sentAt:
            type: string
            format: date-time
            description: Date and time when the message was sent.
Something went wrong:
TypeError: renderer.nameField is not a function
    at Object.field (/usr/local/lib/node_modules/@asyncapi/generator/node_modules/@asyncapi/go-watermill-template/template/asyncapi/payload.js:9:47)
    at StructRenderer.<anonymous> (/usr/local/lib/node_modules/@asyncapi/generator/node_modules/@asyncapi/modelina/src/generators/AbstractRenderer.ts:51:78)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/@asyncapi/generator/node_modules/@asyncapi/modelina/lib/cjs/generators/AbstractRenderer.js:5:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Expected behavior

Fully rendered output folder

Hope, someone can help me find, what I am doing wrong

github-actions[bot] commented 1 year ago

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.