Coder Social home page Coder Social logo

Comments (12)

phillip-kruger avatar phillip-kruger commented on August 18, 2024 1

@nicolasduminil no, it's just easier to look at an issue if there is a reproducer :) @MikeEdgar I'll leave this to you.

from quarkus.

nicolasduminil avatar nicolasduminil commented on August 18, 2024 1

@phillip-kruger : LOL ! It's even easier not to look at all ...

from quarkus.

quarkus-bot avatar quarkus-bot commented on August 18, 2024

/cc @EricWittmann (openapi), @Ladicek (smallrye), @MikeEdgar (openapi), @jmartisk (smallrye), @phillip-kruger (openapi,smallrye), @radcortez (smallrye)

from quarkus.

phillip-kruger avatar phillip-kruger commented on August 18, 2024

Can you share your openapi.json or yaml, that gets generated ?

from quarkus.

MikeEdgar avatar MikeEdgar commented on August 18, 2024

In addition to what Phillip requested, I suspect you should be using an @RequestBody annotation rather than an @Parameter to represent a POST body.

@RequestBody(content = @Content(example = "your example"))

from quarkus.

nicolasduminil avatar nicolasduminil commented on August 18, 2024

@phillip-kruger : I'm attaching here the openapi file.
openapi.zip

from quarkus.

nicolasduminil avatar nicolasduminil commented on August 18, 2024

@MikeEdgar : using @RequestBody, as you suggested above, instead of @Parameter, didn't change anything to the mentioned behavior.

from quarkus.

phillip-kruger avatar phillip-kruger commented on August 18, 2024

@nicolasduminil can you share a small reproducer ?

from quarkus.

nicolasduminil avatar nicolasduminil commented on August 18, 2024

@phillip-kruger : I will as soon as I'll have the time. But since you need a reproducer, should I understand that you couldn't reproduce the issue by yourself ? I mean, do you confirm that you could test and using the @Parameter annotation, like in my example, or the @RequestBody one, like mentioned by @MikeEdgar, you succeeded to get the expected result ? And in this case, which one did you use, @Parameter or @RequestBody ?

from quarkus.

MikeEdgar avatar MikeEdgar commented on August 18, 2024

I was able to get the example in the output using the @RequestBody annotation. That's the correct annotation for a POST body, although I believe the Swagger annotations use (or did use at one point) the @Parameter annotation. If you try again with @RequestBody maybe share here just the method you test and perhaps there is some other adjustment that you need.

from quarkus.

nicolasduminil avatar nicolasduminil commented on August 18, 2024

@MikeEdgar : I neglected to mention that, in my case, I have separated the interface and implementation, as follows:

public interface CustomerResource
{
  @POST
  @Operation(description = "Create a new customer")
  @APIResponse(responseCode = "500", description = "An internal server error has occurred",    content = @Content(mediaType = APPLICATION_XML))
  @APIResponseSchema(value = Customer.class, responseDescription = "The new customer has been created", responseCode = "201")
  ...
  Response createCustomer (Customer customer, @Context UriInfo uriInfo) throws IOException;
}
...
@Path("customers")
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
public class CustomerResourceImpl implements CustomerResource
{

  @Override
  public Response createCustomer(Customer customer, @Context UriInfo uriInfo) throws IOException
  {
    ...
  }
...
}

Does it change anything ? Is that supposed to work as well or is there any obligation to annotate the implementation and not the interface ?

from quarkus.

MikeEdgar avatar MikeEdgar commented on August 18, 2024

I neglected to mention that, in my case, I have separated the interface and implementation
Does it change anything ? Is that supposed to work as well or is there any obligation to annotate the implementation and not the interface ?

It should support annotations like you have them. In your code snippet I don't see the @RequestBody, in which location are you using it?

from quarkus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.