Skip to content

[BUG] Missing end quote in go struct json tag with oneOf #2430

@AndersBennedsgaard

Description

@AndersBennedsgaard

Describe the bug.

return `${content} \`json:"-,omitempty\``;
produces broken JSON struct tags, since it does not include the closing quote, producing code like:

type Options struct {
  SomeOptions `json:"-,omitempty`  // notice the missing "
}

Expected behavior

It produces valid Go struct tags

Screenshots

No screenshots

How to Reproduce

Using something like this:

asyncapi: 3.0.0
info:
  title: Example
  version: 0.1.0
components:
  messages:
    Example:
      payload:
        oneOf:
          - type: string
          - type: number

Producing Go models using bunx @asyncapi/modelina-cli generate golang asyncapi.yaml --goIncludeTags --packageName=example -o pkg/example generates pkg/example/anonymous_schema_1.go:

package messaging

type AnonymousSchema_1 struct {
  string `json:"-,omitempty`
  float64 `json:"-,omitempty`
}

🖥️ Device Information [optional]

  • Operating System (OS): Windows 11 on WSL

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions