Skip to content

Reimplement grape-swagger on top of swagger-rb. #137

Open
@antek-drzewiecki

Description

@antek-drzewiecki

I would like to start a discussion about this gem's structure. At this stage this gem consist of a single file with a single method add_swagger_documentation. This methods creates a documentation class and adds all api documentation endpoints to it. At this stage all methods on api declaration, endpoints, parameters, models are in one single file now.

What is suggest is to divide logic a bit more into classes or modules with structure corresponding to the swagger spec. This has the advantage that you can separate logic into places where it belongs.
It improves readability and testability of your code. When editing the parameter module you are sure you are not accidentally editing api information. Since you have a little bit more methods defined, you might also be able to add an unit test for your method instead of only integration tests.
Last point is that variables are on their local scope, currently you can declare a variable somewhere on top and use it on line nr 200.

What do you all think of this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions