Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swagger-katharsis (community growth) #34

Closed
masterspambot opened this issue Jul 29, 2016 · 12 comments
Closed

swagger-katharsis (community growth) #34

masterspambot opened this issue Jul 29, 2016 · 12 comments
Milestone

Comments

@masterspambot
Copy link
Member

From @ieugen on March 29, 2016 8:24

Hello,

I'm looking for API docuemntation adn I found [1] . It's a bit behind but I think it can be improved and it would be nice to have it as part of the community.

I propose we ask @woonsan if he is willing to maintain swagger-katharsis as part and under katharsis-project, provided of course the other team members agree.

Wdyt @meshuga , @masterspambot ? I'm willing to contribute to the project since I will need to document the API for the project. I'm more inclined to do an offline annotation parsing solution to generate the docs on build for a specific version.

[1] https://github.com/woonsan/swagger-katharsis

Copied from original issue: katharsis-project/katharsis-core#273

@masterspambot
Copy link
Member Author

From @woonsan on March 29, 2016 13:10

I'm very willing to put that in katharsis-project if accepted. :-) Actually my goal was to make it working with basic features at least and propose it to katharsis. But unfortunately, I couldn't find enough time to make it for some other work to do. Its status is just an initial experiment at the moment.
Anyway, I guess we have another volunteer at least to make it work. So, I'm very willing to work with you guys and if you guys like it, I can transfer it to katharsis-project, too.

@masterspambot
Copy link
Member Author

From @keithdmoore on March 29, 2016 13:19

There is also this placeholder project. https://github.com/meshuga/katharsis-springfox

@masterspambot
Copy link
Member Author

Personally I have nothing against it, but as far as I know @ieugen has still some work to do with katharsis-vertex and we are gonna need maintainer for this repo... Can we handle that?

@masterspambot
Copy link
Member Author

From @ieugen on March 29, 2016 15:15

@masterspambot The idea behind a community is to give authority. WIth authority comes responsability .

If we have an open process of how people can contribute then things can move with minimal intervention.

Regarding my work on katharsis-vertx: I can allready publish to jcenter. I'm going to sync with Maven tomorrow. Other then that, most of the features are ok.

@keithdmoore : what about springfox? it seems empty.

@remmeier
Copy link
Contributor

remmeier commented Aug 2, 2016

@nilportugues
Copy link

As of now, I recommend to do this by adding an Interface to the "Repository" class.

The implemented interface can hold the Annotations for Swagger and the documentation can be generated.

I have done this with spring-boot and springfox. No problems at all.

@charybr
Copy link

charybr commented Nov 5, 2016

Hi nilportugues,

It would be great, if you can provide a sample.

Thanks!
Chary

@nilportugues
Copy link

nilportugues commented Nov 7, 2016

@charybr sure can.

In your pom.xml 's dependencies:

        <!-- SWAGGER -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${springfox-version}</version>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-core</artifactId>
            <version>${swagger-core-version}</version>
        </dependency>

Then, let's say you have a controller... for instance:

import io.katharsis.repository.annotations.*;
import io.katharsis.response.JsonApiResponse;
import io.swagger.annotations.ApiParam;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.PathVariable;

import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.http.HttpServletRequest;

@Named
@JsonApiResourceRepository(Message.class)
public class MessageController implements IMessageController{

    @JsonApiDelete
    public void delete(@PathVariable("id") @ApiParam(value = "Message Id") String id) throws Exception    {
        messageDeleterService.delete(id);
    }
}

Notice the IMessageController, this is it's implementation:

import io.katharsis.response.JsonApiResponse;
import io.swagger.annotations.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import springfox.documentation.annotations.ApiIgnore;

@Controller
public interface IMessageController {

    @ApiResponses({
        @ApiResponse(code = 204, message = "No Content"),
        @ApiResponse(code = 404, message = "Not Found"),
    })
    @ApiOperation(
        value = "Delete a Message.",
        nickname = "deleter",
        tags = {"API Message"}
    )
    @RequestMapping(
        path = "api/messages/{id}", //THIS NEEDS TO MATCH WHAT KATHARSIS GENERATES.
        method= RequestMethod.DELETE,
        produces = "application/vnd.api+json"
    )
    void delete(@PathVariable("id") @ApiParam(value = "Message Id") String id) throws Exception;

}

You won't get the models in Swagger for POST, PUT or PATCH. But you'll get very basic Swagger going on.

@charybr
Copy link

charybr commented Nov 10, 2016

Thanks a lot, nilportugues!

@chb0github chb0github added this to the v3.0.0 milestone Jan 19, 2017
@chb0github
Copy link
Contributor

We need to roll in SOME kinda support for a UI. I am in favor of this

@chb0github
Copy link
Contributor

I have been looking at this and I don't see a clear means of doing this. I checked out what meshuga had done and, no surprise, there is no root resource to discover. So, when you hit / you get a 500 error. I posted about this a while ago. I will continue to investigate now that I have some time but the lack of a root issue will likely be a show stopper

@chb0github
Copy link
Contributor

chb0github commented Mar 13, 2017

After careful deliberation, the counsel of elders has decreed that this shall not be supported. We believe in hypermedia. It's our belief that swagger cannot support the level of functionality as described in JSON API.

Thanks for your cooperation,

The Management.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants