Skip to content

[BUG] Payload don't generated with avro schema #419

@leonardotorresaltez

Description

@leonardotorresaltez

Describe the bug.

Hello,
I tried to generate avro mapping java classes with spring template but in any way the generator is making json mapping java classes ( with @JsonProperty property ) .

asyncapi: '2.6.0'
info:
  title: Mercadona Kafka API
  version: 1.0.0
  description: |-
    Api acerca de las entidades en Mercadona.
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0

defaultContentType: 'application/vnd.apache.avro+json;version=1.9.0'

servers:
  production:
    url: broker:9092
    description: Kafka PRODUCTION cluster
    protocol: kafka

channels:
  mytopic:
    description: The topic.
    publish:
      summary: publish message.
      operationId: publishStoreassortmentvisibility
      message:
        schemaFormat: 'application/vnd.apache.avro;version=1.9.0'
        $ref: '#/components/messages/storeassortmentvisibility'
    subscribe:
      summary: receive message.
      operationId: receiveStoreassortmentvisibility
      message:
        schemaFormat: 'application/vnd.apache.avro;version=1.9.0'
        $ref: '#/components/messages/storeassortmentvisibility'
components:
  messages:
    storeassortmentvisibility:
      name: storeassortmentvisibility
      title: storeassortmentvisibility measured     
      schemaFormat: 'application/vnd.apache.avro;version=1.9.0'
      payload:
        type: record
        name: User
        namespace: com.company
        doc: User information
        fields:
          - name: displayName
            type: string
          - name: email
            type: string
          - name: age
            type: int

the command is :

 asyncapi generate fromTemplate asyncapi_demo_contract262.yml @asyncapi/java-spring-template@1.5.1 --output ./output_folder --force-write

the generated file is:

package com.asyncapi.model;


import jakarta.validation.constraints.*;
import jakarta.validation.Valid;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;

import javax.annotation.processing.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * User information
 */
@Generated(value="com.asyncapi.generator.template.spring", date="2024-10-27T11:32:20.876Z")
public class ComCompanyUser {
    
    private @Valid String displayName;
    
    private @Valid String email;
    
    private @Valid int age;
    

    

    
    @JsonProperty("displayName")@NotNull
    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }
    

    
    @JsonProperty("email")@NotNull
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

 . . .

Expected behavior

Expected to see generated java avro mapping files , example :

@org.apache.avro.specific.AvroGenerated
public class User extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord
. . .

Screenshots

none

How to Reproduce

  1. I first did this
  2. I then did this
  3. And so on . . .
 asyncapi generate fromTemplate asyncapi_demo_contract262.yml @asyncapi/java-spring-template@1.5.1 --output ./output_folder --force-write

🥦 Browser

Microsoft Edge

👀 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 workingstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions