Giter Club home page Giter Club logo

Comments (9)

gbaird avatar gbaird commented on June 14, 2024

You can try reading my Swagger JSON here: http://qa.walletron.com/api/api-docs

Thanks and great project!

-Garrett

from swagger2markup.

RobWin avatar RobWin commented on June 14, 2024

Hello,
the exceptions is thrown in the official SwaggerParser. But why does the server return a 500 HTTP Code? This does not seem to be a problem of the Parser, but of the server code?

Kind regards,
Robert

from swagger2markup.

gbaird avatar gbaird commented on June 14, 2024

The server is expecting the encoded URL, in this case: http://localhost:8080/Walletron/api/api-docs/ver1/brands/%7Bbrand%7D/templates That works just fine and it appears browsers like Chrome and cUrl utilities like Postman do this automatically. I am able however to reproduce the error on a straight curl from the command line.

Is there a config setting I'm missing to get swagger to encode this? Sorry to waste your time. :(

from swagger2markup.

RobWin avatar RobWin commented on June 14, 2024

Could you please address this issue in https://github.com/swagger-api/swagger-parser

from swagger2markup.

RobWin avatar RobWin commented on June 14, 2024

In my demo it works with brackets. https://github.com/RobWin/spring-swagger2markup-demo

@RestController
@RequestMapping(value = "/quotas")
@Api(value = "Quotas API", description = "Quotas API allows bla bla bla bla.")
public class MailStorageQuotaController{

    @ResponseStatus(HttpStatus.NO_CONTENT)
    @RequestMapping(method = RequestMethod.PUT)
    @ApiOperation(value = "Create a quota.", notes =  "Create a quota allows bla bla bla bla")
    public void createMailStorageQuota(@ApiParam(name = "MailStorageQuota", value = "MailStorageQuota", required = true) @RequestBody MailStorageQuota mailStorageQuota) {

    }

    @ResponseStatus(HttpStatus.NO_CONTENT)
    @RequestMapping(value = "/{quotaId}", method = RequestMethod.POST)
    @ApiOperation(value = "Update a quota.", notes =  "Update a quota allows bla bla bla bla")
    public void updateMailStorageQuota(@ApiParam(value = "quotaId", required = true)
                                           @PathVariable("quotaId") String quotaId,
                                       @ApiParam(name = "MailStorageQuota", value = "MailStorageQuota", required = true)
                                       @RequestBody MailStorageQuota mailStorageQuota) {
    }

    @RequestMapping(value = "/{quotaId}", method = RequestMethod.GET)
    @ApiOperation(value = "Get a quotas.", notes =  "Get a quota allows bla bla bla bla")
    public MailStorageQuotaResponse getMailStorageQuota(@PathVariable("quotaId") String quotaId) {
        return new MailStorageQuotaResponse(new MailStorageQuota(MailStorageQuotaValue.NINETYDAYS, QuotaValueType.CUSTOM));
    }

    @ResponseStatus(HttpStatus.NO_CONTENT)
    @RequestMapping(value = "/{quotaId}", method = RequestMethod.DELETE)
    @ApiOperation(value = "Delete a quota.", notes =  "Delete a quotas allows bla bla bla bla")
    public void deleteMailStorageQuota(@PathVariable("quotaId") String quotaId) {

    }
}

from swagger2markup.

gbaird avatar gbaird commented on June 14, 2024

Hmm, I'm using Jersey - here's an example:
There are the problematic curly braces in the middle of the Path...

@path("ver1/brands/{brand}/templates")
@Api(value = "ver1/brands/{brand}/templates", description = "Communication Template Management")
@RequestScoped
public class TemplateRestApi {

@GET
@ApiOperation(value = "List existing communication templates", response = Template.class, responseContainer = "List")
@ApiResponses(value = {
    @ApiResponse(code = 500, message = "Exception"),
    @ApiResponse(code = 404, message = "Not authorized")
})
@Produces(MediaType.APPLICATION_JSON)
public Response getTemplatesByBrand(

}

Looks like Swagger Parser MAY have addressed this in 1.0.1 but I'm not sure.

from swagger2markup.

RobWin avatar RobWin commented on June 14, 2024

Can't you change the Paths as follows:

@Path("ver1/brands/{brand}")
@Api(value = "ver1/brands/{brand}", description = "Communication Template Management")
@RequestScoped
public class TemplateRestApi {
@GET
@Path("/templates")
@ApiOperation(value = "List existing communication templates", response = Template.class, responseContainer = "List")
@ApiResponses(value = {
    @ApiResponse(code = 500, message = "Exception"),
    @ApiResponse(code = 404, message = "Not authorized")
})
@Produces(MediaType.APPLICATION_JSON)
public Response getTemplatesByBrand(

}

from swagger2markup.

gbaird avatar gbaird commented on June 14, 2024

Unfortunately, Jersey doesn't like the duplicates that creates. I have several classes based on this "brand" entity. Here's an update over on the parser project that I believe will solve this problem: swagger-api/swagger-parser#32

Thanks for your attention on this!

from swagger2markup.

RobWin avatar RobWin commented on June 14, 2024

You are welcome.
Feel free to give me your star ;-)

from swagger2markup.

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.