Giter Site home page Giter Site logo

Comments (12)

charybr avatar charybr commented on August 12, 2024 1

Thanks a lot, nilportugues!

from katharsis-framework.

masterspambot avatar masterspambot commented on August 12, 2024

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.

from katharsis-framework.

masterspambot avatar masterspambot commented on August 12, 2024

From @keithdmoore on March 29, 2016 13:19

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

from katharsis-framework.

masterspambot avatar masterspambot commented on August 12, 2024

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?

from katharsis-framework.

masterspambot avatar masterspambot commented on August 12, 2024

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.

from katharsis-framework.

remmeier avatar remmeier commented on August 12, 2024

related topics:
OAI/OpenAPI-Specification#476
OAI/OpenAPI-Specification#519

from katharsis-framework.

nilportugues avatar nilportugues commented on August 12, 2024

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.

from katharsis-framework.

charybr avatar charybr commented on August 12, 2024

Hi nilportugues,

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

Thanks!
Chary

from katharsis-framework.

nilportugues avatar nilportugues commented on August 12, 2024

@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.

from katharsis-framework.

chb0github avatar chb0github commented on August 12, 2024

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

from katharsis-framework.

chb0github avatar chb0github commented on August 12, 2024

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

from katharsis-framework.

chb0github avatar chb0github commented on August 12, 2024

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.

from katharsis-framework.

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.