Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » kura and swagger codegen issues
kura and swagger codegen issues [message #1811187] Wed, 28 August 2019 10:35
Aistis Kaikaris is currently offline Aistis KaikarisFriend
Messages: 33
Registered: March 2018
Member
I'm using swagger to generate interfaces and models for my endpoints in kura, however the generated "@JsonProperty("fieldName")" annotation (from "com.fasterxml.jackson.annotation") in the model class does not seem to work.

My generated endpoint interface:
 @Path("/contact")
@Api(description = "the contact API")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJAXRSSpecServerCodegen", date = "2019-08-28T13:04:01.544+03:00")
public interface ContactApi {

    @POST
    @Produces({ "application/json" })
    @ApiOperation(value = "Add new contact", notes = "", tags={  })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "succsseful operation", response = Void.class) })
    void contactPost(@Valid Contact contact);
 }


My generated model:

public class Contact  implements Serializable {

  private @Valid String [b]contactId[/b] = null;
....
  
  @ApiModelProperty(value = "")
  @JsonProperty("[b]contact_id[/b]")
  public String getContactId() {
    return [b]contactId[/b];
  }
  public void setContactId(String contactId) {
    this.contactId = contactId;
  }
...
}


When someone calls this endpoint with json that has "contact_id" field, it should be mapped to "contactId", but this does not work, so whichever service is doing the mapping does not seem to read the "@JsonProperty" annotation.

Has anyone tried to use the "@JsonProperty" annotation and had it working? Is it possible that "com.eclipsesource.jaxrs.jersey-min_2.22.2" might not support jackson annotations?


[Updated on: Thu, 29 August 2019 04:45]

Report message to a moderator

Previous Topic:firewall warning
Next Topic:Connection loss after uninstalling dhcpcd5
Goto Forum:
  


Current Time: Thu Apr 25 06:33:45 GMT 2024

Powered by FUDForum. Page generated in 0.03264 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top